#include <colvaratoms.h>
Public Member Functions | |
| atom () | |
| Default constructor, setting id to a non-valid value. | |
| atom (int const &atom_number) | |
| Initialize an atom for collective variable calculation and get its internal identifier. | |
| atom (cvm::residue_id const &residue, std::string const &atom_name, std::string const &segment_id=std::string("")) | |
| Initialize an atom for collective variable calculation and get its internal identifier. | |
| atom (atom const &a) | |
| Copy constructor. | |
| ~atom () | |
| Destructor. | |
| void | reset_data () |
| Set non-constant data (everything except id and mass) to zero. | |
| void | read_position () |
| Get the current position. | |
| void | read_velocity () |
| Get the current velocity. | |
| void | read_system_force () |
| Get the system force. | |
| void | apply_force (cvm::rvector const &new_force) |
| Apply a force to the atom. | |
Public Attributes | |
| int | id |
| Internal identifier (zero-based). | |
| cvm::real | mass |
| Mass. | |
| cvm::atom_pos | pos |
| Current position (copied from the program, can be manipulated). | |
| cvm::rvector | vel |
| Current velocity (copied from the program, can be manipulated). | |
| cvm::rvector | system_force |
| System force at the previous step (copied from the program, can be manipulated). | |
| cvm::rvector | grad |
| Gradient of a scalar collective variable with respect to this atom. | |
Protected Attributes | |
| size_t | index |
| Index in the list of atoms involved by the colvars (NOT in the global topology!). | |
This class may be used (although not necessarily) to keep atomic data (id, mass, position and collective variable derivatives) altogether. There may be multiple instances with identical numeric id, all acting independently: forces communicated through these instances will be summed together.
Read/write operations depend on the underlying code: hence, some member functions are defined in colvarproxy_xxx.h.
Definition at line 18 of file colvaratoms.h.
|
|
Default constructor, setting id to a non-valid value.
Definition at line 59 of file colvaratoms.h. 00059 {}
|
|
|
Initialize an atom for collective variable calculation and get its internal identifier.
Definition at line 505 of file colvarproxy_namd.C. References AtomID, Molecule::atommass(), colvarmodule::debug(), colvarmodule::fatal_error(), index, colvarmodule::log(), mass, Node::molecule, Molecule::numAtoms, Node::Object(), and reset_data(). 00506 {
00507 // NAMD internal numbering starts from zero
00508 AtomID const aid (atom_number-1);
00509
00510 if (cvm::debug())
00511 cvm::log ("Adding atom "+cvm::to_str (aid+1)+
00512 " for collective variables calculation.\n");
00513
00514 if ( (aid < 0) || (aid >= Node::Object()->molecule->numAtoms) )
00515 cvm::fatal_error ("Error: invalid atom number specified, "+
00516 cvm::to_str (atom_number)+"\n");
00517 this->index = ((colvarproxy_namd *) cvm::proxy)->init_namd_atom (aid);
00518 if (cvm::debug())
00519 cvm::log ("The index of this atom in the colvarproxy_namd arrays is "+
00520 cvm::to_str (this->index)+".\n");
00521 this->id = aid;
00522 this->mass = Node::Object()->molecule->atommass (aid);
00523 this->reset_data();
00524 }
|
|
||||||||||||||||
|
Initialize an atom for collective variable calculation and get its internal identifier.
Definition at line 530 of file colvarproxy_namd.C. References AtomID, Molecule::atommass(), colvarmodule::debug(), colvarmodule::fatal_error(), Molecule::get_atom_from_name(), index, colvarmodule::log(), mass, Node::molecule, Node::Object(), and reset_data(). 00533 {
00534 AtomID const aid =
00535 (segment_id.size() ?
00536 Node::Object()->molecule->get_atom_from_name (segment_id.c_str(),
00537 residue,
00538 atom_name.c_str()) :
00539 Node::Object()->molecule->get_atom_from_name ("MAIN",
00540 residue,
00541 atom_name.c_str()));
00542
00543
00544 if (cvm::debug())
00545 cvm::log ("Adding atom \""+
00546 atom_name+"\" in residue "+
00547 cvm::to_str (residue)+
00548 " (index "+cvm::to_str (aid)+
00549 ") for collective variables calculation.\n");
00550
00551 if (aid < 0) {
00552 // get_atom_from_name() has returned an error value
00553 cvm::fatal_error ("Error: could not find atom \""+
00554 atom_name+"\" in residue "+
00555 cvm::to_str (residue)+
00556 ( (segment_id != "MAIN") ?
00557 (", segment \""+segment_id+"\"") :
00558 ("") )+
00559 "\n");
00560 }
00561
00562 this->index = ((colvarproxy_namd *) cvm::proxy)->init_namd_atom (aid);
00563 if (cvm::debug())
00564 cvm::log ("The index of this atom in the colvarproxy_namd arrays is "+
00565 cvm::to_str (this->index)+".\n");
00566 this->id = aid;
00567 this->mass = Node::Object()->molecule->atommass (aid);
00568 this->reset_data();
00569 }
|
|
|
Copy constructor.
Definition at line 573 of file colvarproxy_namd.C. References colvarproxy_namd::colvars_atoms_ncopies. 00574 : index (a.index), id (a.id), mass (a.mass) 00575 { 00576 // init_namd_atom() has already been called by a's constructor, no 00577 // need to call it again 00578 00579 // need to increment the counter anyway 00580 colvarproxy_namd *gm = (colvarproxy_namd *) cvm::proxy; 00581 gm->colvars_atoms_ncopies[this->index] += 1; 00582 }
|
|
|
Destructor.
Definition at line 585 of file colvarproxy_namd.C. References colvarproxy_namd::colvars_atoms_ncopies. 00586 {
00587 colvarproxy_namd *gm = (colvarproxy_namd *) cvm::proxy;
00588 if (gm->colvars_atoms_ncopies[this->index] > 0)
00589 gm->colvars_atoms_ncopies[this->index] -= 1;
00590 }
|
|
|
Apply a force to the atom. The force will be used later by the MD integrator, the collective variables module does not integrate equations of motion. Multiple calls to this function by either the same object or different objects with identical , will all add to the existing MD force. Definition at line 614 of file colvarproxy_namd.C. References ResizeArray< Elem >::add(), GlobalMaster::modifyAppliedForces(), GlobalMaster::modifyForcedAtoms(), colvarmodule::rvector::x, colvarmodule::rvector::y, and colvarmodule::rvector::z. Referenced by colvar::h_bond::apply_force(). 00615 {
00616 colvarproxy_namd *gm = (colvarproxy_namd *) cvm::proxy;
00617 gm->modifyForcedAtoms().add (this->id);
00618 gm->modifyAppliedForces().add (Vector (new_force.x, new_force.y, new_force.z));
00619 }
|
|
|
Get the current position.
Definition at line 593 of file colvarproxy_namd.C. References pos, and colvarproxy_namd::positions. Referenced by colvar::h_bond::calc_value(), and colvarmodule::atom_group::read_positions(). 00594 {
00595 colvarproxy_namd const * const gm = (colvarproxy_namd *) cvm::proxy;
00596 this->pos = gm->positions[this->index];
00597 }
|
|
|
Get the system force.
Definition at line 607 of file colvarproxy_namd.C. References colvarproxy_namd::applied_forces, system_force, and colvarproxy_namd::total_forces. 00608 {
00609 colvarproxy_namd const * const gm = (colvarproxy_namd *) cvm::proxy;
00610 this->system_force = gm->total_forces[this->index] - gm->applied_forces[this->index];
00611 }
|
|
|
Get the current velocity.
Definition at line 600 of file colvarproxy_namd.C. References colvarmodule::fatal_error(). 00601 {
00602 cvm::fatal_error ("Error: NAMD does not have yet a way to communicate "
00603 "atom velocities to the colvars.\n");
00604 }
|
|
|
Set non-constant data (everything except id and mass) to zero.
Definition at line 82 of file colvaratoms.h. References colvarmodule::atom_pos. Referenced by atom(), and colvar::h_bond::calc_value(). 00082 {
00083 pos = atom_pos (0.0);
00084 vel = grad = system_force = rvector (0.0);
00085 }
|
|
|
Gradient of a scalar collective variable with respect to this atom. This can only handle a scalar collective variable (i.e. when the member is used from the class), which is also the most frequent case. For more complex types of objects, atomic gradients should be defined within the specific implementation Definition at line 56 of file colvaratoms.h. Referenced by colvar::h_bond::apply_force(), colvar::h_bond::calc_gradients(), colvar::coordnum::calc_gradients(), colvar::selfcoordnum::switching_function(), and colvar::coordnum::switching_function(). |
|
|
Internal identifier (zero-based).
Definition at line 29 of file colvaratoms.h. |
|
|
Index in the list of atoms involved by the colvars (NOT in the global topology!).
Definition at line 24 of file colvaratoms.h. Referenced by atom(). |
|
|
Mass.
Definition at line 32 of file colvaratoms.h. Referenced by colvarmodule::atom_group::add_atom(), and atom(). |
|
|
Current position (copied from the program, can be manipulated).
Definition at line 36 of file colvaratoms.h. Referenced by colvar::coordnum::calc_gradients(), colvar::coordnum::calc_value(), read_position(), colvar::selfcoordnum::switching_function(), and colvar::coordnum::switching_function(). |
|
|
System force at the previous step (copied from the program, can be manipulated).
Definition at line 44 of file colvaratoms.h. Referenced by read_system_force(). |
|
|
Current velocity (copied from the program, can be manipulated).
Definition at line 40 of file colvaratoms.h. |
1.3.9.1