11CVSCRIPT(colvar_addforce,
12 "Apply the given force onto this colvar (no effects outside run)\n"
13 "force : float or array - Applied force; matches colvar dimensionality",
15 "force : float or array - Applied force; must match colvar dimensionality",
16 std::string
const f_str(script->obj_to_str(script->get_colvar_cmd_arg(0, objc, objv)));
17 std::istringstream is(f_str);
21 force.is_derivative();
22 if (force.from_simple_string(is.str()) != COLVARS_OK) {
23 script->add_error_msg(
"addforce : error parsing force value");
24 return COLVARSCRIPT_ERROR;
27 this_colvar->add_bias_force(force);
28 script->set_result_colvarvalue(force);
32CVSCRIPT(colvar_communicateforces,
33 "Communicate bias forces from this colvar to atoms",
36 this_colvar->communicate_forces();
40CVSCRIPT(colvar_cvcflags,
41 "Enable or disable individual components by setting their active flags",
43 "flags : integer array - Zero/nonzero value disables/enables the CVC",
44 std::string
const flags_str(script->obj_to_str(script->get_colvar_cmd_arg(0, objc, objv)));
45 std::istringstream is(flags_str);
46 std::vector<bool> flags;
49 flags.push_back(flag != 0);
51 int res = this_colvar->set_cvc_flags(flags);
52 if (res != COLVARS_OK) {
53 script->add_error_msg(
"Error setting CVC flags");
54 return COLVARSCRIPT_ERROR;
56 script->set_result_str(
"0");
60CVSCRIPT(colvar_delete,
61 "Delete this colvar, along with all biases that depend on it",
69 "Get the value of the given feature for this colvar\n"
70 "state : 1/0 - State of the given feature",
72 "feature : string - Name of the feature",
73 return script->proc_features(this_colvar, objc, objv);
76CVSCRIPT(colvar_getappliedforce,
77 "Return the total of the forces applied to this colvar\n"
78 "force : float - Applied force; matches the colvar dimensionality",
81 script->set_result_colvarvalue(this_colvar->applied_force());
85CVSCRIPT(colvar_resetbiasforce,
86 "Return the total of the forces applied to this colvar",
89 this_colvar->reset_bias_force();
93CVSCRIPT(colvar_getatomgroups,
94 "Return the atom indices used by this colvar as a list of lists\n"
95 "groups : array of arrays of ints - Atom indices",
99 std::vector<std::vector<int> > lists = this_colvar->get_atom_lists();
100 std::vector<std::vector<int> >::iterator li = lists.begin();
101 for ( ; li != lists.end(); ++li) {
103 std::vector<int>::iterator lj = (*li).begin();
104 for ( ; lj != (*li).end(); ++lj) {
110 script->set_result_str(result);
114CVSCRIPT(colvar_getatomids,
115 "Return the list of atom indices used by this colvar\n"
116 "indices : array of ints - Atom indices",
119 script->set_result_int_vec(this_colvar->atom_ids);
123CVSCRIPT(colvar_getconfig,
124 "Return the configuration string of this colvar\n"
125 "conf : string - Current configuration string",
128 script->set_result_str(this_colvar->get_config());
132CVSCRIPT(colvar_getgradients,
133 "Return the atomic gradients of this colvar\n"
134 "gradients : array of arrays of floats - Atomic gradients",
137 script->set_result_rvector_vec(this_colvar->atomic_gradients);
141CVSCRIPT(colvar_gettotalforce,
142 "Return the sum of internal and external forces to this colvar\n"
143 "force : float - Total force; matches the colvar dimensionality",
146 script->set_result_colvarvalue(this_colvar->total_force());
150CVSCRIPT(colvar_getvolmapids,
151 "Return the list of volumetric map indices used by this colvar",
154 script->set_result_int_vec(this_colvar->get_volmap_ids());
159 "Get a help summary or the help string of one colvar subcommand\n"
160 "help : string - Help string",
162 "command : string - Get the help string of this specific command",
163 unsigned char *
const cmdobj =
164 script->get_colvar_cmd_arg(0, objc, objv);
168 std::string
const cmdstr(script->obj_to_str(cmdobj));
170 script->set_result_str(script->get_command_cmdline_help(colvarscript::use_colvar,
172 return cvm::get_error();
174 return COLVARSCRIPT_ERROR;
177 script->set_result_str(script->get_cmdline_help_summary(colvarscript::use_colvar));
182CVSCRIPT(colvar_modifycvcs,
183 "Modify configuration of individual components by passing string arguments",
185 "confs : sequence of strings - New configurations; empty strings are skipped",
186 std::vector<std::string>
const confs(script->obj_to_str_vector(script->get_colvar_cmd_arg(0, objc, objv)));
188 int res = this_colvar->update_cvc_config(confs);
190 if (res != COLVARS_OK) {
191 script->add_error_msg(
"Error setting CVC flags");
192 return COLVARSCRIPT_ERROR;
194 script->set_result_str(
"0");
198CVSCRIPT(colvar_run_ave,
199 "Get the current running average of the value of this colvar\n"
200 "value : float or array - Averaged value; matches the colvar dimensionality",
203 script->set_result_colvarvalue(this_colvar->run_ave());
208 "Set the given feature of this colvar to a new value",
210 "feature : string - Name of the feature\n"
211 "value : string - String representation of the new feature value",
212 return script->proc_features(this_colvar, objc, objv);
215CVSCRIPT(colvar_state,
216 "Print a string representation of the feature state of this colvar\n"
217 "state : string - The feature state",
220 this_colvar->print_state();
225 "Get the type description of this colvar\n"
226 "type : string - Type description",
229 script->set_result_str(this_colvar->value().type_desc(this_colvar->value().value_type));
233CVSCRIPT(colvar_update,
234 "Recompute this colvar and return its up-to-date value\n"
235 "value : float or array - Current value; matches the colvar dimensionality",
239 this_colvar->update_forces_energy();
240 script->set_result_colvarvalue(this_colvar->value());
244CVSCRIPT(colvar_value,
245 "Get the current value of this colvar\n"
246 "value : float or array - Current value; matches the colvar dimensionality",
249 script->set_result_colvarvalue(this_colvar->value());
253CVSCRIPT(colvar_width,
254 "Get the width of this colvar\n"
255 "width : float - Value of the width",
258 script->set_result_str(
cvm::to_str(this_colvar->width, 0,
@ f_cv_apply_force
External force can be applied, either to atoms or to an extended DOF.
Definition: colvardeps.h:270
static void increase_depth()
Increase the depth (number of indentations in the output)
Definition: colvarmodule.cpp:1985
static size_t const cv_prec
Number of digits to represent a collective variables value(s)
Definition: colvarmodule.h:664
static size_t const cv_width
Number of characters to represent a collective variables value(s)
Definition: colvarmodule.h:666
static void decrease_depth()
Decrease the depth (number of indentations in the output)
Definition: colvarmodule.cpp:1991
static std::string to_str(char const *s)
Convert to string for output purposes.
Definition: colvarmodule.cpp:2392
Value of a collective variable: this is a metatype which can be set at runtime. By default it is set ...
Definition: colvarvalue.h:43