| 57 | 
  | 
#include "brains/Exclude.hpp" | 
| 58 | 
  | 
#include "io/Globals.hpp" | 
| 59 | 
  | 
#include "math/Vector3.hpp" | 
| 60 | 
+ | 
#include "math/SquareMatrix3.hpp" | 
| 61 | 
  | 
#include "types/MoleculeStamp.hpp" | 
| 62 | 
  | 
#include "UseTheForce/ForceField.hpp" | 
| 63 | 
  | 
#include "utils/PropertyMap.hpp" | 
| 73 | 
  | 
  class SnapshotManager; | 
| 74 | 
  | 
  class Molecule; | 
| 75 | 
  | 
  class SelectionManager; | 
| 76 | 
+ | 
  class StuntDouble; | 
| 77 | 
  | 
  /** | 
| 78 | 
  | 
   * @class SimInfo SimInfo.hpp "brains/SimInfo.hpp"  | 
| 79 | 
< | 
   * @brief As one of the heavy weight class of OOPSE, SimInfo | 
| 80 | 
< | 
   * One of the major changes in SimInfo class is the data struct. It only maintains a list of molecules. | 
| 81 | 
< | 
   * And the Molecule class will maintain all of the concrete objects (atoms, bond, bend, torsions, rigid bodies, | 
| 82 | 
< | 
   * cutoff groups, constrains). | 
| 83 | 
< | 
   * Another major change is the index. No matter single version or parallel version,  atoms and | 
| 84 | 
< | 
   * rigid bodies have both global index and local index. Local index is not important to molecule as well as | 
| 83 | 
< | 
   * cutoff group.  | 
| 79 | 
> | 
   * @brief One of the heavy weight classes of OOPSE, SimInfo maintains a list of molecules. | 
| 80 | 
> | 
   * The Molecule class maintains all of the concrete objects  | 
| 81 | 
> | 
   * (atoms, bond, bend, torsions, rigid bodies, cutoff groups, constrains). | 
| 82 | 
> | 
   * In both the  single and parallel versions,  atoms and | 
| 83 | 
> | 
   * rigid bodies have both global and local indices.  The local index is  | 
| 84 | 
> | 
   * not relevant to molecules or cutoff groups. | 
| 85 | 
  | 
   */ | 
| 86 | 
  | 
  class SimInfo { | 
| 87 | 
  | 
  public: | 
| 95 | 
  | 
     * @param simParams  | 
| 96 | 
  | 
     * @note | 
| 97 | 
  | 
     */ | 
| 98 | 
< | 
    SimInfo(MakeStamps* stamps, std::vector<std::pair<MoleculeStamp*, int> >& molStampPairs, ForceField* ff, Globals* simParams); | 
| 98 | 
> | 
    SimInfo(ForceField* ff, Globals* simParams); | 
| 99 | 
  | 
    virtual ~SimInfo(); | 
| 100 | 
  | 
 | 
| 101 | 
  | 
    /** | 
| 207 | 
  | 
 | 
| 208 | 
  | 
    /** Returns the number of degrees of freedom */ | 
| 209 | 
  | 
    int getNdf() { | 
| 210 | 
< | 
      return ndf_; | 
| 210 | 
> | 
      return ndf_ - getFdf(); | 
| 211 | 
  | 
    } | 
| 212 | 
  | 
 | 
| 213 | 
  | 
    /** Returns the number of raw degrees of freedom */ | 
| 220 | 
  | 
      return ndfTrans_; | 
| 221 | 
  | 
    } | 
| 222 | 
  | 
 | 
| 223 | 
+ | 
    /** sets the current number of frozen degrees of freedom */ | 
| 224 | 
+ | 
    void setFdf(int fdf) { | 
| 225 | 
+ | 
      fdf_local = fdf; | 
| 226 | 
+ | 
    } | 
| 227 | 
+ | 
 | 
| 228 | 
+ | 
    int getFdf();  | 
| 229 | 
+ | 
     | 
| 230 | 
  | 
    //getNZconstraint and setNZconstraint ruin the coherent of SimInfo class, need refactorying | 
| 231 | 
  | 
         | 
| 232 | 
  | 
    /** Returns the total number of z-constraint molecules in the system */ | 
| 263 | 
  | 
 | 
| 264 | 
  | 
    /** Returns the center of the mass of the whole system.*/ | 
| 265 | 
  | 
    Vector3d getCom(); | 
| 266 | 
+ | 
   /** Returns the center of the mass and Center of Mass velocity of the whole system.*/  | 
| 267 | 
+ | 
    void getComAll(Vector3d& com,Vector3d& comVel); | 
| 268 | 
  | 
 | 
| 269 | 
+ | 
    /** Returns intertia tensor for the entire system and system Angular Momentum.*/ | 
| 270 | 
+ | 
    void getInertiaTensor(Mat3x3d &intertiaTensor,Vector3d &angularMomentum); | 
| 271 | 
+ | 
     | 
| 272 | 
+ | 
    /** Returns system angular momentum */ | 
| 273 | 
+ | 
    Vector3d getAngularMomentum(); | 
| 274 | 
+ | 
 | 
| 275 | 
+ | 
    /** Returns volume of system as estimated by an ellipsoid defined by the radii of gyration*/ | 
| 276 | 
+ | 
    void getGyrationalVolume(RealType &vol); | 
| 277 | 
+ | 
    /** Overloaded version of gyrational volume that also returns det(I) so dV/dr can be calculated*/ | 
| 278 | 
+ | 
    void getGyrationalVolume(RealType &vol, RealType &detI); | 
| 279 | 
  | 
    /** main driver function to interact with fortran during the initialization and molecule migration */ | 
| 280 | 
  | 
    void update(); | 
| 281 | 
  | 
 | 
| 310 | 
  | 
      return i != molecules_.end() ? i->second : NULL; | 
| 311 | 
  | 
    } | 
| 312 | 
  | 
 | 
| 313 | 
< | 
    /** Calculate the maximum cutoff radius based on the atom types */ | 
| 294 | 
< | 
    double calcMaxCutoffRadius(); | 
| 295 | 
< | 
 | 
| 296 | 
< | 
    double getRcut() { | 
| 313 | 
> | 
    RealType getRcut() { | 
| 314 | 
  | 
      return rcut_; | 
| 315 | 
  | 
    } | 
| 316 | 
  | 
 | 
| 317 | 
< | 
    double getRsw() { | 
| 317 | 
> | 
    RealType getRsw() { | 
| 318 | 
  | 
      return rsw_; | 
| 319 | 
  | 
    } | 
| 320 | 
+ | 
 | 
| 321 | 
+ | 
    RealType getList() { | 
| 322 | 
+ | 
      return rlist_; | 
| 323 | 
+ | 
    } | 
| 324 | 
  | 
         | 
| 325 | 
  | 
    std::string getFinalConfigFileName() { | 
| 326 | 
  | 
      return finalConfigFileName_; | 
| 327 | 
  | 
    } | 
| 328 | 
< | 
         | 
| 328 | 
> | 
 | 
| 329 | 
  | 
    void setFinalConfigFileName(const std::string& fileName) { | 
| 330 | 
  | 
      finalConfigFileName_ = fileName; | 
| 331 | 
  | 
    } | 
| 332 | 
  | 
 | 
| 333 | 
+ | 
    std::string getRawMetaData() { | 
| 334 | 
+ | 
      return rawMetaData_; | 
| 335 | 
+ | 
    } | 
| 336 | 
+ | 
    void setRawMetaData(const std::string& rawMetaData) { | 
| 337 | 
+ | 
      rawMetaData_ = rawMetaData; | 
| 338 | 
+ | 
    } | 
| 339 | 
+ | 
         | 
| 340 | 
  | 
    std::string getDumpFileName() { | 
| 341 | 
  | 
      return dumpFileName_; | 
| 342 | 
  | 
    } | 
| 384 | 
  | 
      return fortranInitialized_; | 
| 385 | 
  | 
    } | 
| 386 | 
  | 
         | 
| 387 | 
+ | 
    bool getCalcBoxDipole() { | 
| 388 | 
+ | 
      return calcBoxDipole_; | 
| 389 | 
+ | 
    } | 
| 390 | 
+ | 
 | 
| 391 | 
+ | 
    bool getUseAtomicVirial() { | 
| 392 | 
+ | 
      return useAtomicVirial_; | 
| 393 | 
+ | 
    } | 
| 394 | 
+ | 
 | 
| 395 | 
  | 
    //below functions are just forward functions | 
| 396 | 
  | 
    //To compose or to inherit is always a hot debate. In general, is-a relation need subclassing, in the | 
| 397 | 
  | 
    //the other hand, has-a relation need composing. | 
| 449 | 
  | 
         | 
| 450 | 
  | 
    friend std::ostream& operator <<(std::ostream& o, SimInfo& info); | 
| 451 | 
  | 
 | 
| 452 | 
< | 
    void getCutoff(double& rcut, double& rsw); | 
| 452 | 
> | 
    void getCutoff(RealType& rcut, RealType& rsw); | 
| 453 | 
  | 
         | 
| 454 | 
  | 
  private: | 
| 455 | 
  | 
 | 
| 465 | 
  | 
    /** Figure out the radius of cutoff, radius of switching function and pass them to fortran */ | 
| 466 | 
  | 
    void setupCutoff(); | 
| 467 | 
  | 
 | 
| 468 | 
+ | 
    /** Figure out which coulombic correction method to use and pass to fortran */ | 
| 469 | 
+ | 
    void setupElectrostaticSummationMethod( int isError ); | 
| 470 | 
+ | 
 | 
| 471 | 
+ | 
    /** Figure out which polynomial type to use for the switching function */ | 
| 472 | 
+ | 
    void setupSwitchingFunction(); | 
| 473 | 
+ | 
 | 
| 474 | 
+ | 
    /** Determine if we need to accumulate the simulation box dipole */ | 
| 475 | 
+ | 
    void setupAccumulateBoxDipole(); | 
| 476 | 
+ | 
 | 
| 477 | 
  | 
    /** Calculates the number of degress of freedom in the whole system */ | 
| 478 | 
  | 
    void calcNdf(); | 
| 479 | 
  | 
    void calcNdfRaw(); | 
| 480 | 
  | 
    void calcNdfTrans(); | 
| 481 | 
  | 
 | 
| 482 | 
+ | 
    ForceField* forceField_;       | 
| 483 | 
+ | 
    Globals* simParams_; | 
| 484 | 
+ | 
 | 
| 485 | 
+ | 
    std::map<int, Molecule*>  molecules_; /**< Molecule array */ | 
| 486 | 
+ | 
 | 
| 487 | 
  | 
    /** | 
| 488 | 
  | 
     * Adds molecule stamp and the total number of the molecule with same molecule stamp in the whole | 
| 489 | 
  | 
     * system. | 
| 490 | 
  | 
     */ | 
| 491 | 
  | 
    void addMoleculeStamp(MoleculeStamp* molStamp, int nmol); | 
| 442 | 
– | 
 | 
| 443 | 
– | 
    MakeStamps* stamps_; | 
| 444 | 
– | 
    ForceField* forceField_;       | 
| 445 | 
– | 
    Globals* simParams_; | 
| 446 | 
– | 
 | 
| 447 | 
– | 
    std::map<int, Molecule*>  molecules_; /**< Molecule array */ | 
| 492 | 
  | 
         | 
| 493 | 
  | 
    //degress of freedom | 
| 494 | 
  | 
    int ndf_;           /**< number of degress of freedom (excludes constraints),  ndf_ is local */ | 
| 495 | 
+ | 
    int fdf_local;       /**< number of frozen degrees of freedom */ | 
| 496 | 
+ | 
    int fdf_;            /**< number of frozen degrees of freedom */ | 
| 497 | 
  | 
    int ndfRaw_;    /**< number of degress of freedom (includes constraints),  ndfRaw_ is local */ | 
| 498 | 
  | 
    int ndfTrans_; /**< number of translation degress of freedom, ndfTrans_ is local */ | 
| 499 | 
  | 
    int nZconstraint_; /** number of  z-constraint molecules, nZconstraint_ is global */ | 
| 545 | 
  | 
     */         | 
| 546 | 
  | 
    LocalIndexManager localIndexMan_; | 
| 547 | 
  | 
 | 
| 548 | 
+ | 
    // unparsed MetaData block for storing in Dump and EOR files: | 
| 549 | 
+ | 
    std::string rawMetaData_; | 
| 550 | 
+ | 
 | 
| 551 | 
  | 
    //file names | 
| 552 | 
  | 
    std::string finalConfigFileName_; | 
| 553 | 
  | 
    std::string dumpFileName_; | 
| 554 | 
  | 
    std::string statFileName_; | 
| 555 | 
  | 
    std::string restFileName_; | 
| 556 | 
  | 
         | 
| 557 | 
< | 
    double rcut_;       /**< cutoff radius*/ | 
| 558 | 
< | 
    double rsw_;        /**< radius of switching function*/ | 
| 557 | 
> | 
    RealType rcut_;       /**< cutoff radius*/ | 
| 558 | 
> | 
    RealType rsw_;        /**< radius of switching function*/ | 
| 559 | 
> | 
    RealType rlist_;      /**< neighbor list radius */ | 
| 560 | 
  | 
 | 
| 561 | 
< | 
    bool fortranInitialized_; /**< flag indicate whether fortran side is initialized */ | 
| 561 | 
> | 
    bool ljsp_; /**< use shifted potential for LJ*/ | 
| 562 | 
> | 
    bool ljsf_; /**< use shifted force for LJ*/ | 
| 563 | 
  | 
 | 
| 564 | 
< | 
#ifdef IS_MPI | 
| 564 | 
> | 
    bool fortranInitialized_; /**< flag indicate whether fortran side  | 
| 565 | 
> | 
                                 is initialized */ | 
| 566 | 
> | 
     | 
| 567 | 
> | 
    bool calcBoxDipole_; /**< flag to indicate whether or not we calculate  | 
| 568 | 
> | 
                            the simulation box dipole moment */ | 
| 569 | 
> | 
     | 
| 570 | 
> | 
    bool useAtomicVirial_; /**< flag to indicate whether or not we use  | 
| 571 | 
> | 
                              Atomic Virials to calculate the pressure */ | 
| 572 | 
> | 
 | 
| 573 | 
> | 
    public: | 
| 574 | 
> | 
     /** | 
| 575 | 
> | 
      * return an integral objects by its global index. In MPI version, if the StuntDouble with specified | 
| 576 | 
> | 
      * global index does not belong to local processor, a NULL will be return. | 
| 577 | 
> | 
      */ | 
| 578 | 
> | 
      StuntDouble* getIOIndexToIntegrableObject(int index); | 
| 579 | 
> | 
      void setIOIndexToIntegrableObject(const std::vector<StuntDouble*>& v); | 
| 580 | 
> | 
    private: | 
| 581 | 
> | 
      std::vector<StuntDouble*> IOIndexToIntegrableObject; | 
| 582 | 
> | 
  //public: | 
| 583 | 
> | 
    //void setStuntDoubleFromGlobalIndex(std::vector<StuntDouble*> v); | 
| 584 | 
> | 
    /** | 
| 585 | 
> | 
     * return a StuntDouble by its global index. In MPI version, if the StuntDouble with specified | 
| 586 | 
> | 
     * global index does not belong to local processor, a NULL will be return. | 
| 587 | 
> | 
     */ | 
| 588 | 
> | 
    //StuntDouble* getStuntDoubleFromGlobalIndex(int index); | 
| 589 | 
> | 
  //private: | 
| 590 | 
> | 
    //std::vector<StuntDouble*> sdByGlobalIndex_; | 
| 591 | 
> | 
     | 
| 592 | 
  | 
    //in Parallel version, we need MolToProc | 
| 593 | 
  | 
  public: | 
| 594 | 
  | 
                 | 
| 615 | 
  | 
    void setupFortranParallel(); | 
| 616 | 
  | 
         | 
| 617 | 
  | 
    /**  | 
| 618 | 
< | 
     * The size of molToProcMap_ is equal to total number of molecules in the system. | 
| 619 | 
< | 
     *  It maps a molecule to the processor on which it resides. it is filled by SimCreator once and only | 
| 620 | 
< | 
     * once. | 
| 618 | 
> | 
     * The size of molToProcMap_ is equal to total number of molecules | 
| 619 | 
> | 
     * in the system.  It maps a molecule to the processor on which it | 
| 620 | 
> | 
     * resides. it is filled by SimCreator once and only once. | 
| 621 | 
  | 
     */         | 
| 622 | 
  | 
    std::vector<int> molToProcMap_;  | 
| 623 | 
  | 
 | 
| 546 | 
– | 
#endif | 
| 624 | 
  | 
 | 
| 625 | 
  | 
  }; | 
| 626 | 
  | 
 |