| version 1.25 | version 1.26 |
|---|
| |
| // -*- c++ -*- | // -*- c++ -*- |
| | |
| | // This file is part of the Collective Variables module (Colvars). |
| | // The original version of Colvars and its updates are located at: |
| | // https://github.com/colvars/colvars |
| | // Please update all Colvars source files before making any changes. |
| | // If you wish to distribute your changes, please submit them to the |
| | // Colvars repository at GitHub. |
| | |
| #ifndef COLVARMODULE_H | #ifndef COLVARMODULE_H |
| #define COLVARMODULE_H | #define COLVARMODULE_H |
| | |
| #ifndef COLVARS_VERSION | #ifndef COLVARS_VERSION |
| #define COLVARS_VERSION "2016-11-28-namd-2-12" | #define COLVARS_VERSION "2017-02-06" |
| #endif | #endif |
| | |
| #ifndef COLVARS_DEBUG | #ifndef COLVARS_DEBUG |
| |
| /// dt) | /// dt) |
| static real debug_gradients_step_size; | static real debug_gradients_step_size; |
| | |
| | private: |
| | |
| /// Prefix for all output files for this run | /// Prefix for all output files for this run |
| static std::string output_prefix; | std::string cvm_output_prefix; |
| | |
| | public: |
| | /// Accessor for the above |
| | static inline std::string &output_prefix() |
| | { |
| | colvarmodule *cv = colvarmodule::main(); |
| | return cv->cvm_output_prefix; |
| | } |
| | |
| | private: |
| | |
| | /// Array of collective variables |
| | std::vector<colvar *> colvars; |
| | |
| /// Array of collective variables | /// Array of collective variables |
| static std::vector<colvar *> colvars; | std::vector<colvar *> colvars_active; |
| | |
| | /// Collective variables to be calculated on different threads; |
| | /// colvars with multple items (e.g. multiple active CVCs) are duplicated |
| | std::vector<colvar *> colvars_smp; |
| | /// Indexes of the items to calculate for each colvar |
| | std::vector<int> colvars_smp_items; |
| | |
| | public: |
| | |
| | /// Array of collective variables |
| | std::vector<colvar *> *variables(); |
| | |
| /* TODO: implement named CVCs | /* TODO: implement named CVCs |
| /// Array of named (reusable) collective variable components | /// Array of named (reusable) collective variable components |
| |
| } | } |
| */ | */ |
| | |
| | /// Collective variables with the active flag on |
| | std::vector<colvar *> *variables_active(); |
| | |
| /// Collective variables to be calculated on different threads; | /// Collective variables to be calculated on different threads; |
| /// colvars with multple items (e.g. multiple active CVCs) are duplicated | /// colvars with multple items (e.g. multiple active CVCs) are duplicated |
| std::vector<colvar *> colvars_smp; | std::vector<colvar *> *variables_active_smp(); |
| | |
| /// Indexes of the items to calculate for each colvar | /// Indexes of the items to calculate for each colvar |
| std::vector<int> colvars_smp_items; | std::vector<int> *variables_active_smp_items(); |
| | |
| /// Array of collective variable biases | /// Array of collective variable biases |
| static std::vector<colvarbias *> biases; | std::vector<colvarbias *> biases; |
| /// \brief Number of ABF biases initialized (in normal conditions | |
| /// should be 1) | private: |
| static size_t n_abf_biases; | |
| /// \brief Number of metadynamics biases initialized (in normal | /// Array of active collective variable biases |
| /// conditions should be 1) | std::vector<colvarbias *> biases_active_; |
| static size_t n_meta_biases; | |
| /// \brief Number of restraint biases initialized (no limit on the | public: |
| /// number) | |
| static size_t n_rest_biases; | /// Array of active collective variable biases |
| /// \brief Number of histograms initialized (no limit on the | std::vector<colvarbias *> *biases_active(); |
| /// number) | |
| static size_t n_histo_biases; | |
| | |
| /// \brief Whether debug output should be enabled (compile-time option) | /// \brief Whether debug output should be enabled (compile-time option) |
| static inline bool debug() | static inline bool debug() |
| |
| } | } |
| | |
| /// \brief How many objects are configured yet? | /// \brief How many objects are configured yet? |
| inline size_t size() const | size_t size() const; |
| { | |
| return colvars.size() + biases.size(); | |
| } | |
| | |
| /// \brief Constructor \param config_name Configuration file name | /// \brief Constructor \param config_name Configuration file name |
| /// \param restart_name (optional) Restart file name | /// \param restart_name (optional) Restart file name |
| |
| /// \brief Parse a "clean" config string (no comments) | /// \brief Parse a "clean" config string (no comments) |
| int parse_config(std::string &conf); | int parse_config(std::string &conf); |
| | |
| | |
| // Parse functions (setup internal data based on a string) | // Parse functions (setup internal data based on a string) |
| | |
| | /// Allow reading from Windows text files using using std::getline |
| | /// (which can still be used when the text is produced by Colvars itself) |
| | static std::istream & getline(std::istream &is, std::string &line); |
| | |
| /// Parse the few module's global parameters | /// Parse the few module's global parameters |
| int parse_global_params(std::string const &conf); | int parse_global_params(std::string const &conf); |
| | |
| |
| /// Parse and initialize collective variable biases | /// Parse and initialize collective variable biases |
| int parse_biases(std::string const &conf); | int parse_biases(std::string const &conf); |
| | |
| | /// \brief Add new configuration during parsing (e.g. to implement |
| | /// back-compatibility); cannot be nested, i.e. conf should not contain |
| | /// anything that triggers another call |
| | int append_new_config(std::string const &conf); |
| | |
| | private: |
| | |
| | /// Auto-generated configuration during parsing (e.g. to implement |
| | /// back-compatibility) |
| | std::string extra_conf; |
| | |
| /// Parse and initialize collective variable biases of a specific type | /// Parse and initialize collective variable biases of a specific type |
| template <class bias_type> | template <class bias_type> |
| int parse_biases_type(std::string const &conf, char const *keyword, size_t &bias_count); | int parse_biases_type(std::string const &conf, char const *keyword); |
| | |
| /// Test error condition and keyword parsing | /// Test error condition and keyword parsing |
| /// on error, delete new bias | /// on error, delete new bias |
| bool check_new_bias(std::string &conf, char const *key); | bool check_new_bias(std::string &conf, char const *key); |
| | |
| | public: |
| | |
| | /// Return how many biases have this feature enabled |
| | static int num_biases_feature(int feature_id); |
| | |
| | /// Return how many biases are defined with this type |
| | static int num_biases_type(std::string const &type); |
| | |
| private: | private: |
| /// Useful wrapper to interrupt parsing if any error occurs | /// Useful wrapper to interrupt parsing if any error occurs |
| int catch_input_errors(int result); | int catch_input_errors(int result); |
| |
| | |
| | |
| /// \brief Names of groups from a Gromacs .ndx file to be read at startup | /// \brief Names of groups from a Gromacs .ndx file to be read at startup |
| static std::list<std::string> index_group_names; | std::list<std::string> index_group_names; |
| | |
| /// \brief Groups from a Gromacs .ndx file read at startup | /// \brief Groups from a Gromacs .ndx file read at startup |
| static std::list<std::vector<int> > index_groups; | std::list<std::vector<int> > index_groups; |
| | |
| /// \brief Read a Gromacs .ndx file | /// \brief Read a Gromacs .ndx file |
| static int read_index_file(char const *filename); | int read_index_file(char const *filename); |
| | |
| | |
| /// \brief Create atoms from a file \param filename name of the file | /// \brief Create atoms from a file \param filename name of the file |
| |
| /// Output restart file | /// Output restart file |
| colvarmodule::ofstream restart_out_os; | colvarmodule::ofstream restart_out_os; |
| | |
| protected: | private: |
| | |
| /// Counter for the current depth in the object hierarchy (useg e.g. in output) | /// Counter for the current depth in the object hierarchy (useg e.g. in output) |
| static size_t depth_s; | size_t depth_s; |
| | |
| /// Thread-specific depth | /// Thread-specific depth |
| static std::vector<size_t> depth_v; | std::vector<size_t> depth_v; |
| | |
| public: | public: |
| | |
| |
| /// from the hosting program; it is static in order to be accessible | /// from the hosting program; it is static in order to be accessible |
| /// from static functions in the colvarmodule class | /// from static functions in the colvarmodule class |
| static colvarproxy *proxy; | static colvarproxy *proxy; |
| | |
| | /// \brief Accessor for the above |
| | static colvarmodule *main(); |
| | |
| }; | }; |
| | |
| | |