Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

colvaratoms.h

Go to the documentation of this file.
00001 #ifndef COLVARATOMS_H
00002 #define COLVARATOMS_H
00003 
00004 #include "colvarmodule.h"
00005 #include "colvarparse.h"
00006 
00018 class colvarmodule::atom {
00019 
00020 protected:
00021 
00024   size_t        index;
00025 
00026 public:
00027 
00029   int              id;
00030 
00032   cvm::real      mass;
00033 
00036   cvm::atom_pos   pos;
00037 
00040   cvm::rvector    vel;
00041 
00044   cvm::rvector    system_force;
00045 
00056   cvm::rvector   grad;
00057 
00059   inline atom() {}
00060 
00064   atom (int const &atom_number);
00065 
00071   atom (cvm::residue_id const &residue,
00072         std::string const     &atom_name,
00073         std::string const     &segment_id);
00074 
00076   atom (atom const &a);
00077 
00079   ~atom();
00080 
00082   inline void reset_data() {
00083     pos = atom_pos (0.0);
00084     vel = grad = system_force = rvector (0.0);
00085   }
00086 
00088   void read_position();
00089 
00091   void read_velocity();
00092 
00094   void read_system_force();
00095 
00103   void apply_force (cvm::rvector const &new_force);
00104 };
00105 
00106 
00107 
00108 
00117 class colvarmodule::atom_group
00118   : public std::vector<cvm::atom>,
00119     public colvarparse
00120 {
00121 public:
00122   // Note: all members here are kept public, to make possible to any
00123   // object accessing and manipulating them
00124 
00125 
00129   bool b_dummy;
00131   cvm::atom_pos dummy_atom_pos;
00132 
00133 
00136   bool b_center;
00137 
00146   bool b_rotate;
00148   cvm::rotation rot;
00149 
00152   std::vector<cvm::atom_pos> ref_pos;
00156   cvm::atom_pos              ref_pos_com;
00159   atom_group                *ref_pos_group;
00160 
00161 
00163   cvm::real total_mass;
00164 
00167   bool        noforce;
00168 
00169 
00174   atom_group (std::string const &conf,
00175               char const        *key,
00176               atom_group        *ref_pos_group = NULL);
00177 
00180   void parse (std::string const &conf,
00181               char const        *key,
00182               atom_group        *ref_pos_group = NULL);
00183 
00185   atom_group (std::vector<cvm::atom> const &atoms);
00186 
00188   void add_atom (cvm::atom const &a);
00189 
00191   atom_group();
00192 
00194   ~atom_group();
00195 
00199   void read_positions();
00200 
00202   void apply_translation (cvm::rvector const &t);
00203 
00205   void apply_rotation (cvm::rotation const &q);
00206 
00207 
00211   void read_velocities();
00212 
00216   void read_system_forces();
00217 
00219   inline void reset_atoms_data()
00220   {
00221     for (cvm::atom_iter ai = this->begin(); ai != this->end(); ai++)
00222       ai->reset_data();
00223   }
00224 
00226   std::vector<cvm::atom_pos> positions() const;
00227 
00229   std::vector<cvm::atom_pos> positions_shifted (cvm::rvector const &shift) const;
00230 
00233   cvm::atom_pos center_of_geometry (cvm::atom_pos const &ref_pos);
00236   cvm::atom_pos center_of_geometry() const;
00237 
00240   cvm::atom_pos center_of_mass (cvm::atom_pos const &ref_pos);
00243   cvm::atom_pos center_of_mass() const;
00244 
00246   std::vector<cvm::atom_pos> old_pos;
00247 
00248 
00250   std::vector<cvm::rvector> velocities() const;
00251 
00252 
00254   std::vector<cvm::rvector> system_forces() const;
00256   cvm::rvector system_force() const;
00257 
00258 
00262   void set_weighted_gradient (cvm::rvector const &grad);
00263 
00276   void apply_colvar_force (cvm::real const &force);
00277 
00287   void apply_force (cvm::rvector const &force);
00288 
00299   void apply_forces (std::vector<cvm::rvector> const &forces);
00300 };
00301 
00302 
00303 
00304 
00305 #endif
00306 
00307 
00308 // Emacs
00309 // Local Variables:
00310 // mode: C++
00311 // End:

Generated on Mon Nov 23 04:59:18 2009 for NAMD by  doxygen 1.3.9.1