48 {
49 if (!client.hasMinMode() || n_atoms < 1 ||
position ==
nullptr ||
50 mode == nullptr) {
51 return false;
52 }
53 release();
54 if (force_gate < RGSADDLE_FORCE_L2 ||
55 force_gate > RGSADDLE_FORCE_MAX_ATOM) {
56 return false;
57 }
58 rgsaddle_minmode_config_t cfg{};
59 cfg.version.major = RGSADDLE_ABI_MAJOR;
60 cfg.version.minor = 0;
62 cfg.method = 0;
63 cfg.dr = 0.01;
64 cfg.rotation_tol = rotation_tol;
65 cfg.max_rotations = max_rotations;
66 cfg.krylov_dim = 8;
67 cfg.force_tol = force_tol > 0.0 ? force_tol : 1e-3;
68 cfg.max_move = 0.1;
69 sess_ = client.minModeCreate(&cfg, n_atoms,
position, mode);
70 if (sess_ == nullptr) return false;
71 if (client.minModeSetForceGate(
72 sess_, static_cast<rgsaddle_force_gate_t>(force_gate)) !=
73 RGSADDLE_OK) {
74 client.minModeFree(sess_);
75 sess_ = nullptr;
76 return false;
77 }
78 client_ = &client;
79 n_atoms_ = n_atoms;
80 return true;
81 }
bool position(double *out)