NAMD
|
Communication between colvars and NAMD (implementation of colvarproxy) More...
#include <colvarproxy_namd.h>
Public Member Functions | |
void | init_tcl_pointers () override |
colvarproxy_namd () | |
~colvarproxy_namd () | |
int | setup () override |
int | reset () override |
int | update_target_temperature () |
Get the target temperature from the NAMD thermostats supported so far. More... | |
void | init_atoms_map () |
Allocate an atoms map with the same size as the NAMD topology. More... | |
int | update_atoms_map (AtomIDList::const_iterator begin, AtomIDList::const_iterator end) |
void | calculate () |
void | log (std::string const &message) override |
void | error (std::string const &message) override |
int | set_unit_system (std::string const &units_in, bool check_only) override |
void | add_energy (cvm::real energy) override |
void | request_total_force (bool yesno) override |
bool | total_forces_enabled () const override |
int | run_force_callback () override |
int | run_colvar_callback (std::string const &name, std::vector< const colvarvalue *> const &cvcs, colvarvalue &value) override |
int | run_colvar_gradient_callback (std::string const &name, std::vector< const colvarvalue *> const &cvcs, std::vector< cvm::matrix2d< cvm::real > > &gradient) override |
cvm::real | rand_gaussian () override |
cvm::real | get_accelMD_factor () const override |
bool | accelMD_enabled () const override |
int | check_replicas_enabled () override |
int | replica_index () override |
int | num_replicas () override |
void | replica_comm_barrier () override |
int | replica_comm_recv (char *msg_data, int buf_len, int src_rep) override |
int | replica_comm_send (char *msg_data, int msg_len, int dest_rep) override |
int | check_atom_name_selections_available () override |
int | init_atom (int atom_number) override |
int | check_atom_id (int atom_number) override |
int | init_atom (cvm::residue_id const &residue, std::string const &atom_name, std::string const &segment_id) override |
int | check_atom_id (cvm::residue_id const &residue, std::string const &atom_name, std::string const &segment_id) override |
void | clear_atom (int index) override |
void | update_atom_properties (int index) |
cvm::rvector | position_distance (cvm::atom_pos const &pos1, cvm::atom_pos const &pos2) const |
int | load_atoms_pdb (char const *filename, cvm::atom_group &atoms, std::string const &pdb_field, double const pdb_field_value) override |
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 |
int | scalable_group_coms () override |
int | init_atom_group (std::vector< int > const &atoms_ids) override |
void | clear_atom_group (int index) override |
int | update_group_properties (int index) |
int | check_volmaps_available () override |
int | init_volmap_by_id (int volmap_id) override |
int | init_volmap_by_name (const char *volmap_name) override |
int | check_volmap_by_id (int volmap_id) override |
int | check_volmap_by_name (char const *volmap_name) override |
int | get_volmap_id_from_name (char const *volmap_name) override |
void | clear_volmap (int index) override |
int | compute_volmap (int flags, int volmap_id, cvm::atom_iter atom_begin, cvm::atom_iter atom_end, cvm::real *value, cvm::real *atom_field) override |
template<class T > | |
void | getGridForceGridValue (int flags, T const *grid, cvm::atom_iter atom_begin, cvm::atom_iter atom_end, cvm::real *value, cvm::real *atom_field) |
Abstraction of the two types of NAMD volumetric maps. More... | |
template<class T , int flags> | |
void | GridForceGridLoop (T const *g, cvm::atom_iter atom_begin, cvm::atom_iter atom_end, cvm::real *value, cvm::real *atom_field) |
Implementation of inner loop; allows for atom list computation and use. More... | |
std::ostream & | output_stream (std::string const &output_name, std::string const description) override |
int | flush_output_stream (std::string const &output_name) override |
int | flush_output_streams () override |
int | close_output_stream (std::string const &output_name) override |
int | close_output_streams () override |
int | backup_file (char const *filename) override |
int | get_alch_lambda (cvm::real *lambda) |
Get value of alchemical lambda parameter from back-end. More... | |
int | send_alch_lambda (void) |
Set value of alchemical lambda parameter in back-end. More... | |
int | request_alch_energy_freq (int const freq) |
Request energy computation every freq steps. More... | |
int | get_dE_dlambda (cvm::real *dE_dlambda) |
Get energy derivative with respect to lambda. More... | |
![]() | |
void | processData (AtomIDList::iterator a_i, AtomIDList::iterator a_e, PositionList::iterator p_i, PositionList::iterator g_i, PositionList::iterator g_e, BigRealList::iterator gm_i, BigRealList::iterator gm_e, ForceList::iterator gtf_i, ForceList::iterator gtf_e, IntList::iterator goi_i, IntList::iterator goi_e, BigRealList::iterator gov_i, BigRealList::iterator gov_e, AtomIDList::iterator last_atoms_forced_i, AtomIDList::iterator last_atoms_forced_e, ForceList::iterator last_forces_i, AtomIDList::iterator, AtomIDList::iterator, ForceList::iterator) |
bool | changedAtoms () |
const AtomIDList & | requestedAtoms () |
bool | changedForces () |
const AtomIDList & | forcedAtoms () |
const ForceList & | appliedForces () |
bool | changedGroups () |
const ResizeArray< AtomIDList > & | requestedGroups () |
const ForceList & | groupForces () |
bool | changedGridObjs () |
const IntList & | requestedGridObjs () |
const BigRealList & | gridObjForces () |
bool | requestedTotalForces () |
void | clearChanged () |
virtual | ~GlobalMaster () |
void | check () const |
void | setLattice (const Lattice *lat) |
Friends | |
class | cvm::atom |
Additional Inherited Members | |
![]() | |
int | step |
int | globalMasterStep |
int | old_num_groups_requested |
Communication between colvars and NAMD (implementation of colvarproxy)
Definition at line 39 of file colvarproxy_namd.h.
colvarproxy_namd::colvarproxy_namd | ( | ) |
Definition at line 46 of file colvarproxy_namd.C.
References accelMDOn, SimParameters::accelMDOn, amd_weight_factor, COLVARPROXY_VERSION, Node::colvars, Node::configList, StringList::data, debug, SimParameters::dt, endi(), error(), ConfigList::find(), first_timestep, SimParameters::firstTimestep, GLOBAL_MASTER_CKLOOP_CALC_BIASES, GLOBAL_MASTER_CKLOOP_CALC_ITEM, GLOBAL_MASTER_CKLOOP_CALC_SCRIPTED_BIASES, init_atoms_map(), iout, StringList::next, Node::Object(), ReductionMgr::Object(), SimParameters::outputFilename, random, SimParameters::randomSeed, PatchData::reduction, REDUCTIONS_BASIC, GlobalMaster::requestTotalForce(), SimParameters::restartFilename, SimParameters::restartFrequency, setup(), Node::simParameters, simparams, update_target_temperature(), and ReductionMgr::willSubmit().
colvarproxy_namd::~colvarproxy_namd | ( | ) |
Definition at line 157 of file colvarproxy_namd.C.
|
inlineoverride |
Definition at line 124 of file colvarproxy_namd.h.
References accelMDOn.
|
override |
Definition at line 663 of file colvarproxy_namd.C.
References GlobalMaster::addReductionEnergy(), SimParameters::CUDASOAintegrate, REDUCTION_MISC_ENERGY, and simparams.
|
override |
Definition at line 1188 of file colvarproxy_namd.C.
References NAMD_backup_file().
Referenced by output_stream().
|
virtual |
Reimplemented from GlobalMaster.
Definition at line 345 of file colvarproxy_namd.C.
References Lattice::a(), Lattice::a_p(), accelMDOn, ResizeArray< Elem >::add(), atoms_map, Lattice::b(), Lattice::b_p(), ResizeArray< Elem >::begin(), Lattice::c(), Lattice::c_p(), ResizeArray< Elem >::clear(), controller, SimParameters::CUDASOAintegrate, debug, ResizeArray< Elem >::end(), first_timestep, GlobalMaster::getAtomIdBegin(), GlobalMaster::getAtomIdEnd(), GlobalMaster::getAtomPositionBegin(), NamdState::getController(), GlobalMaster::getForceIdBegin(), GlobalMaster::getForceIdEnd(), GlobalMaster::getGridObjIndexBegin(), GlobalMaster::getGridObjIndexEnd(), GlobalMaster::getGridObjValueBegin(), GlobalMaster::getGridObjValueEnd(), GlobalMaster::getGroupPositionBegin(), GlobalMaster::getGroupPositionEnd(), GlobalMaster::getGroupTotalForceBegin(), GlobalMaster::getGroupTotalForceEnd(), GlobalMaster::getTotalForce(), GlobalMaster::lattice, log(), GlobalMaster::modifyAppliedForces(), GlobalMaster::modifyForcedAtoms(), GlobalMaster::modifyGridObjForces(), GlobalMaster::modifyGroupForces(), Node::molecule, SimParameters::N, Molecule::numAtoms, Node::Object(), Lattice::orthogonal(), SimParameters::outputFilename, previous_NAMD_step, GlobalMaster::requestedGridObjs(), GlobalMaster::requestedGroups(), ResizeArray< Elem >::resize(), SimParameters::restartFilename, SimParameters::restartFrequency, Vector::set(), ResizeArray< Elem >::setall(), setup(), simparams, Node::state, GlobalMaster::step, update_accelMD_info(), update_atoms_map(), Vector::x, Vector::y, and Vector::z.
|
override |
Definition at line 724 of file colvarproxy_namd.C.
References debug, Node::molecule, Molecule::numAtoms, and Node::Object().
Referenced by init_atom().
|
override |
Definition at line 777 of file colvarproxy_namd.C.
References Molecule::get_atom_from_name(), Node::molecule, and Node::Object().
|
override |
Definition at line 743 of file colvarproxy_namd.C.
|
override |
Definition at line 1614 of file colvarproxy_namd.C.
|
override |
Definition at line 1387 of file colvarproxy_namd.C.
References Node::molecule, Molecule::numGridforceGrids, and Node::Object().
Referenced by init_volmap_by_id().
|
override |
Definition at line 1399 of file colvarproxy_namd.C.
References MGridforceParamsList::index_for_key(), SimParameters::mgridforcelist, and simparams.
Referenced by get_volmap_id_from_name(), and init_volmap_by_name().
|
override |
Definition at line 1318 of file colvarproxy_namd.C.
|
override |
Definition at line 839 of file colvarproxy_namd.C.
|
override |
Definition at line 1271 of file colvarproxy_namd.C.
|
override |
Definition at line 1414 of file colvarproxy_namd.C.
|
override |
Definition at line 1154 of file colvarproxy_namd.C.
|
override |
Definition at line 1171 of file colvarproxy_namd.C.
|
override |
Definition at line 1486 of file colvarproxy_namd.C.
References GridforceGrid::get_grid_type(), Molecule::get_gridfrc_grid(), GridforceGrid::GridforceGridTypeFull, GridforceGrid::GridforceGridTypeLite, Node::molecule, and Node::Object().
|
override |
Definition at line 703 of file colvarproxy_namd.C.
References log(), NAMD_die(), and NAMD_err().
Referenced by colvarproxy_namd().
|
override |
Definition at line 1122 of file colvarproxy_namd.C.
|
override |
Definition at line 1138 of file colvarproxy_namd.C.
|
inlineoverride |
int colvarproxy_namd::get_alch_lambda | ( | cvm::real * | lambda | ) |
Get value of alchemical lambda parameter from back-end.
Definition at line 1681 of file colvarproxy_namd.C.
References SimParameters::getCurrentLambda(), simparams, and GlobalMaster::step.
int colvarproxy_namd::get_dE_dlambda | ( | cvm::real * | dE_dlambda | ) |
Get energy derivative with respect to lambda.
Definition at line 1702 of file colvarproxy_namd.C.
References controller, and Controller::getTIderivative().
|
override |
Definition at line 1421 of file colvarproxy_namd.C.
References check_volmap_by_name(), MGridforceParamsList::index_for_key(), SimParameters::mgridforcelist, and simparams.
void colvarproxy_namd::getGridForceGridValue | ( | int | flags, |
T const * | grid, | ||
cvm::atom_iter | atom_begin, | ||
cvm::atom_iter | atom_end, | ||
cvm::real * | value, | ||
cvm::real * | atom_field | ||
) |
Abstraction of the two types of NAMD volumetric maps.
Definition at line 1467 of file colvarproxy_namd.C.
void colvarproxy_namd::GridForceGridLoop | ( | T const * | g, |
cvm::atom_iter | atom_begin, | ||
cvm::atom_iter | atom_end, | ||
cvm::real * | value, | ||
cvm::real * | atom_field | ||
) |
Implementation of inner loop; allows for atom list computation and use.
Definition at line 1434 of file colvarproxy_namd.C.
References Vector::x, Vector::y, and Vector::z.
|
override |
Definition at line 749 of file colvarproxy_namd.C.
References ResizeArray< Elem >::add(), atoms_map, check_atom_id(), GlobalMaster::modifyRequestedAtoms(), and update_atom_properties().
|
override |
For AMBER topologies, the segment id is automatically set to "MAIN" (the segment id assigned by NAMD's AMBER topology parser), and is therefore optional when an AMBER topology is used
Definition at line 810 of file colvarproxy_namd.C.
References ResizeArray< Elem >::add(), atoms_map, check_atom_id(), debug, GlobalMaster::modifyRequestedAtoms(), and update_atom_properties().
|
override |
Definition at line 1199 of file colvarproxy_namd.C.
References debug, GlobalMaster::modifyGroupForces(), GlobalMaster::modifyRequestedGroups(), Node::molecule, Molecule::numAtoms, Node::Object(), ResizeArray< Elem >::resize(), ResizeArray< Elem >::size(), and update_group_properties().
void colvarproxy_namd::init_atoms_map | ( | ) |
Allocate an atoms map with the same size as the NAMD topology.
Definition at line 191 of file colvarproxy_namd.C.
References atoms_map, Node::molecule, Molecule::numAtoms, and Node::Object().
Referenced by colvarproxy_namd(), and update_atoms_map().
|
override |
|
override |
Definition at line 1324 of file colvarproxy_namd.C.
References ResizeArray< Elem >::add(), check_volmap_by_id(), and GlobalMaster::modifyRequestedGridObjects().
|
override |
Definition at line 1345 of file colvarproxy_namd.C.
References ResizeArray< Elem >::add(), check_volmap_by_name(), Molecule::get_gridfrc_grid(), GridforceGrid::get_scale(), MGridforceParamsList::index_for_key(), SimParameters::mgridforcelist, GlobalMaster::modifyRequestedGridObjects(), Node::molecule, Node::Object(), simparams, Vector::x, Vector::y, and Vector::z.
|
override |
Definition at line 1036 of file colvarproxy_namd.C.
References PDB::atom(), cvm::atom, e_pdb_beta, e_pdb_occ, e_pdb_x, e_pdb_y, e_pdb_z, PDB::num_atoms(), and pdb_field_str2enum().
|
override |
Definition at line 924 of file colvarproxy_namd.C.
References PDB::atom(), e_pdb_beta, e_pdb_occ, e_pdb_x, e_pdb_y, e_pdb_z, PDB::num_atoms(), and pdb_field_str2enum().
|
override |
Definition at line 693 of file colvarproxy_namd.C.
Referenced by calculate(), error(), setup(), and update_atom_properties().
|
override |
Definition at line 1628 of file colvarproxy_namd.C.
|
override |
Definition at line 1093 of file colvarproxy_namd.C.
References backup_file(), and debug.
cvm::rvector colvarproxy_namd::position_distance | ( | cvm::atom_pos const & | pos1, |
cvm::atom_pos const & | pos2 | ||
) | const |
Definition at line 862 of file colvarproxy_namd.C.
References Lattice::delta(), GlobalMaster::lattice, Vector::x, Vector::y, and Vector::z.
|
inlineoverride |
|
override |
|
override |
Definition at line 1638 of file colvarproxy_namd.C.
References DataMessage::data, replica_recv(), and DataMessage::size.
|
override |
Definition at line 1654 of file colvarproxy_namd.C.
References replica_send().
|
override |
Definition at line 1623 of file colvarproxy_namd.C.
int colvarproxy_namd::request_alch_energy_freq | ( | int const | freq | ) |
Request energy computation every freq steps.
Request alchemical energy computation every freq steps.
Definition at line 1662 of file colvarproxy_namd.C.
References SimParameters::alchOn, SimParameters::alchThermIntOn, SimParameters::computeEnergies, and simparams.
|
override |
Definition at line 680 of file colvarproxy_namd.C.
References debug, and GlobalMaster::requestTotalForce().
|
override |
Definition at line 313 of file colvarproxy_namd.C.
References atoms_map, ResizeArray< Elem >::clear(), debug, GlobalMaster::modifyAppliedForces(), GlobalMaster::modifyForcedAtoms(), GlobalMaster::modifyGridObjForces(), GlobalMaster::modifyGroupForces(), GlobalMaster::modifyRequestedAtoms(), GlobalMaster::modifyRequestedGridObjects(), GlobalMaster::modifyRequestedGroups(), and GlobalMaster::requestTotalForce().
|
override |
Definition at line 645 of file colvarproxy_namd.C.
|
override |
Definition at line 653 of file colvarproxy_namd.C.
|
override |
Definition at line 640 of file colvarproxy_namd.C.
|
inlineoverride |
Definition at line 215 of file colvarproxy_namd.h.
int colvarproxy_namd::send_alch_lambda | ( | void | ) |
Set value of alchemical lambda parameter in back-end.
Definition at line 1688 of file colvarproxy_namd.C.
References SimParameters::alchLambda, SimParameters::alchLambdaFreq, and simparams.
|
override |
Definition at line 1305 of file colvarproxy_namd.C.
|
override |
Definition at line 234 of file colvarproxy_namd.C.
References SimParameters::dt, log(), GlobalMaster::modifyGridObjForces(), GlobalMaster::modifyRequestedGroups(), simparams, ResizeArray< Elem >::size(), update_atom_properties(), update_group_properties(), update_target_temperature(), and SimParameters::wrapAll.
Referenced by calculate(), and colvarproxy_namd().
|
inlineoverride |
Definition at line 102 of file colvarproxy_namd.h.
|
protected |
Definition at line 622 of file colvarproxy_namd.C.
References Controller::accelMDdV, amd_weight_factor, and controller.
Referenced by calculate().
void colvarproxy_namd::update_atom_properties | ( | int | index | ) |
Definition at line 846 of file colvarproxy_namd.C.
References Molecule::atomcharge(), Molecule::atommass(), log(), Node::molecule, and Node::Object().
Referenced by init_atom(), setup(), and update_atoms_map().
int colvarproxy_namd::update_atoms_map | ( | AtomIDList::const_iterator | begin, |
AtomIDList::const_iterator | end | ||
) |
Definition at line 198 of file colvarproxy_namd.C.
References ResizeArray< Elem >::add(), atoms_map, debug, init_atoms_map(), GlobalMaster::modifyRequestedAtoms(), Node::molecule, Molecule::numAtoms, Node::Object(), and update_atom_properties().
Referenced by calculate().
int colvarproxy_namd::update_group_properties | ( | int | index | ) |
Definition at line 1278 of file colvarproxy_namd.C.
References Molecule::atomcharge(), Molecule::atommass(), debug, GlobalMaster::modifyRequestedGroups(), Node::molecule, Node::Object(), and ResizeArray< Elem >::size().
Referenced by init_atom_group(), and setup().
int colvarproxy_namd::update_target_temperature | ( | ) |
Get the target temperature from the NAMD thermostats supported so far.
Definition at line 168 of file colvarproxy_namd.C.
References SimParameters::langevinOn, SimParameters::langevinTemp, SimParameters::loweAndersenOn, SimParameters::loweAndersenTemp, SimParameters::reassignFreq, SimParameters::reassignTemp, SimParameters::rescaleFreq, SimParameters::rescaleTemp, simparams, SimParameters::stochRescaleOn, SimParameters::stochRescaleTemp, SimParameters::tCoupleOn, and SimParameters::tCoupleTemp.
Referenced by colvarproxy_namd(), and setup().
|
friend |
Definition at line 76 of file colvarproxy_namd.h.
Referenced by load_atoms_pdb().
|
protected |
Used to submit restraint energy as MISC.
Accelerated MD reweighting factor
Definition at line 68 of file colvarproxy_namd.h.
Referenced by accelMD_enabled(), calculate(), and colvarproxy_namd().
|
protected |
Definition at line 69 of file colvarproxy_namd.h.
Referenced by colvarproxy_namd(), get_accelMD_factor(), and update_accelMD_info().
|
protected |
Array of atom indices (relative to the colvarproxy arrays), usedfor faster copy of atomic data.
Definition at line 45 of file colvarproxy_namd.h.
Referenced by calculate(), init_atom(), init_atoms_map(), reset(), and update_atoms_map().
|
protected |
Pointer to Controller object.
Definition at line 51 of file colvarproxy_namd.h.
Referenced by calculate(), get_dE_dlambda(), and update_accelMD_info().
|
protected |
Definition at line 56 of file colvarproxy_namd.h.
Referenced by calculate(), and colvarproxy_namd().
|
protected |
Definition at line 57 of file colvarproxy_namd.h.
Referenced by calculate().
|
protected |
NAMD-style PRNG object.
Definition at line 54 of file colvarproxy_namd.h.
Referenced by colvarproxy_namd(), and rand_gaussian().
|
protected |
Pointer to the NAMD simulation input object.
Definition at line 48 of file colvarproxy_namd.h.
Referenced by add_energy(), calculate(), check_volmap_by_name(), colvarproxy_namd(), get_alch_lambda(), get_volmap_id_from_name(), init_volmap_by_name(), request_alch_energy_freq(), send_alch_lambda(), setup(), and update_target_temperature().