Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

colvarscript_commands_bias.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 
00003 // This file is part of the Collective Variables module (Colvars).
00004 // The original version of Colvars and its updates are located at:
00005 // https://github.com/Colvars/colvars
00006 // Please update all Colvars source files before making any changes.
00007 // If you wish to distribute your changes, please submit them to the
00008 // Colvars repository at GitHub.
00009 
00010 
00011 CVSCRIPT(bias_bin,
00012          "Get the current grid bin index (1D ABF only for now)\n"
00013          "bin : integer - Bin index",
00014          0, 0,
00015          "",
00016          script->set_result_int(this_bias->current_bin());
00017          return COLVARS_OK;
00018          )
00019 
00020 CVSCRIPT(bias_bincount,
00021          "Get the number of samples at the given grid bin (1D ABF only for now)\n"
00022          "samples : integer - Number of samples",
00023          0, 1,
00024          "index : integer - Grid index; defaults to current bin",
00025          int index = this_bias->current_bin();
00026          char const *indexarg =
00027            script->obj_to_str(script->get_bias_cmd_arg(0, objc, objv));
00028          if (indexarg) {
00029            std::string const param(indexarg);
00030            if (!(std::istringstream(param) >> index)) {
00031              script->add_error_msg("bincount: error parsing bin index");
00032              return COLVARSCRIPT_ERROR;
00033            }
00034          }
00035          script->set_result_int(this_bias->bin_count(index));
00036          return COLVARS_OK;
00037          )
00038 
00039 CVSCRIPT(bias_binnum,
00040          "Get the total number of grid points of this bias (1D ABF only for now)\n"
00041          "Bins : integer - Number of grid points",
00042          0, 0,
00043          "",
00044          int r = this_bias->bin_num();
00045          if (r < 0) {
00046            script->add_error_msg("Error: calling bin_num() for bias " +
00047                                  this_bias->name);
00048            return COLVARSCRIPT_ERROR;
00049          }
00050          script->set_result_int(r);
00051          return COLVARS_OK;
00052          )
00053 
00054 CVSCRIPT(bias_delete,
00055          "Delete this bias",
00056          0, 0,
00057          "",
00058          delete this_bias;
00059          return COLVARS_OK;
00060          )
00061 
00062 CVSCRIPT(bias_energy,
00063          "Get the current energy of this bias\n"
00064          "E : float - Energy value",
00065          0, 0,
00066          "",
00067          script->set_result_real(this_bias->get_energy());
00068          return COLVARS_OK;
00069          )
00070 
00071 CVSCRIPT(bias_get,
00072          "Get the value of the given feature for this bias\n"
00073          "state : 1/0 - State of the given feature",
00074          1, 1,
00075          "feature : string - Name of the feature",
00076          return script->proc_features(this_bias, objc, objv);
00077          )
00078 
00079 CVSCRIPT(bias_getconfig,
00080          "Return the configuration string of this bias\n"
00081          "conf : string - Current configuration string",
00082          0, 0,
00083          "",
00084          script->set_result_str(this_bias->get_config());
00085          return COLVARS_OK;
00086          )
00087 
00088 CVSCRIPT(bias_help,
00089          "Get a help summary or the help string of one bias subcommand\n"
00090          "help : string - Help string",
00091          0, 1,
00092          "command : string - Get the help string of this specific command",
00093          unsigned char *const cmdobj =
00094            script->get_colvar_cmd_arg(0, objc, objv);
00095          if (this_bias) {
00096          }
00097          if (cmdobj) {
00098            std::string const cmdstr(script->obj_to_str(cmdobj));
00099            if (cmdstr.size()) {
00100              script->set_result_str(script->get_command_cmdline_help(colvarscript::use_bias,
00101                                                                      cmdstr));
00102              return cvm::get_error();
00103            } else {
00104              return COLVARSCRIPT_ERROR;
00105            }
00106          } else {
00107            script->set_result_str(script->get_cmdline_help_summary(colvarscript::use_bias));
00108            return COLVARS_OK;
00109          }
00110          )
00111 
00112 CVSCRIPT(bias_load,
00113          "Load data into this bias",
00114          1, 1,
00115          "prefix : string - Read from a file with this name or prefix",
00116          char const *arg =
00117            script->obj_to_str(script->get_bias_cmd_arg(0, objc, objv));
00118          return this_bias->read_state_prefix(std::string(arg));
00119          )
00120 
00121 CVSCRIPT(bias_loadfromstring,
00122          "Load state data into this bias from a string",
00123          1, 1,
00124          "buffer : string - String buffer containing the state information",
00125          char const *buffer = script->obj_to_str(script->get_bias_cmd_arg(0, objc, objv));
00126          return this_bias->read_state_string(buffer);
00127          )
00128 
00129 CVSCRIPT(bias_save,
00130          "Save data from this bias into a file with the given prefix",
00131          1, 1,
00132          "prefix : string - Prefix for the state file of this bias",
00133          std::string const prefix =
00134            cvm::state_file_prefix(script->obj_to_str(script->get_bias_cmd_arg(0, objc, objv)));
00135          return this_bias->write_state_prefix(prefix);
00136          )
00137 
00138 CVSCRIPT(bias_savetostring,
00139          "Save data from this bias into a string and return it\n"
00140          "state : string - The bias state",
00141          0, 0,
00142          "",
00143          return this_bias->write_state_string(script->modify_str_result());
00144          )
00145 
00146 CVSCRIPT(bias_set,
00147          "Set the given feature of this bias to a new value",
00148          2, 2,
00149          "feature : string - Name of the feature\n"
00150          "value : string - String representation of the new feature value",
00151          return script->proc_features(this_bias, objc, objv);
00152          )
00153 
00154 CVSCRIPT(bias_share,
00155          "Share bias information with other replicas (multiple-walker scheme)",
00156          0, 0,
00157          "",
00158          if (this_bias->replica_share() != COLVARS_OK) {
00159            script->add_error_msg("Error: calling replica_share() for bias " +
00160                                  this_bias->name);
00161            return COLVARSCRIPT_ERROR;
00162          }
00163          return COLVARS_OK;
00164          )
00165 
00166 CVSCRIPT(bias_state,
00167          "Print a string representation of the feature state of this bias\n"
00168          "state : string - String representation of the bias features",
00169          0, 0,
00170          "",
00171          this_bias->print_state();
00172          return COLVARS_OK;
00173          )
00174 
00175 CVSCRIPT(bias_type,
00176          "Print the type of this bias object\n"
00177          "type : string - Type of this bias object (e.g. metadynamics)",
00178          0, 0,
00179          "",
00180          script->set_result_str(this_bias->bias_type);
00181          return COLVARS_OK;
00182          )
00183 
00184 CVSCRIPT(bias_update,
00185          "Recompute this bias and return its up-to-date energy\n"
00186          "E : float - Energy value",
00187          0, 0,
00188          "",
00189          this_bias->update();
00190          script->set_result_colvarvalue(this_bias->get_energy());
00191          return COLVARS_OK;
00192          )

Generated on Fri Oct 11 02:43:28 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002