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 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_group *ag, cvm::real *value, cvm::real *atom_field) override |
template<class T > | |
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. More... | |
template<class T , int flags> | |
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. 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) |
Additional Inherited Members | |
![]() | |
int | step |
int | globalMasterStep |
int | old_num_groups_requested |
Communication between colvars and NAMD (implementation of colvarproxy)
Definition at line 37 of file colvarproxy_namd.h.
colvarproxy_namd::colvarproxy_namd | ( | ) |
Definition at line 47 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, SimParameters::globalMasterFrequency, init_atoms_map(), iout, StringList::next, Node::Object(), ReductionMgr::Object(), SimParameters::outputFilename, random, SimParameters::randomSeed, PatchData::reduction, GlobalMaster::reduction, REDUCTIONS_BASIC, GlobalMaster::requestTotalForce(), SimParameters::restartFilename, SimParameters::restartFrequency, setup(), Node::simParameters, simparams, update_target_temperature(), and ReductionMgr::willSubmit().
colvarproxy_namd::~colvarproxy_namd | ( | ) |
|
inlineoverride |
Definition at line 120 of file colvarproxy_namd.h.
References accelMDOn.
|
override |
Definition at line 665 of file colvarproxy_namd.C.
References GlobalMaster::addReductionEnergy(), SimParameters::CUDASOAintegrate, SubmitReduction::item(), GlobalMaster::reduction, REDUCTION_MISC_ENERGY, and simparams.
|
override |
Definition at line 1189 of file colvarproxy_namd.C.
References NAMD_backup_file().
Referenced by output_stream().
|
virtual |
Reimplemented from GlobalMaster.
Definition at line 347 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::reduction, GlobalMaster::requestedGridObjs(), GlobalMaster::requestedGroups(), ResizeArray< Elem >::resize(), SimParameters::restartFilename, SimParameters::restartFrequency, Vector::set(), ResizeArray< Elem >::setall(), setup(), simparams, Node::state, GlobalMaster::step, SubmitReduction::submit(), update_accelMD_info(), update_atoms_map(), Vector::x, Vector::y, and Vector::z.
|
override |
Definition at line 726 of file colvarproxy_namd.C.
References debug, Node::molecule, Molecule::numAtoms, and Node::Object().
Referenced by init_atom().
|
override |
Definition at line 779 of file colvarproxy_namd.C.
References Molecule::get_atom_from_name(), Node::molecule, and Node::Object().
|
override |
Definition at line 745 of file colvarproxy_namd.C.
|
override |
Definition at line 1612 of file colvarproxy_namd.C.
|
override |
Definition at line 1388 of file colvarproxy_namd.C.
References Node::molecule, Molecule::numGridforceGrids, and Node::Object().
Referenced by init_volmap_by_id().
|
override |
Definition at line 1400 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 1319 of file colvarproxy_namd.C.
|
override |
Definition at line 841 of file colvarproxy_namd.C.
|
override |
Definition at line 1272 of file colvarproxy_namd.C.
|
override |
Definition at line 1415 of file colvarproxy_namd.C.
|
override |
Definition at line 1155 of file colvarproxy_namd.C.
|
override |
Definition at line 1172 of file colvarproxy_namd.C.
|
override |
Definition at line 1485 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 705 of file colvarproxy_namd.C.
References log(), NAMD_die(), and NAMD_err().
Referenced by colvarproxy_namd().
|
override |
Definition at line 1123 of file colvarproxy_namd.C.
|
override |
Definition at line 1139 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 1679 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 1700 of file colvarproxy_namd.C.
References controller, and Controller::getTIderivative().
|
override |
Definition at line 1422 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_group * | ag, | ||
cvm::real * | value, | ||
cvm::real * | atom_field | ||
) |
Abstraction of the two types of NAMD volumetric maps.
Definition at line 1470 of file colvarproxy_namd.C.
void colvarproxy_namd::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.
Definition at line 1435 of file colvarproxy_namd.C.
References Vector::x, Vector::y, and Vector::z.
|
override |
Definition at line 751 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 812 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 1200 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 193 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 1325 of file colvarproxy_namd.C.
References ResizeArray< Elem >::add(), check_volmap_by_id(), and GlobalMaster::modifyRequestedGridObjects().
|
override |
Definition at line 1346 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 1037 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 926 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 695 of file colvarproxy_namd.C.
Referenced by calculate(), error(), setup(), and update_atom_properties().
|
override |
Definition at line 1626 of file colvarproxy_namd.C.
|
override |
Definition at line 1094 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 864 of file colvarproxy_namd.C.
References Lattice::delta(), GlobalMaster::lattice, Vector::x, Vector::y, and Vector::z.
|
inlineoverride |
|
override |
|
override |
Definition at line 1636 of file colvarproxy_namd.C.
References DataMessage::data, replica_recv(), and DataMessage::size.
|
override |
Definition at line 1652 of file colvarproxy_namd.C.
References replica_send().
|
override |
Definition at line 1621 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 1660 of file colvarproxy_namd.C.
References SimParameters::alchOn, SimParameters::alchThermIntOn, SimParameters::computeEnergies, and simparams.
|
override |
Definition at line 682 of file colvarproxy_namd.C.
References debug, and GlobalMaster::requestTotalForce().
|
override |
Definition at line 315 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 647 of file colvarproxy_namd.C.
|
override |
Definition at line 655 of file colvarproxy_namd.C.
|
override |
Definition at line 642 of file colvarproxy_namd.C.
|
inlineoverride |
Definition at line 211 of file colvarproxy_namd.h.
int colvarproxy_namd::send_alch_lambda | ( | void | ) |
Set value of alchemical lambda parameter in back-end.
Definition at line 1686 of file colvarproxy_namd.C.
References SimParameters::alchLambda, SimParameters::alchLambdaFreq, and simparams.
|
override |
Definition at line 1306 of file colvarproxy_namd.C.
|
override |
Definition at line 236 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 98 of file colvarproxy_namd.h.
|
protected |
Definition at line 624 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 848 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 200 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 1279 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 170 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().
|
protected |
Used to submit restraint energy as MISC.
Accelerated MD reweighting factor
Definition at line 66 of file colvarproxy_namd.h.
Referenced by accelMD_enabled(), calculate(), and colvarproxy_namd().
|
protected |
Definition at line 67 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 43 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 49 of file colvarproxy_namd.h.
Referenced by calculate(), get_dE_dlambda(), and update_accelMD_info().
|
protected |
Definition at line 54 of file colvarproxy_namd.h.
Referenced by calculate(), and colvarproxy_namd().
|
protected |
Definition at line 55 of file colvarproxy_namd.h.
Referenced by calculate().
|
protected |
NAMD-style PRNG object.
Definition at line 52 of file colvarproxy_namd.h.
Referenced by colvarproxy_namd(), and rand_gaussian().
|
protected |
Pointer to the NAMD simulation input object.
Definition at line 46 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().