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;
26 this_colvar->add_bias_force(force);
27 script->set_result_colvarvalue(force);
31CVSCRIPT(colvar_communicateforces,
32 "Communicate bias forces from this colvar to atoms",
35 this_colvar->communicate_forces();
39CVSCRIPT(colvar_cvcflags,
40 "Enable or disable individual components by setting their active flags",
42 "flags : integer array - Zero/nonzero value disables/enables the CVC",
43 std::string
const flags_str(script->obj_to_str(script->get_colvar_cmd_arg(0, objc, objv)));
44 std::istringstream is(flags_str);
45 std::vector<bool> flags;
48 flags.push_back(flag != 0);
50 int res = this_colvar->set_cvc_flags(flags);
51 if (res != COLVARS_OK) {
52 script->add_error_msg(
"Error setting CVC flags");
53 return COLVARSCRIPT_ERROR;
55 script->set_result_str(
"0");
59CVSCRIPT(colvar_delete,
60 "Delete this colvar, along with all biases that depend on it",
68 "Get the value of the given feature for this colvar\n"
69 "state : 1/0 - State of the given feature",
71 "feature : string - Name of the feature",
72 return script->proc_features(this_colvar, objc, objv);
75CVSCRIPT(colvar_getappliedforce,
76 "Return the total of the forces applied to this colvar\n"
77 "force : float - Applied force; matches the colvar dimensionality",
80 script->set_result_colvarvalue(this_colvar->applied_force());
84CVSCRIPT(colvar_resetbiasforce,
85 "Return the total of the forces applied to this colvar",
88 this_colvar->reset_bias_force();
92CVSCRIPT(colvar_getatomgroups,
93 "Return the atom indices used by this colvar as a list of lists\n"
94 "groups : array of arrays of ints - Atom indices",
98 std::vector<std::vector<int> > lists = this_colvar->get_atom_lists();
99 std::vector<std::vector<int> >::iterator li = lists.begin();
100 for ( ; li != lists.end(); ++li) {
102 std::vector<int>::iterator lj = (*li).begin();
103 for ( ; lj != (*li).end(); ++lj) {
109 script->set_result_str(result);
113CVSCRIPT(colvar_getatomids,
114 "Return the list of atom indices used by this colvar\n"
115 "indices : array of ints - Atom indices",
118 script->set_result_int_vec(this_colvar->atom_ids);
122CVSCRIPT(colvar_getconfig,
123 "Return the configuration string of this colvar\n"
124 "conf : string - Current configuration string",
127 script->set_result_str(this_colvar->get_config());
131CVSCRIPT(colvar_getgradients,
132 "Return the atomic gradients of this colvar\n"
133 "gradients : array of arrays of floats - Atomic gradients",
136 script->set_result_rvector_vec(this_colvar->atomic_gradients);
140CVSCRIPT(colvar_gettotalforce,
141 "Return the sum of internal and external forces to this colvar\n"
142 "force : float - Total force; matches the colvar dimensionality",
145 script->set_result_colvarvalue(this_colvar->total_force());
149CVSCRIPT(colvar_getvolmapids,
150 "Return the list of volumetric map indices used by this colvar",
153 script->set_result_int_vec(this_colvar->get_volmap_ids());
158 "Get a help summary or the help string of one colvar subcommand\n"
159 "help : string - Help string",
161 "command : string - Get the help string of this specific command",
162 unsigned char *
const cmdobj =
163 script->get_colvar_cmd_arg(0, objc, objv);
167 std::string
const cmdstr(script->obj_to_str(cmdobj));
169 script->set_result_str(script->get_command_cmdline_help(colvarscript::use_colvar,
171 return cvm::get_error();
173 return COLVARSCRIPT_ERROR;
176 script->set_result_str(script->get_cmdline_help_summary(colvarscript::use_colvar));
181CVSCRIPT(colvar_modifycvcs,
182 "Modify configuration of individual components by passing string arguments",
184 "confs : sequence of strings - New configurations; empty strings are skipped",
185 std::vector<std::string>
const confs(script->obj_to_str_vector(script->get_colvar_cmd_arg(0, objc, objv)));
187 int res = this_colvar->update_cvc_config(confs);
189 if (res != COLVARS_OK) {
190 script->add_error_msg(
"Error setting CVC flags");
191 return COLVARSCRIPT_ERROR;
193 script->set_result_str(
"0");
197CVSCRIPT(colvar_run_ave,
198 "Get the current running average of the value of this colvar\n"
199 "value : float or array - Averaged value; matches the colvar dimensionality",
202 script->set_result_colvarvalue(this_colvar->run_ave());
207 "Set the given feature of this colvar to a new value",
209 "feature : string - Name of the feature\n"
210 "value : string - String representation of the new feature value",
211 return script->proc_features(this_colvar, objc, objv);
214CVSCRIPT(colvar_state,
215 "Print a string representation of the feature state of this colvar\n"
216 "state : string - The feature state",
219 this_colvar->print_state();
224 "Get the type description of this colvar\n"
225 "type : string - Type description",
228 script->set_result_str(this_colvar->value().type_desc(this_colvar->value().value_type));
232CVSCRIPT(colvar_update,
233 "Recompute this colvar and return its up-to-date value\n"
234 "value : float or array - Current value; matches the colvar dimensionality",
238 this_colvar->update_forces_energy();
239 script->set_result_colvarvalue(this_colvar->value());
243CVSCRIPT(colvar_value,
244 "Get the current value of this colvar\n"
245 "value : float or array - Current value; matches the colvar dimensionality",
248 script->set_result_colvarvalue(this_colvar->value());
252CVSCRIPT(colvar_width,
253 "Get the width of this colvar\n"
254 "width : float - Value of the width",
257 script->set_result_str(
cvm::to_str(this_colvar->width, 0,
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