ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/brains/SimInfo.hpp
(Generate patch)

Comparing trunk/src/brains/SimInfo.hpp (file contents):
Revision 598 by chrisfen, Thu Sep 15 00:14:35 2005 UTC vs.
Revision 1287 by gezelter, Wed Sep 10 18:11:32 2008 UTC

# Line 54 | Line 54
54   #include <utility>
55   #include <vector>
56  
57 < #include "brains/Exclude.hpp"
57 > #include "brains/PairList.hpp"
58   #include "io/Globals.hpp"
59   #include "math/Vector3.hpp"
60   #include "math/SquareMatrix3.hpp"
# Line 73 | Line 73 | namespace oopse{
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
85 <   * cutoff group.
85 <   */
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, inversions, rigid bodies, cutoff groups,
82 >    * constraints). 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:
88      typedef std::map<int, Molecule*>::iterator  MoleculeIterator;
# Line 95 | Line 95 | namespace oopse{
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      /**
# Line 171 | Line 171 | namespace oopse{
171        return nTorsions_;
172      }
173  
174 +    /** Returns the number of local torsions */        
175 +    unsigned int getNInversions() {
176 +      return nInversions_;
177 +    }
178      /** Returns the number of local rigid bodies */        
179      unsigned int getNRigidBodies() {
180        return nRigidBodies_;
# Line 207 | Line 211 | namespace oopse{
211  
212      /** Returns the number of degrees of freedom */
213      int getNdf() {
214 <      return ndf_;
214 >      return ndf_ - getFdf();
215      }
216  
217      /** Returns the number of raw degrees of freedom */
# Line 220 | Line 224 | namespace oopse{
224        return ndfTrans_;
225      }
226  
227 +    /** sets the current number of frozen degrees of freedom */
228 +    void setFdf(int fdf) {
229 +      fdf_local = fdf;
230 +    }
231 +
232 +    int getFdf();
233 +    
234      //getNZconstraint and setNZconstraint ruin the coherent of SimInfo class, need refactorying
235          
236      /** Returns the total number of z-constraint molecules in the system */
# Line 265 | Line 276 | namespace oopse{
276      /** Returns system angular momentum */
277      Vector3d getAngularMomentum();
278  
279 +    /** Returns volume of system as estimated by an ellipsoid defined by the radii of gyration*/
280 +    void getGyrationalVolume(RealType &vol);
281 +    /** Overloaded version of gyrational volume that also returns det(I) so dV/dr can be calculated*/
282 +    void getGyrationalVolume(RealType &vol, RealType &detI);
283      /** main driver function to interact with fortran during the initialization and molecule migration */
284      void update();
285  
# Line 299 | Line 314 | namespace oopse{
314        return i != molecules_.end() ? i->second : NULL;
315      }
316  
317 <    /** Calculate the maximum cutoff radius based on the atom types */
303 <    double calcMaxCutoffRadius();
304 <
305 <    double getRcut() {
317 >    RealType getRcut() {
318        return rcut_;
319      }
320  
321 <    double getRsw() {
321 >    RealType getRsw() {
322        return rsw_;
323 +    }
324 +
325 +    RealType getList() {
326 +      return rlist_;
327      }
328          
329      std::string getFinalConfigFileName() {
330        return finalConfigFileName_;
331      }
332 <        
332 >
333      void setFinalConfigFileName(const std::string& fileName) {
334        finalConfigFileName_ = fileName;
335      }
336  
337 +    std::string getRawMetaData() {
338 +      return rawMetaData_;
339 +    }
340 +    void setRawMetaData(const std::string& rawMetaData) {
341 +      rawMetaData_ = rawMetaData;
342 +    }
343 +        
344      std::string getDumpFileName() {
345        return dumpFileName_;
346      }
# Line 347 | Line 370 | namespace oopse{
370       * @see #SimCreator::setGlobalIndex
371       */  
372      void setGlobalGroupMembership(const std::vector<int>& globalGroupMembership) {
373 <      assert(globalGroupMembership.size() == nGlobalAtoms_);
373 >      assert(globalGroupMembership.size() == static_cast<size_t>(nGlobalAtoms_));
374        globalGroupMembership_ = globalGroupMembership;
375      }
376  
# Line 356 | Line 379 | namespace oopse{
379       * @see #SimCreator::setGlobalIndex
380       */        
381      void setGlobalMolMembership(const std::vector<int>& globalMolMembership) {
382 <      assert(globalMolMembership.size() == nGlobalAtoms_);
382 >      assert(globalMolMembership.size() == static_cast<size_t>(nGlobalAtoms_));
383        globalMolMembership_ = globalMolMembership;
384      }
385  
# Line 365 | Line 388 | namespace oopse{
388        return fortranInitialized_;
389      }
390          
391 +    bool getCalcBoxDipole() {
392 +      return calcBoxDipole_;
393 +    }
394 +
395 +    bool getUseAtomicVirial() {
396 +      return useAtomicVirial_;
397 +    }
398 +
399      //below functions are just forward functions
400      //To compose or to inherit is always a hot debate. In general, is-a relation need subclassing, in the
401      //the other hand, has-a relation need composing.
# Line 406 | Line 437 | namespace oopse{
437      GenericData* getPropertyByName(const std::string& propName);
438  
439      /**
440 <     * add all exclude pairs of a molecule into exclude list.
440 >     * add all special interaction pairs (including excluded
441 >     * interactions) in a molecule into the appropriate lists.
442       */
443 <    void addExcludePairs(Molecule* mol);
443 >    void addInteractionPairs(Molecule* mol);
444  
445      /**
446 <     * remove all exclude pairs which belong to a molecule from exclude list
446 >     * remove all special interaction pairs which belong to a molecule
447 >     * from the appropriate lists.
448       */
449 +    void removeInteractionPairs(Molecule* mol);
450  
417    void removeExcludePairs(Molecule* mol);
451  
419
452      /** Returns the unique atom types of local processor in an array */
453      std::set<AtomType*> getUniqueAtomTypes();
454          
455      friend std::ostream& operator <<(std::ostream& o, SimInfo& info);
456  
457 <    void getCutoff(double& rcut, double& rsw);
457 >    void getCutoff(RealType& rcut, RealType& rsw);
458          
459    private:
460  
# Line 439 | Line 471 | namespace oopse{
471      void setupCutoff();
472  
473      /** Figure out which coulombic correction method to use and pass to fortran */
474 <    void setupCoulombicCorrection( int isError );
474 >    void setupElectrostaticSummationMethod( int isError );
475 >
476 >    /** Figure out which polynomial type to use for the switching function */
477 >    void setupSwitchingFunction();
478 >
479 >    /** Determine if we need to accumulate the simulation box dipole */
480 >    void setupAccumulateBoxDipole();
481  
482      /** Calculates the number of degress of freedom in the whole system */
483      void calcNdf();
484      void calcNdfRaw();
485      void calcNdfTrans();
486  
487 +    ForceField* forceField_;      
488 +    Globals* simParams_;
489 +
490 +    std::map<int, Molecule*>  molecules_; /**< Molecule array */
491 +
492      /**
493       * Adds molecule stamp and the total number of the molecule with same molecule stamp in the whole
494       * system.
495       */
496      void addMoleculeStamp(MoleculeStamp* molStamp, int nmol);
454
455    MakeStamps* stamps_;
456    ForceField* forceField_;      
457    Globals* simParams_;
458
459    std::map<int, Molecule*>  molecules_; /**< Molecule array */
497          
498      //degress of freedom
499      int ndf_;           /**< number of degress of freedom (excludes constraints),  ndf_ is local */
500 +    int fdf_local;       /**< number of frozen degrees of freedom */
501 +    int fdf_;            /**< number of frozen degrees of freedom */
502      int ndfRaw_;    /**< number of degress of freedom (includes constraints),  ndfRaw_ is local */
503      int ndfTrans_; /**< number of translation degress of freedom, ndfTrans_ is local */
504      int nZconstraint_; /** number of  z-constraint molecules, nZconstraint_ is global */
# Line 489 | Line 528 | namespace oopse{
528      std::vector<MoleculeStamp*> moleculeStamps_;      /**< molecule stamps array */        
529          
530      //number of local objects
531 <    int nAtoms_;                        /**< number of atoms in local processor */
532 <    int nBonds_;                        /**< number of bonds in local processor */
533 <    int nBends_;                        /**< number of bends in local processor */
534 <    int nTorsions_;                    /**< number of torsions in local processor */
535 <    int nRigidBodies_;              /**< number of rigid bodies in local processor */
536 <    int nIntegrableObjects_;    /**< number of integrable objects in local processor */
537 <    int nCutoffGroups_;             /**< number of cutoff groups in local processor */
538 <    int nConstraints_;              /**< number of constraints in local processors */
531 >    int nAtoms_;              /**< number of atoms in local processor */
532 >    int nBonds_;              /**< number of bonds in local processor */
533 >    int nBends_;              /**< number of bends in local processor */
534 >    int nTorsions_;           /**< number of torsions in local processor */
535 >    int nInversions_;         /**< number of inversions in local processor */
536 >    int nRigidBodies_;        /**< number of rigid bodies in local processor */
537 >    int nIntegrableObjects_;  /**< number of integrable objects in local processor */
538 >    int nCutoffGroups_;       /**< number of cutoff groups in local processor */
539 >    int nConstraints_;        /**< number of constraints in local processors */
540  
541      simtype fInfo_; /**< A dual struct shared by c++/fortran which indicates the atom types in simulation*/
542 <    Exclude exclude_;      
542 >    PairList excludedInteractions_;      
543 >    PairList oneTwoInteractions_;      
544 >    PairList oneThreeInteractions_;      
545 >    PairList oneFourInteractions_;      
546      PropertyMap properties_;                  /**< Generic Property */
547      SnapshotManager* sman_;               /**< SnapshotManager */
548  
# Line 511 | Line 554 | namespace oopse{
554       */        
555      LocalIndexManager localIndexMan_;
556  
557 +    // unparsed MetaData block for storing in Dump and EOR files:
558 +    std::string rawMetaData_;
559 +
560      //file names
561      std::string finalConfigFileName_;
562      std::string dumpFileName_;
563      std::string statFileName_;
564      std::string restFileName_;
565          
566 <    double rcut_;       /**< cutoff radius*/
567 <    double rsw_;        /**< radius of switching function*/
566 >    RealType rcut_;       /**< cutoff radius*/
567 >    RealType rsw_;        /**< radius of switching function*/
568 >    RealType rlist_;      /**< neighbor list radius */
569  
570 <    bool fortranInitialized_; /**< flag indicate whether fortran side is initialized */
570 >    bool ljsp_; /**< use shifted potential for LJ*/
571 >    bool ljsf_; /**< use shifted force for LJ*/
572  
573 < #ifdef IS_MPI
573 >    bool fortranInitialized_; /**< flag indicate whether fortran side
574 >                                 is initialized */
575 >    
576 >    bool calcBoxDipole_; /**< flag to indicate whether or not we calculate
577 >                            the simulation box dipole moment */
578 >    
579 >    bool useAtomicVirial_; /**< flag to indicate whether or not we use
580 >                              Atomic Virials to calculate the pressure */
581 >
582 >    public:
583 >     /**
584 >      * return an integral objects by its global index. In MPI version, if the StuntDouble with specified
585 >      * global index does not belong to local processor, a NULL will be return.
586 >      */
587 >      StuntDouble* getIOIndexToIntegrableObject(int index);
588 >      void setIOIndexToIntegrableObject(const std::vector<StuntDouble*>& v);
589 >    private:
590 >      std::vector<StuntDouble*> IOIndexToIntegrableObject;
591 >  //public:
592 >    //void setStuntDoubleFromGlobalIndex(std::vector<StuntDouble*> v);
593 >    /**
594 >     * return a StuntDouble by its global index. In MPI version, if the StuntDouble with specified
595 >     * global index does not belong to local processor, a NULL will be return.
596 >     */
597 >    //StuntDouble* getStuntDoubleFromGlobalIndex(int index);
598 >  //private:
599 >    //std::vector<StuntDouble*> sdByGlobalIndex_;
600 >    
601      //in Parallel version, we need MolToProc
602    public:
603                  
# Line 549 | Line 624 | namespace oopse{
624      void setupFortranParallel();
625          
626      /**
627 <     * The size of molToProcMap_ is equal to total number of molecules in the system.
628 <     *  It maps a molecule to the processor on which it resides. it is filled by SimCreator once and only
629 <     * once.
627 >     * The size of molToProcMap_ is equal to total number of molecules
628 >     * in the system.  It maps a molecule to the processor on which it
629 >     * resides. it is filled by SimCreator once and only once.
630       */        
631      std::vector<int> molToProcMap_;
632  
558 #endif
633  
634    };
635  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines