| 6 | 
  | 
 * redistribute this software in source and binary code form, provided | 
| 7 | 
  | 
 * that the following conditions are met: | 
| 8 | 
  | 
 * | 
| 9 | 
< | 
 * 1. Acknowledgement of the program authors must be made in any | 
| 10 | 
< | 
 *    publication of scientific results based in part on use of the | 
| 11 | 
< | 
 *    program.  An acceptable form of acknowledgement is citation of | 
| 12 | 
< | 
 *    the article in which the program was described (Matthew | 
| 13 | 
< | 
 *    A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher | 
| 14 | 
< | 
 *    J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented | 
| 15 | 
< | 
 *    Parallel Simulation Engine for Molecular Dynamics," | 
| 16 | 
< | 
 *    J. Comput. Chem. 26, pp. 252-271 (2005)) | 
| 17 | 
< | 
 * | 
| 18 | 
< | 
 * 2. Redistributions of source code must retain the above copyright | 
| 9 | 
> | 
 * 1. Redistributions of source code must retain the above copyright | 
| 10 | 
  | 
 *    notice, this list of conditions and the following disclaimer. | 
| 11 | 
  | 
 * | 
| 12 | 
< | 
 * 3. Redistributions in binary form must reproduce the above copyright | 
| 12 | 
> | 
 * 2. Redistributions in binary form must reproduce the above copyright | 
| 13 | 
  | 
 *    notice, this list of conditions and the following disclaimer in the | 
| 14 | 
  | 
 *    documentation and/or other materials provided with the | 
| 15 | 
  | 
 *    distribution. | 
| 28 | 
  | 
 * arising out of the use of or inability to use software, even if the | 
| 29 | 
  | 
 * University of Notre Dame has been advised of the possibility of | 
| 30 | 
  | 
 * such damages. | 
| 31 | 
+ | 
 * | 
| 32 | 
+ | 
 * SUPPORT OPEN SCIENCE!  If you use OpenMD or its source code in your | 
| 33 | 
+ | 
 * research, please cite the appropriate papers when you publish your | 
| 34 | 
+ | 
 * work.  Good starting points are: | 
| 35 | 
+ | 
 *                                                                       | 
| 36 | 
+ | 
 * [1]  Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).              | 
| 37 | 
+ | 
 * [2]  Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).           | 
| 38 | 
+ | 
 * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008).           | 
| 39 | 
+ | 
 * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010). | 
| 40 | 
+ | 
 * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). | 
| 41 | 
  | 
 */ | 
| 42 | 
  | 
  | 
| 43 | 
  | 
/** | 
| 55 | 
  | 
#include <utility> | 
| 56 | 
  | 
#include <vector> | 
| 57 | 
  | 
 | 
| 58 | 
< | 
#include "brains/Exclude.hpp" | 
| 58 | 
> | 
#include "brains/PairList.hpp" | 
| 59 | 
  | 
#include "io/Globals.hpp" | 
| 60 | 
  | 
#include "math/Vector3.hpp" | 
| 61 | 
  | 
#include "math/SquareMatrix3.hpp" | 
| 62 | 
  | 
#include "types/MoleculeStamp.hpp" | 
| 63 | 
< | 
#include "UseTheForce/ForceField.hpp" | 
| 63 | 
> | 
#include "brains/ForceField.hpp" | 
| 64 | 
  | 
#include "utils/PropertyMap.hpp" | 
| 65 | 
  | 
#include "utils/LocalIndexManager.hpp" | 
| 66 | 
+ | 
#include "nonbonded/SwitchingFunction.hpp" | 
| 67 | 
  | 
 | 
| 68 | 
< | 
//another nonsense macro declaration | 
| 69 | 
< | 
#define __C | 
| 70 | 
< | 
#include "brains/fSimulation.h" | 
| 69 | 
< | 
 | 
| 70 | 
< | 
namespace oopse{ | 
| 71 | 
< | 
 | 
| 72 | 
< | 
  //forward decalration  | 
| 68 | 
> | 
using namespace std; | 
| 69 | 
> | 
namespace OpenMD{ | 
| 70 | 
> | 
  //forward declaration  | 
| 71 | 
  | 
  class SnapshotManager; | 
| 72 | 
  | 
  class Molecule; | 
| 73 | 
  | 
  class SelectionManager; | 
| 74 | 
+ | 
  class StuntDouble; | 
| 75 | 
+ | 
 | 
| 76 | 
  | 
  /** | 
| 77 | 
< | 
   * @class SimInfo SimInfo.hpp "brains/SimInfo.hpp"  | 
| 78 | 
< | 
   * @brief One of the heavy weight classes of OOPSE, SimInfo maintains a list of molecules. | 
| 79 | 
< | 
   * The Molecule class maintains all of the concrete objects  | 
| 80 | 
< | 
   * (atoms, bond, bend, torsions, rigid bodies, cutoff groups, constrains). | 
| 81 | 
< | 
   * In both the  single and parallel versions,  atoms and | 
| 82 | 
< | 
   * rigid bodies have both global and local indices.  The local index is  | 
| 83 | 
< | 
   * not relevant to molecules or cutoff groups. | 
| 77 | 
> | 
   * @class SimInfo SimInfo.hpp "brains/SimInfo.hpp" | 
| 78 | 
> | 
   * | 
| 79 | 
> | 
   * @brief One of the heavy-weight classes of OpenMD, SimInfo | 
| 80 | 
> | 
   * maintains objects and variables relating to the current | 
| 81 | 
> | 
   * simulation.  This includes the master list of Molecules.  The | 
| 82 | 
> | 
   * Molecule class maintains all of the concrete objects (Atoms, | 
| 83 | 
> | 
   * Bond, Bend, Torsions, Inversions, RigidBodies, CutoffGroups, | 
| 84 | 
> | 
   * Constraints). In both the single and parallel versions, Atoms and | 
| 85 | 
> | 
   * RigidBodies have both global and local indices. | 
| 86 | 
  | 
   */ | 
| 87 | 
  | 
  class SimInfo { | 
| 88 | 
  | 
  public: | 
| 89 | 
< | 
    typedef std::map<int, Molecule*>::iterator  MoleculeIterator; | 
| 90 | 
< | 
 | 
| 89 | 
> | 
    typedef map<int, Molecule*>::iterator  MoleculeIterator; | 
| 90 | 
> | 
     | 
| 91 | 
  | 
    /** | 
| 92 | 
  | 
     * Constructor of SimInfo | 
| 93 | 
< | 
     * @param molStampPairs MoleculeStamp Array. The first element of the pair is molecule stamp, the | 
| 94 | 
< | 
     * second element is the total number of molecules with the same molecule stamp in the system | 
| 95 | 
< | 
     * @param ff pointer of a concrete ForceField instance | 
| 96 | 
< | 
     * @param simParams  | 
| 95 | 
< | 
     * @note | 
| 93 | 
> | 
     * | 
| 94 | 
> | 
     * @param ff pointer to a concrete ForceField instance | 
| 95 | 
> | 
     * | 
| 96 | 
> | 
     * @param simParams pointer to the simulation parameters in a Globals object | 
| 97 | 
  | 
     */ | 
| 98 | 
  | 
    SimInfo(ForceField* ff, Globals* simParams); | 
| 99 | 
  | 
    virtual ~SimInfo(); | 
| 100 | 
  | 
 | 
| 101 | 
  | 
    /** | 
| 102 | 
  | 
     * Adds a molecule | 
| 103 | 
< | 
     * @return return true if adding successfully, return false if the molecule is already in SimInfo | 
| 104 | 
< | 
     * @param mol molecule to be added | 
| 103 | 
> | 
     * | 
| 104 | 
> | 
     * @return return true if adding successfully, return false if the | 
| 105 | 
> | 
     * molecule is already in SimInfo | 
| 106 | 
> | 
     * | 
| 107 | 
> | 
     * @param mol Molecule to be added | 
| 108 | 
  | 
     */ | 
| 109 | 
  | 
    bool addMolecule(Molecule* mol); | 
| 110 | 
  | 
 | 
| 111 | 
  | 
    /** | 
| 112 | 
  | 
     * Removes a molecule from SimInfo | 
| 113 | 
< | 
     * @return true if removing successfully, return false if molecule is not in this SimInfo | 
| 113 | 
> | 
     * | 
| 114 | 
> | 
     * @return true if removing successfully, return false if molecule | 
| 115 | 
> | 
     * is not in this SimInfo | 
| 116 | 
  | 
     */ | 
| 117 | 
  | 
    bool removeMolecule(Molecule* mol); | 
| 118 | 
  | 
 | 
| 132 | 
  | 
    } | 
| 133 | 
  | 
 | 
| 134 | 
  | 
    /** | 
| 135 | 
< | 
     * Returns the total number of integrable objects (total number of rigid bodies plus the total number | 
| 136 | 
< | 
     * of atoms which do not belong to the rigid bodies) in the system | 
| 135 | 
> | 
     * Returns the total number of integrable objects (total number of | 
| 136 | 
> | 
     * rigid bodies plus the total number of atoms which do not belong | 
| 137 | 
> | 
     * to the rigid bodies) in the system | 
| 138 | 
  | 
     */ | 
| 139 | 
  | 
    int getNGlobalIntegrableObjects() { | 
| 140 | 
  | 
      return nGlobalIntegrableObjects_; | 
| 141 | 
  | 
    } | 
| 142 | 
  | 
 | 
| 143 | 
  | 
    /** | 
| 144 | 
< | 
     * Returns the total number of integrable objects (total number of rigid bodies plus the total number | 
| 145 | 
< | 
     * of atoms which do not belong to the rigid bodies) in the system | 
| 144 | 
> | 
     * Returns the total number of integrable objects (total number of | 
| 145 | 
> | 
     * rigid bodies plus the total number of atoms which do not belong | 
| 146 | 
> | 
     * to the rigid bodies) in the system | 
| 147 | 
  | 
     */ | 
| 148 | 
  | 
    int getNGlobalRigidBodies() { | 
| 149 | 
  | 
      return nGlobalRigidBodies_; | 
| 163 | 
  | 
      return nAtoms_; | 
| 164 | 
  | 
    } | 
| 165 | 
  | 
 | 
| 166 | 
+ | 
    /** Returns the number of effective cutoff groups on local processor */ | 
| 167 | 
+ | 
    unsigned int getNLocalCutoffGroups(); | 
| 168 | 
+ | 
 | 
| 169 | 
  | 
    /** Returns the number of local bonds */         | 
| 170 | 
  | 
    unsigned int getNBonds(){ | 
| 171 | 
  | 
      return nBonds_; | 
| 181 | 
  | 
      return nTorsions_; | 
| 182 | 
  | 
    } | 
| 183 | 
  | 
 | 
| 184 | 
+ | 
    /** Returns the number of local torsions */         | 
| 185 | 
+ | 
    unsigned int getNInversions() { | 
| 186 | 
+ | 
      return nInversions_; | 
| 187 | 
+ | 
    } | 
| 188 | 
  | 
    /** Returns the number of local rigid bodies */         | 
| 189 | 
  | 
    unsigned int getNRigidBodies() { | 
| 190 | 
  | 
      return nRigidBodies_; | 
| 219 | 
  | 
     */ | 
| 220 | 
  | 
    Molecule* nextMolecule(MoleculeIterator& i); | 
| 221 | 
  | 
 | 
| 222 | 
+ | 
    /** Returns the total number of fluctuating charges that are present */ | 
| 223 | 
+ | 
    int getNFluctuatingCharges() { | 
| 224 | 
+ | 
      return nGlobalFluctuatingCharges_; | 
| 225 | 
+ | 
    } | 
| 226 | 
+ | 
 | 
| 227 | 
  | 
    /** Returns the number of degrees of freedom */ | 
| 228 | 
  | 
    int getNdf() { | 
| 229 | 
  | 
      return ndf_ - getFdf(); | 
| 230 | 
  | 
    } | 
| 231 | 
  | 
 | 
| 232 | 
+ | 
    /** Returns the number of degrees of freedom (LOCAL) */ | 
| 233 | 
+ | 
    int getNdfLocal() { | 
| 234 | 
+ | 
      return ndfLocal_; | 
| 235 | 
+ | 
    } | 
| 236 | 
+ | 
 | 
| 237 | 
  | 
    /** Returns the number of raw degrees of freedom */ | 
| 238 | 
  | 
    int getNdfRaw() { | 
| 239 | 
  | 
      return ndfRaw_; | 
| 251 | 
  | 
 | 
| 252 | 
  | 
    int getFdf();  | 
| 253 | 
  | 
     | 
| 254 | 
< | 
    //getNZconstraint and setNZconstraint ruin the coherent of SimInfo class, need refactorying | 
| 254 | 
> | 
    //getNZconstraint and setNZconstraint ruin the coherence of | 
| 255 | 
> | 
    //SimInfo class, need refactoring | 
| 256 | 
  | 
         | 
| 257 | 
  | 
    /** Returns the total number of z-constraint molecules in the system */ | 
| 258 | 
  | 
    int getNZconstraint() { | 
| 283 | 
  | 
      return simParams_; | 
| 284 | 
  | 
    } | 
| 285 | 
  | 
 | 
| 260 | 
– | 
    /** Returns the velocity of center of mass of the whole system.*/ | 
| 261 | 
– | 
    Vector3d getComVel(); | 
| 262 | 
– | 
 | 
| 263 | 
– | 
    /** Returns the center of the mass of the whole system.*/ | 
| 264 | 
– | 
    Vector3d getCom(); | 
| 265 | 
– | 
   /** Returns the center of the mass and Center of Mass velocity of the whole system.*/  | 
| 266 | 
– | 
    void getComAll(Vector3d& com,Vector3d& comVel); | 
| 267 | 
– | 
 | 
| 268 | 
– | 
    /** Returns intertia tensor for the entire system and system Angular Momentum.*/ | 
| 269 | 
– | 
    void getInertiaTensor(Mat3x3d &intertiaTensor,Vector3d &angularMomentum); | 
| 270 | 
– | 
     | 
| 271 | 
– | 
    /** Returns system angular momentum */ | 
| 272 | 
– | 
    Vector3d getAngularMomentum(); | 
| 273 | 
– | 
 | 
| 274 | 
– | 
    /** main driver function to interact with fortran during the initialization and molecule migration */ | 
| 286 | 
  | 
    void update(); | 
| 287 | 
+ | 
    /** | 
| 288 | 
+ | 
     * Do final bookkeeping before Force managers need their data. | 
| 289 | 
+ | 
     */ | 
| 290 | 
+ | 
    void prepareTopology(); | 
| 291 | 
  | 
 | 
| 292 | 
+ | 
 | 
| 293 | 
  | 
    /** Returns the local index manager */ | 
| 294 | 
  | 
    LocalIndexManager* getLocalIndexManager() { | 
| 295 | 
  | 
      return &localIndexMan_; | 
| 321 | 
  | 
      return i != molecules_.end() ? i->second : NULL; | 
| 322 | 
  | 
    } | 
| 323 | 
  | 
 | 
| 324 | 
< | 
    RealType getRcut() { | 
| 325 | 
< | 
      return rcut_; | 
| 324 | 
> | 
    int getGlobalMolMembership(int id){ | 
| 325 | 
> | 
      return globalMolMembership_[id]; | 
| 326 | 
  | 
    } | 
| 327 | 
  | 
 | 
| 328 | 
< | 
    RealType getRsw() { | 
| 329 | 
< | 
      return rsw_; | 
| 330 | 
< | 
    } | 
| 328 | 
> | 
    /**  | 
| 329 | 
> | 
     * returns a vector which maps the local atom index on this | 
| 330 | 
> | 
     * processor to the global atom index.  With only one processor, | 
| 331 | 
> | 
     * these should be identical. | 
| 332 | 
> | 
     */ | 
| 333 | 
> | 
    vector<int> getGlobalAtomIndices(); | 
| 334 | 
  | 
 | 
| 335 | 
< | 
    RealType getList() { | 
| 336 | 
< | 
      return rlist_; | 
| 337 | 
< | 
    } | 
| 335 | 
> | 
    /**  | 
| 336 | 
> | 
     * returns a vector which maps the local cutoff group index on | 
| 337 | 
> | 
     * this processor to the global cutoff group index.  With only one | 
| 338 | 
> | 
     * processor, these should be identical. | 
| 339 | 
> | 
     */ | 
| 340 | 
> | 
    vector<int> getGlobalGroupIndices(); | 
| 341 | 
> | 
 | 
| 342 | 
  | 
         | 
| 343 | 
< | 
    std::string getFinalConfigFileName() { | 
| 343 | 
> | 
    string getFinalConfigFileName() { | 
| 344 | 
  | 
      return finalConfigFileName_; | 
| 345 | 
  | 
    } | 
| 346 | 
< | 
         | 
| 347 | 
< | 
    void setFinalConfigFileName(const std::string& fileName) { | 
| 346 | 
> | 
 | 
| 347 | 
> | 
    void setFinalConfigFileName(const string& fileName) { | 
| 348 | 
  | 
      finalConfigFileName_ = fileName; | 
| 349 | 
  | 
    } | 
| 350 | 
  | 
 | 
| 351 | 
< | 
    std::string getDumpFileName() { | 
| 351 | 
> | 
    string getRawMetaData() { | 
| 352 | 
> | 
      return rawMetaData_; | 
| 353 | 
> | 
    } | 
| 354 | 
> | 
    void setRawMetaData(const string& rawMetaData) { | 
| 355 | 
> | 
      rawMetaData_ = rawMetaData; | 
| 356 | 
> | 
    } | 
| 357 | 
> | 
         | 
| 358 | 
> | 
    string getDumpFileName() { | 
| 359 | 
  | 
      return dumpFileName_; | 
| 360 | 
  | 
    } | 
| 361 | 
  | 
         | 
| 362 | 
< | 
    void setDumpFileName(const std::string& fileName) { | 
| 362 | 
> | 
    void setDumpFileName(const string& fileName) { | 
| 363 | 
  | 
      dumpFileName_ = fileName; | 
| 364 | 
  | 
    } | 
| 365 | 
  | 
 | 
| 366 | 
< | 
    std::string getStatFileName() { | 
| 366 | 
> | 
    string getStatFileName() { | 
| 367 | 
  | 
      return statFileName_; | 
| 368 | 
  | 
    } | 
| 369 | 
  | 
         | 
| 370 | 
< | 
    void setStatFileName(const std::string& fileName) { | 
| 370 | 
> | 
    void setStatFileName(const string& fileName) { | 
| 371 | 
  | 
      statFileName_ = fileName; | 
| 372 | 
  | 
    } | 
| 373 | 
  | 
         | 
| 374 | 
< | 
    std::string getRestFileName() { | 
| 374 | 
> | 
    string getRestFileName() { | 
| 375 | 
  | 
      return restFileName_; | 
| 376 | 
  | 
    } | 
| 377 | 
  | 
         | 
| 378 | 
< | 
    void setRestFileName(const std::string& fileName) { | 
| 378 | 
> | 
    void setRestFileName(const string& fileName) { | 
| 379 | 
  | 
      restFileName_ = fileName; | 
| 380 | 
  | 
    } | 
| 381 | 
  | 
 | 
| 382 | 
  | 
    /**  | 
| 383 | 
  | 
     * Sets GlobalGroupMembership | 
| 354 | 
– | 
     * @see #SimCreator::setGlobalIndex | 
| 384 | 
  | 
     */   | 
| 385 | 
< | 
    void setGlobalGroupMembership(const std::vector<int>& globalGroupMembership) { | 
| 386 | 
< | 
      assert(globalGroupMembership.size() == nGlobalAtoms_); | 
| 385 | 
> | 
    void setGlobalGroupMembership(const vector<int>& globalGroupMembership) { | 
| 386 | 
> | 
      assert(globalGroupMembership.size() == static_cast<size_t>(nGlobalAtoms_)); | 
| 387 | 
  | 
      globalGroupMembership_ = globalGroupMembership; | 
| 388 | 
  | 
    } | 
| 389 | 
  | 
 | 
| 390 | 
  | 
    /**  | 
| 391 | 
  | 
     * Sets GlobalMolMembership | 
| 363 | 
– | 
     * @see #SimCreator::setGlobalIndex | 
| 392 | 
  | 
     */         | 
| 393 | 
< | 
    void setGlobalMolMembership(const std::vector<int>& globalMolMembership) { | 
| 394 | 
< | 
      assert(globalMolMembership.size() == nGlobalAtoms_); | 
| 393 | 
> | 
    void setGlobalMolMembership(const vector<int>& globalMolMembership) { | 
| 394 | 
> | 
      assert(globalMolMembership.size() == static_cast<size_t>(nGlobalAtoms_)); | 
| 395 | 
  | 
      globalMolMembership_ = globalMolMembership; | 
| 396 | 
  | 
    } | 
| 397 | 
  | 
 | 
| 398 | 
  | 
 | 
| 399 | 
< | 
    bool isFortranInitialized() { | 
| 400 | 
< | 
      return fortranInitialized_; | 
| 399 | 
> | 
    bool isTopologyDone() { | 
| 400 | 
> | 
      return topologyDone_; | 
| 401 | 
  | 
    } | 
| 402 | 
  | 
         | 
| 403 | 
  | 
    bool getCalcBoxDipole() { | 
| 404 | 
  | 
      return calcBoxDipole_; | 
| 405 | 
  | 
    } | 
| 406 | 
  | 
 | 
| 407 | 
< | 
    //below functions are just forward functions | 
| 408 | 
< | 
    //To compose or to inherit is always a hot debate. In general, is-a relation need subclassing, in the | 
| 409 | 
< | 
    //the other hand, has-a relation need composing. | 
| 407 | 
> | 
    bool getUseAtomicVirial() { | 
| 408 | 
> | 
      return useAtomicVirial_; | 
| 409 | 
> | 
    } | 
| 410 | 
> | 
 | 
| 411 | 
  | 
    /** | 
| 412 | 
  | 
     * Adds property into property map | 
| 413 | 
  | 
     * @param genData GenericData to be added into PropertyMap | 
| 418 | 
  | 
     * Removes property from PropertyMap by name | 
| 419 | 
  | 
     * @param propName the name of property to be removed | 
| 420 | 
  | 
     */ | 
| 421 | 
< | 
    void removeProperty(const std::string& propName); | 
| 421 | 
> | 
    void removeProperty(const string& propName); | 
| 422 | 
  | 
 | 
| 423 | 
  | 
    /** | 
| 424 | 
  | 
     * clear all of the properties | 
| 429 | 
  | 
     * Returns all names of properties | 
| 430 | 
  | 
     * @return all names of properties | 
| 431 | 
  | 
     */ | 
| 432 | 
< | 
    std::vector<std::string> getPropertyNames(); | 
| 432 | 
> | 
    vector<string> getPropertyNames(); | 
| 433 | 
  | 
 | 
| 434 | 
  | 
    /** | 
| 435 | 
  | 
     * Returns all of the properties in PropertyMap | 
| 436 | 
  | 
     * @return all of the properties in PropertyMap | 
| 437 | 
  | 
     */       | 
| 438 | 
< | 
    std::vector<GenericData*> getProperties(); | 
| 438 | 
> | 
    vector<GenericData*> getProperties(); | 
| 439 | 
  | 
 | 
| 440 | 
  | 
    /** | 
| 441 | 
  | 
     * Returns property  | 
| 443 | 
  | 
     * @return a pointer point to property with propName. If no property named propName | 
| 444 | 
  | 
     * exists, return NULL | 
| 445 | 
  | 
     */       | 
| 446 | 
< | 
    GenericData* getPropertyByName(const std::string& propName); | 
| 446 | 
> | 
    GenericData* getPropertyByName(const string& propName); | 
| 447 | 
  | 
 | 
| 448 | 
  | 
    /** | 
| 449 | 
< | 
     * add all exclude pairs of a molecule into exclude list. | 
| 449 | 
> | 
     * add all special interaction pairs (including excluded | 
| 450 | 
> | 
     * interactions) in a molecule into the appropriate lists. | 
| 451 | 
  | 
     */ | 
| 452 | 
< | 
    void addExcludePairs(Molecule* mol); | 
| 452 | 
> | 
    void addInteractionPairs(Molecule* mol); | 
| 453 | 
  | 
 | 
| 454 | 
  | 
    /** | 
| 455 | 
< | 
     * remove all exclude pairs which belong to a molecule from exclude list | 
| 455 | 
> | 
     * remove all special interaction pairs which belong to a molecule | 
| 456 | 
> | 
     * from the appropriate lists. | 
| 457 | 
  | 
     */ | 
| 458 | 
+ | 
    void removeInteractionPairs(Molecule* mol); | 
| 459 | 
  | 
 | 
| 460 | 
< | 
    void removeExcludePairs(Molecule* mol); | 
| 461 | 
< | 
 | 
| 430 | 
< | 
 | 
| 431 | 
< | 
    /** Returns the unique atom types of local processor in an array */ | 
| 432 | 
< | 
    std::set<AtomType*> getUniqueAtomTypes(); | 
| 460 | 
> | 
    /** Returns the set of atom types present in this simulation */ | 
| 461 | 
> | 
    set<AtomType*> getSimulatedAtomTypes(); | 
| 462 | 
  | 
         | 
| 463 | 
< | 
    friend std::ostream& operator <<(std::ostream& o, SimInfo& info); | 
| 463 | 
> | 
    friend ostream& operator <<(ostream& o, SimInfo& info); | 
| 464 | 
  | 
 | 
| 465 | 
  | 
    void getCutoff(RealType& rcut, RealType& rsw); | 
| 466 | 
  | 
         | 
| 467 | 
  | 
  private: | 
| 468 | 
  | 
 | 
| 469 | 
< | 
    /** fill up the simtype struct*/ | 
| 470 | 
< | 
    void setupSimType(); | 
| 469 | 
> | 
    /** fill up the simtype struct and other simulation-related variables */ | 
| 470 | 
> | 
    void setupSimVariables(); | 
| 471 | 
  | 
 | 
| 443 | 
– | 
    /** | 
| 444 | 
– | 
     * Setup Fortran Simulation | 
| 445 | 
– | 
     * @see #setupFortranParallel | 
| 446 | 
– | 
     */ | 
| 447 | 
– | 
    void setupFortranSim(); | 
| 472 | 
  | 
 | 
| 449 | 
– | 
    /** Figure out the radius of cutoff, radius of switching function and pass them to fortran */ | 
| 450 | 
– | 
    void setupCutoff(); | 
| 451 | 
– | 
 | 
| 452 | 
– | 
    /** Figure out which coulombic correction method to use and pass to fortran */ | 
| 453 | 
– | 
    void setupElectrostaticSummationMethod( int isError ); | 
| 454 | 
– | 
 | 
| 455 | 
– | 
    /** Figure out which polynomial type to use for the switching function */ | 
| 456 | 
– | 
    void setupSwitchingFunction(); | 
| 457 | 
– | 
 | 
| 473 | 
  | 
    /** Determine if we need to accumulate the simulation box dipole */ | 
| 474 | 
  | 
    void setupAccumulateBoxDipole(); | 
| 475 | 
  | 
 | 
| 478 | 
  | 
    void calcNdfRaw(); | 
| 479 | 
  | 
    void calcNdfTrans(); | 
| 480 | 
  | 
 | 
| 466 | 
– | 
    ForceField* forceField_;       | 
| 467 | 
– | 
    Globals* simParams_; | 
| 468 | 
– | 
 | 
| 469 | 
– | 
    std::map<int, Molecule*>  molecules_; /**< Molecule array */ | 
| 470 | 
– | 
 | 
| 481 | 
  | 
    /** | 
| 482 | 
< | 
     * Adds molecule stamp and the total number of the molecule with same molecule stamp in the whole | 
| 483 | 
< | 
     * system. | 
| 482 | 
> | 
     * Adds molecule stamp and the total number of the molecule with | 
| 483 | 
> | 
     * same molecule stamp in the whole system. | 
| 484 | 
  | 
     */ | 
| 485 | 
  | 
    void addMoleculeStamp(MoleculeStamp* molStamp, int nmol); | 
| 486 | 
+ | 
 | 
| 487 | 
+ | 
    // Other classes holdingn important information | 
| 488 | 
+ | 
    ForceField* forceField_; /**< provides access to defined atom types, bond types, etc. */ | 
| 489 | 
+ | 
    Globals* simParams_;     /**< provides access to simulation parameters set by user */ | 
| 490 | 
+ | 
 | 
| 491 | 
+ | 
    ///  Counts of local objects | 
| 492 | 
+ | 
    int nAtoms_;              /**< number of atoms in local processor */ | 
| 493 | 
+ | 
    int nBonds_;              /**< number of bonds in local processor */ | 
| 494 | 
+ | 
    int nBends_;              /**< number of bends in local processor */ | 
| 495 | 
+ | 
    int nTorsions_;           /**< number of torsions in local processor */ | 
| 496 | 
+ | 
    int nInversions_;         /**< number of inversions in local processor */ | 
| 497 | 
+ | 
    int nRigidBodies_;        /**< number of rigid bodies in local processor */ | 
| 498 | 
+ | 
    int nIntegrableObjects_;  /**< number of integrable objects in local processor */ | 
| 499 | 
+ | 
    int nCutoffGroups_;       /**< number of cutoff groups in local processor */ | 
| 500 | 
+ | 
    int nConstraints_;        /**< number of constraints in local processors */ | 
| 501 | 
+ | 
    int nFluctuatingCharges_; /**< number of fluctuating charges in local processor */ | 
| 502 | 
  | 
         | 
| 503 | 
< | 
    //degress of freedom | 
| 504 | 
< | 
    int ndf_;           /**< number of degress of freedom (excludes constraints),  ndf_ is local */ | 
| 505 | 
< | 
    int fdf_local;       /**< number of frozen degrees of freedom */ | 
| 506 | 
< | 
    int fdf_;            /**< number of frozen degrees of freedom */ | 
| 481 | 
< | 
    int ndfRaw_;    /**< number of degress of freedom (includes constraints),  ndfRaw_ is local */ | 
| 482 | 
< | 
    int ndfTrans_; /**< number of translation degress of freedom, ndfTrans_ is local */ | 
| 483 | 
< | 
    int nZconstraint_; /** number of  z-constraint molecules, nZconstraint_ is global */ | 
| 484 | 
< | 
         | 
| 485 | 
< | 
    //number of global objects | 
| 486 | 
< | 
    int nGlobalMols_;       /**< number of molecules in the system */ | 
| 487 | 
< | 
    int nGlobalAtoms_;   /**< number of atoms in the system */ | 
| 488 | 
< | 
    int nGlobalCutoffGroups_; /**< number of cutoff groups in this system */ | 
| 503 | 
> | 
    /// Counts of global objects | 
| 504 | 
> | 
    int nGlobalMols_;              /**< number of molecules in the system (GLOBAL) */ | 
| 505 | 
> | 
    int nGlobalAtoms_;             /**< number of atoms in the system (GLOBAL) */ | 
| 506 | 
> | 
    int nGlobalCutoffGroups_;      /**< number of cutoff groups in this system (GLOBAL) */ | 
| 507 | 
  | 
    int nGlobalIntegrableObjects_; /**< number of integrable objects in this system */ | 
| 508 | 
< | 
    int nGlobalRigidBodies_; /**< number of rigid bodies in this system */ | 
| 508 | 
> | 
    int nGlobalRigidBodies_;       /**< number of rigid bodies in this system (GLOBAL) */ | 
| 509 | 
> | 
    int nGlobalFluctuatingCharges_;/**< number of fluctuating charges in this system (GLOBAL) */ | 
| 510 | 
> | 
     | 
| 511 | 
> | 
        | 
| 512 | 
> | 
    /// Degress of freedom | 
| 513 | 
> | 
    int ndf_;          /**< number of degress of freedom (excludes constraints) (LOCAL) */ | 
| 514 | 
> | 
    int ndfLocal_;     /**< number of degrees of freedom (LOCAL, excludes constraints) */ | 
| 515 | 
> | 
    int fdf_local;     /**< number of frozen degrees of freedom (LOCAL) */ | 
| 516 | 
> | 
    int fdf_;          /**< number of frozen degrees of freedom (GLOBAL) */ | 
| 517 | 
> | 
    int ndfRaw_;       /**< number of degress of freedom (includes constraints),  (LOCAL) */ | 
| 518 | 
> | 
    int ndfTrans_;     /**< number of translation degress of freedom, (LOCAL) */ | 
| 519 | 
> | 
    int nZconstraint_; /**< number of  z-constraint molecules (GLOBAL) */ | 
| 520 | 
> | 
 | 
| 521 | 
> | 
    /// logicals  | 
| 522 | 
> | 
    bool usesPeriodicBoundaries_; /**< use periodic boundary conditions? */ | 
| 523 | 
> | 
    bool usesDirectionalAtoms_;   /**< are there atoms with position AND orientation? */ | 
| 524 | 
> | 
    bool usesMetallicAtoms_;      /**< are there transition metal atoms? */ | 
| 525 | 
> | 
    bool usesElectrostaticAtoms_; /**< are there electrostatic atoms? */ | 
| 526 | 
> | 
    bool usesFluctuatingCharges_; /**< are there fluctuating charges? */ | 
| 527 | 
> | 
    bool usesAtomicVirial_;       /**< are we computing atomic virials? */ | 
| 528 | 
> | 
    bool requiresPrepair_;        /**< does this simulation require a pre-pair loop? */ | 
| 529 | 
> | 
    bool requiresSkipCorrection_; /**< does this simulation require a skip-correction? */ | 
| 530 | 
> | 
    bool requiresSelfCorrection_; /**< does this simulation require a self-correction? */ | 
| 531 | 
> | 
 | 
| 532 | 
> | 
  public: | 
| 533 | 
> | 
    bool usesElectrostaticAtoms() { return usesElectrostaticAtoms_; } | 
| 534 | 
> | 
    bool usesDirectionalAtoms() { return usesDirectionalAtoms_; } | 
| 535 | 
> | 
    bool usesFluctuatingCharges() { return usesFluctuatingCharges_; } | 
| 536 | 
> | 
    bool usesAtomicVirial() { return usesAtomicVirial_; } | 
| 537 | 
> | 
    bool requiresPrepair() { return requiresPrepair_; } | 
| 538 | 
> | 
    bool requiresSkipCorrection() { return requiresSkipCorrection_;} | 
| 539 | 
> | 
    bool requiresSelfCorrection() { return requiresSelfCorrection_;} | 
| 540 | 
> | 
 | 
| 541 | 
> | 
  private: | 
| 542 | 
> | 
    /// Data structures holding primary simulation objects | 
| 543 | 
> | 
    map<int, Molecule*>  molecules_;  /**< map holding pointers to LOCAL molecules */ | 
| 544 | 
> | 
 | 
| 545 | 
> | 
    /// Stamps are templates for objects that are then used to create | 
| 546 | 
> | 
    /// groups of objects.  For example, a molecule stamp contains | 
| 547 | 
> | 
    /// information on how to build that molecule (i.e. the topology, | 
| 548 | 
> | 
    /// the atoms, the bonds, etc.)  Once the system is built, the | 
| 549 | 
> | 
    /// stamps are no longer useful. | 
| 550 | 
> | 
    vector<int> molStampIds_;                /**< stamp id for molecules in the system */ | 
| 551 | 
> | 
    vector<MoleculeStamp*> moleculeStamps_;  /**< molecule stamps array */         | 
| 552 | 
> | 
 | 
| 553 | 
  | 
    /** | 
| 554 | 
< | 
     * the size of globalGroupMembership_  is nGlobalAtoms. Its index is  global index of an atom, and the | 
| 555 | 
< | 
     * corresponding content is the global index of cutoff group this atom belong to.  | 
| 556 | 
< | 
     * It is filled by SimCreator once and only once, since it never changed during the simulation. | 
| 554 | 
> | 
     * A vector that maps between the global index of an atom, and the | 
| 555 | 
> | 
     * global index of cutoff group the atom belong to.  It is filled | 
| 556 | 
> | 
     * by SimCreator once and only once, since it never changed during | 
| 557 | 
> | 
     * the simulation.  It should be nGlobalAtoms_ in size. | 
| 558 | 
  | 
     */ | 
| 559 | 
< | 
    std::vector<int> globalGroupMembership_;  | 
| 559 | 
> | 
    vector<int> globalGroupMembership_;  | 
| 560 | 
> | 
  public: | 
| 561 | 
> | 
    vector<int> getGlobalGroupMembership() { return globalGroupMembership_; } | 
| 562 | 
> | 
  private: | 
| 563 | 
  | 
 | 
| 564 | 
  | 
    /** | 
| 565 | 
< | 
     * the size of globalGroupMembership_  is nGlobalAtoms. Its index is  global index of an atom, and the | 
| 566 | 
< | 
     * corresponding content is the global index of molecule this atom belong to.  | 
| 567 | 
< | 
     * It is filled by SimCreator once and only once, since it is never changed during the simulation. | 
| 565 | 
> | 
     * A vector that maps between the global index of an atom and the | 
| 566 | 
> | 
     * global index of the molecule the atom belongs to.  It is filled | 
| 567 | 
> | 
     * by SimCreator once and only once, since it is never changed | 
| 568 | 
> | 
     * during the simulation. It shoudl be nGlobalAtoms_ in size. | 
| 569 | 
  | 
     */ | 
| 570 | 
< | 
    std::vector<int> globalMolMembership_;         | 
| 570 | 
> | 
    vector<int> globalMolMembership_;  | 
| 571 | 
  | 
 | 
| 572 | 
< | 
         | 
| 573 | 
< | 
    std::vector<int> molStampIds_;                                /**< stamp id array of all molecules in the system */ | 
| 574 | 
< | 
    std::vector<MoleculeStamp*> moleculeStamps_;      /**< molecule stamps array */         | 
| 575 | 
< | 
         | 
| 576 | 
< | 
    //number of local objects | 
| 577 | 
< | 
    int nAtoms_;                        /**< number of atoms in local processor */ | 
| 578 | 
< | 
    int nBonds_;                        /**< number of bonds in local processor */ | 
| 579 | 
< | 
    int nBends_;                        /**< number of bends in local processor */ | 
| 580 | 
< | 
    int nTorsions_;                    /**< number of torsions in local processor */ | 
| 581 | 
< | 
    int nRigidBodies_;              /**< number of rigid bodies in local processor */ | 
| 582 | 
< | 
    int nIntegrableObjects_;    /**< number of integrable objects in local processor */ | 
| 583 | 
< | 
    int nCutoffGroups_;             /**< number of cutoff groups in local processor */ | 
| 584 | 
< | 
    int nConstraints_;              /**< number of constraints in local processors */ | 
| 572 | 
> | 
    /**  | 
| 573 | 
> | 
     * A vector that maps between the local index of an atom and the | 
| 574 | 
> | 
     * index of the AtomType. | 
| 575 | 
> | 
     */ | 
| 576 | 
> | 
    vector<int> identArray_; | 
| 577 | 
> | 
  public: | 
| 578 | 
> | 
    vector<int> getIdentArray() { return identArray_; } | 
| 579 | 
> | 
  private: | 
| 580 | 
> | 
     | 
| 581 | 
> | 
    /**  | 
| 582 | 
> | 
     * A vector which contains the fractional contribution of an | 
| 583 | 
> | 
     * atom's mass to the total mass of the cutoffGroup that atom | 
| 584 | 
> | 
     * belongs to.  In the case of single atom cutoff groups, the mass | 
| 585 | 
> | 
     * factor for that atom is 1.  For massless atoms, the factor is | 
| 586 | 
> | 
     * also 1. | 
| 587 | 
> | 
     */ | 
| 588 | 
> | 
    vector<RealType> massFactors_; | 
| 589 | 
> | 
  public: | 
| 590 | 
> | 
    vector<RealType> getMassFactors() { return massFactors_; } | 
| 591 | 
  | 
 | 
| 592 | 
< | 
    simtype fInfo_; /**< A dual struct shared by c++/fortran which indicates the atom types in simulation*/ | 
| 593 | 
< | 
    Exclude exclude_;       | 
| 594 | 
< | 
    PropertyMap properties_;                  /**< Generic Property */ | 
| 595 | 
< | 
    SnapshotManager* sman_;               /**< SnapshotManager */ | 
| 592 | 
> | 
    PairList* getExcludedInteractions() { return &excludedInteractions_; } | 
| 593 | 
> | 
    PairList* getOneTwoInteractions() { return &oneTwoInteractions_; } | 
| 594 | 
> | 
    PairList* getOneThreeInteractions() { return &oneThreeInteractions_; } | 
| 595 | 
> | 
    PairList* getOneFourInteractions() { return &oneFourInteractions_; } | 
| 596 | 
  | 
 | 
| 597 | 
+ | 
  private: | 
| 598 | 
+ | 
                | 
| 599 | 
+ | 
    /// lists to handle atoms needing special treatment in the non-bonded interactions | 
| 600 | 
+ | 
    PairList excludedInteractions_;  /**< atoms excluded from interacting with each other */ | 
| 601 | 
+ | 
    PairList oneTwoInteractions_;    /**< atoms that are directly Bonded */  | 
| 602 | 
+ | 
    PairList oneThreeInteractions_;  /**< atoms sharing a Bend */     | 
| 603 | 
+ | 
    PairList oneFourInteractions_;   /**< atoms sharing a Torsion */ | 
| 604 | 
+ | 
 | 
| 605 | 
+ | 
    PropertyMap properties_;       /**< Generic Properties can be added */ | 
| 606 | 
+ | 
    SnapshotManager* sman_;        /**< SnapshotManager (handles particle positions, etc.) */ | 
| 607 | 
+ | 
 | 
| 608 | 
  | 
    /**  | 
| 609 | 
< | 
     * The reason to have a local index manager is that when molecule is migrating to other processors,  | 
| 610 | 
< | 
     * the atoms and the rigid-bodies will release their local indices to LocalIndexManager. Combining the | 
| 611 | 
< | 
     * information of molecule migrating to current processor, Migrator class can query  the LocalIndexManager | 
| 612 | 
< | 
     * to make a efficient data moving plan. | 
| 609 | 
> | 
     * The reason to have a local index manager is that when molecule | 
| 610 | 
> | 
     * is migrating to other processors, the atoms and the | 
| 611 | 
> | 
     * rigid-bodies will release their local indices to | 
| 612 | 
> | 
     * LocalIndexManager. Combining the information of molecule | 
| 613 | 
> | 
     * migrating to current processor, Migrator class can query the | 
| 614 | 
> | 
     * LocalIndexManager to make a efficient data moving plan. | 
| 615 | 
  | 
     */         | 
| 616 | 
  | 
    LocalIndexManager localIndexMan_; | 
| 617 | 
  | 
 | 
| 618 | 
< | 
    //file names | 
| 619 | 
< | 
    std::string finalConfigFileName_; | 
| 620 | 
< | 
    std::string dumpFileName_; | 
| 621 | 
< | 
    std::string statFileName_; | 
| 622 | 
< | 
    std::string restFileName_; | 
| 618 | 
> | 
    // unparsed MetaData block for storing in Dump and EOR files: | 
| 619 | 
> | 
    string rawMetaData_; | 
| 620 | 
> | 
 | 
| 621 | 
> | 
    // file names | 
| 622 | 
> | 
    string finalConfigFileName_; | 
| 623 | 
> | 
    string dumpFileName_; | 
| 624 | 
> | 
    string statFileName_; | 
| 625 | 
> | 
    string restFileName_; | 
| 626 | 
  | 
         | 
| 538 | 
– | 
    RealType rcut_;       /**< cutoff radius*/ | 
| 539 | 
– | 
    RealType rsw_;        /**< radius of switching function*/ | 
| 540 | 
– | 
    RealType rlist_;      /**< neighbor list radius */ | 
| 627 | 
  | 
 | 
| 628 | 
< | 
    bool fortranInitialized_; /**< flag indicate whether fortran side is initialized */ | 
| 629 | 
< | 
 | 
| 630 | 
< | 
    bool calcBoxDipole_; /**< flag to indicate whether or not we calculate the simulation box dipole moment */ | 
| 631 | 
< | 
 | 
| 632 | 
< | 
#ifdef IS_MPI | 
| 633 | 
< | 
    //in Parallel version, we need MolToProc | 
| 628 | 
> | 
    bool topologyDone_;  /** flag to indicate whether the topology has | 
| 629 | 
> | 
                             been scanned and all the relevant | 
| 630 | 
> | 
                             bookkeeping has been done*/ | 
| 631 | 
> | 
     | 
| 632 | 
> | 
    bool calcBoxDipole_; /**< flag to indicate whether or not we calculate  | 
| 633 | 
> | 
                            the simulation box dipole moment */ | 
| 634 | 
> | 
     | 
| 635 | 
> | 
    bool useAtomicVirial_; /**< flag to indicate whether or not we use  | 
| 636 | 
> | 
                              Atomic Virials to calculate the pressure */ | 
| 637 | 
> | 
     | 
| 638 | 
  | 
  public: | 
| 639 | 
+ | 
    /** | 
| 640 | 
+ | 
     * return an integral objects by its global index. In MPI | 
| 641 | 
+ | 
     * version, if the StuntDouble with specified global index does | 
| 642 | 
+ | 
      * not belong to local processor, a NULL will be return. | 
| 643 | 
+ | 
      */ | 
| 644 | 
+ | 
    StuntDouble* getIOIndexToIntegrableObject(int index); | 
| 645 | 
+ | 
    void setIOIndexToIntegrableObject(const vector<StuntDouble*>& v); | 
| 646 | 
+ | 
     | 
| 647 | 
+ | 
  private: | 
| 648 | 
+ | 
    vector<StuntDouble*> IOIndexToIntegrableObject; | 
| 649 | 
+ | 
     | 
| 650 | 
+ | 
  public: | 
| 651 | 
  | 
                 | 
| 652 | 
  | 
    /** | 
| 653 | 
  | 
     * Finds the processor where a molecule resides | 
| 658 | 
  | 
      //assert(globalIndex < molToProcMap_.size()); | 
| 659 | 
  | 
      return molToProcMap_[globalIndex]; | 
| 660 | 
  | 
    } | 
| 661 | 
< | 
 | 
| 661 | 
> | 
     | 
| 662 | 
  | 
    /**  | 
| 663 | 
  | 
     * Set MolToProcMap array | 
| 562 | 
– | 
     * @see #SimCreator::divideMolecules | 
| 664 | 
  | 
     */ | 
| 665 | 
< | 
    void setMolToProcMap(const std::vector<int>& molToProcMap) { | 
| 665 | 
> | 
    void setMolToProcMap(const vector<int>& molToProcMap) { | 
| 666 | 
  | 
      molToProcMap_ = molToProcMap; | 
| 667 | 
  | 
    } | 
| 668 | 
  | 
         | 
| 669 | 
  | 
  private: | 
| 569 | 
– | 
 | 
| 570 | 
– | 
    void setupFortranParallel(); | 
| 670 | 
  | 
         | 
| 671 | 
  | 
    /**  | 
| 672 | 
< | 
     * The size of molToProcMap_ is equal to total number of molecules in the system. | 
| 673 | 
< | 
     *  It maps a molecule to the processor on which it resides. it is filled by SimCreator once and only | 
| 674 | 
< | 
     * once. | 
| 672 | 
> | 
     * The size of molToProcMap_ is equal to total number of molecules | 
| 673 | 
> | 
     * in the system.  It maps a molecule to the processor on which it | 
| 674 | 
> | 
     * resides. it is filled by SimCreator once and only once. | 
| 675 | 
  | 
     */         | 
| 676 | 
< | 
    std::vector<int> molToProcMap_;  | 
| 676 | 
> | 
    vector<int> molToProcMap_;  | 
| 677 | 
  | 
 | 
| 579 | 
– | 
#endif | 
| 580 | 
– | 
 | 
| 678 | 
  | 
  }; | 
| 679 | 
  | 
 | 
| 680 | 
< | 
} //namespace oopse | 
| 680 | 
> | 
} //namespace OpenMD | 
| 681 | 
  | 
#endif //BRAINS_SIMMODEL_HPP | 
| 682 | 
  | 
 |