10 #ifndef COLVARPROXY_NAMD_H 11 #define COLVARPROXY_NAMD_H 13 #ifndef NAMD_VERSION_NUMBER 15 #define NAMD_VERSION_NUMBER 34471681 27 #include "colvarmodule.h" 28 #include "colvarproxy.h" 29 #include "colvarvalue.h" 31 #define GLOBAL_MASTER_CKLOOP_CALC_ITEM 2000 32 #define GLOBAL_MASTER_CKLOOP_CALC_BIASES 2001 33 #define GLOBAL_MASTER_CKLOOP_CALC_SCRIPTED_BIASES 2002 58 #if !defined (NAMD_UNIFIED_REDUCTION) 61 #if defined(NODEGROUP_FORCE_REGISTER) && !defined(NAMD_UNIFIED_REDUCTION) 92 void log(std::string
const &message)
override;
93 void error(std::string
const &message)
override;
94 int set_unit_system(std::string
const &units_in,
bool check_only)
override;
100 return total_force_requested;
105 std::vector<const colvarvalue *>
const &cvcs,
106 colvarvalue &value)
override;
108 std::vector<const colvarvalue *>
const &cvcs,
109 std::vector<cvm::matrix2d<cvm::real> > &gradient)
override;
124 #if CMK_SMP && USE_CKLOOP 125 colvarproxy::smp_mode_t get_smp_mode()
const override;
127 int set_smp_mode(smp_mode_t mode)
override;
129 int smp_loop(
int n_items, std::function<
int (
int)>
const &worker)
override;
131 int smp_biases_loop()
override;
133 int smp_biases_script_loop()
override;
135 friend void calc_colvars_items_smp(
int first,
int last,
void *result,
int paramNum,
void *param);
136 friend void calc_cv_biases_smp(
int first,
int last,
void *result,
int paramNum,
void *param);
137 friend void calc_cv_scripted_forces(
int paramNum,
void *param);
144 int smp_num_threads()
146 return CkMyNodeSize();
151 CmiNodeLock charm_lock_state;
157 CmiLock(charm_lock_state);
163 const int ret = CmiTryLock(charm_lock_state);
164 if (ret == 0)
return COLVARS_OK;
165 else return COLVARS_ERROR;
170 CmiUnlock(charm_lock_state);
174 #endif // #if CMK_SMP && USE_CKLOOP 186 int init_atom(cvm::residue_id
const &residue,
187 std::string
const &atom_name,
188 std::string
const &segment_id)
override;
190 std::string
const &atom_name,
191 std::string
const &segment_id)
override;
197 cvm::atom_pos
const &pos2)
const;
200 cvm::atom_group &atoms,
201 std::string
const &pdb_field,
202 double pdb_field_value)
override;
205 std::vector<cvm::atom_pos> &pos,
206 const std::vector<int> &indices,
207 std::string
const &pdb_field,
208 double const pdb_field_value)
override;
220 #if NAMD_VERSION_NUMBER >= 34471681 240 cvm::real *atom_field)
override;
248 cvm::real *atom_field);
251 template<
class T,
int flags>
255 cvm::real *atom_field);
260 std::string
const description)
override;
int check_volmaps_available() override
std::ostream & output_stream(std::string const &output_name, std::string const description) override
void clear_atom_group(int index) override
int get_volmap_id_from_name(char const *volmap_name) override
void clear_volmap(int index) override
SimParameters * simparams
Pointer to the NAMD simulation input object.
Random random
NAMD-style PRNG object.
int init_atom_group(std::vector< int > const &atoms_ids) override
int set_unit_system(std::string const &units_in, bool check_only) override
void error(std::string const &message) override
void update_accelMD_info()
int replica_comm_send(char *msg_data, int msg_len, int dest_rep) override
int init_atom(int atom_number) override
bool accelMD_enabled() const override
Communication between colvars and NAMD (implementation of colvarproxy)
Controller const * controller
Pointer to Controller object.
int init_volmap_by_id(int volmap_id) override
int check_volmap_by_name(char const *volmap_name) override
void clear_atom(int index) override
cvm::real amd_weight_factor
int get_alch_lambda(cvm::real *lambda)
Get value of alchemical lambda parameter from back-end.
cvm::step_number previous_NAMD_step
cvm::real get_accelMD_factor() const override
int update_target_temperature()
Get the target temperature from the NAMD thermostats supported so far.
int compute_volmap(int flags, int volmap_id, cvm::atom_group *ag, cvm::real *value, cvm::real *atom_field) override
void request_total_force(bool yesno) override
int init_volmap_by_name(const char *volmap_name) override
int check_atom_id(int atom_number) override
int run_colvar_gradient_callback(std::string const &name, std::vector< const colvarvalue *> const &cvcs, std::vector< cvm::matrix2d< cvm::real > > &gradient) override
std::vector< int > atoms_map
Array of atom indices (relative to the colvarproxy arrays), usedfor faster copy of atomic data...
int check_atom_name_selections_available() override
void getGridForceGridValue(int flags, T const *grid, cvm::atom_group *ag, cvm::real *value, cvm::real *atom_field)
Abstraction of the two types of NAMD volumetric maps.
void log(std::string const &message) override
int request_alch_energy_freq(int const freq)
Request energy computation every freq steps.
SubmitReduction * reduction
bool accelMDOn
Used to submit restraint energy as MISC.
const AtomID * const_iterator
int backup_file(char const *filename) override
void init_atoms_map()
Allocate an atoms map with the same size as the NAMD topology.
int flush_output_streams() override
void replica_comm_barrier() override
int send_alch_lambda(void)
Set value of alchemical lambda parameter in back-end.
int check_replicas_enabled() override
int close_output_stream(std::string const &output_name) override
int replica_index() override
bool total_forces_enabled() const override
int update_group_properties(int index)
int load_atoms_pdb(char const *filename, cvm::atom_group &atoms, std::string const &pdb_field, double pdb_field_value) override
int flush_output_stream(std::string const &output_name) override
void init_tcl_pointers() override
void update_atom_properties(int index)
cvm::rvector position_distance(cvm::atom_pos const &pos1, cvm::atom_pos const &pos2) const
int check_volmap_by_id(int volmap_id) override
void add_energy(cvm::real energy) override
int get_dE_dlambda(cvm::real *dE_dlambda)
Get energy derivative with respect to lambda.
int close_output_streams() override
int scalable_group_coms() override
int run_colvar_callback(std::string const &name, std::vector< const colvarvalue *> const &cvcs, colvarvalue &value) override
int num_replicas() override
int run_force_callback() override
int replica_comm_recv(char *msg_data, int buf_len, int src_rep) override
int update_atoms_map(AtomIDList::const_iterator begin, AtomIDList::const_iterator end)
int load_coords_pdb(char const *filename, std::vector< cvm::atom_pos > &pos, const std::vector< int > &indices, std::string const &pdb_field, double const pdb_field_value) override
void GridForceGridLoop(T const *g, cvm::atom_group *ag, cvm::real *value, cvm::real *atom_field)
Implementation of inner loop; allows for atom list computation and use.
cvm::real rand_gaussian() override