| 64 | 
  | 
#include "utils/LocalIndexManager.hpp" | 
| 65 | 
  | 
#include "nonbonded/SwitchingFunction.hpp" | 
| 66 | 
  | 
 | 
| 67 | 
– | 
//another nonsense macro declaration | 
| 68 | 
– | 
#define __OPENMD_C | 
| 69 | 
– | 
#include "brains/fSimulation.h" | 
| 70 | 
– | 
 | 
| 67 | 
  | 
using namespace std; | 
| 68 | 
  | 
namespace OpenMD{ | 
| 69 | 
< | 
  enum CutoffMethod { | 
| 74 | 
< | 
    HARD, | 
| 75 | 
< | 
    SWITCHING_FUNCTION, | 
| 76 | 
< | 
    SHIFTED_POTENTIAL, | 
| 77 | 
< | 
    SHIFTED_FORCE | 
| 78 | 
< | 
  }; | 
| 79 | 
< | 
 | 
| 80 | 
< | 
  //forward decalration  | 
| 69 | 
> | 
  //forward declaration  | 
| 70 | 
  | 
  class SnapshotManager; | 
| 71 | 
  | 
  class Molecule; | 
| 72 | 
  | 
  class SelectionManager; | 
| 295 | 
  | 
    /** Overloaded version of gyrational volume that also returns | 
| 296 | 
  | 
        det(I) so dV/dr can be calculated*/ | 
| 297 | 
  | 
    void getGyrationalVolume(RealType &vol, RealType &detI); | 
| 298 | 
< | 
    /** main driver function to interact with fortran during the | 
| 310 | 
< | 
        initialization and molecule migration */ | 
| 298 | 
> | 
 | 
| 299 | 
  | 
    void update(); | 
| 300 | 
+ | 
    /** | 
| 301 | 
+ | 
     * Do final bookkeeping before Force managers need their data. | 
| 302 | 
+ | 
     */ | 
| 303 | 
+ | 
    void prepareTopology(); | 
| 304 | 
  | 
 | 
| 305 | 
+ | 
 | 
| 306 | 
  | 
    /** Returns the local index manager */ | 
| 307 | 
  | 
    LocalIndexManager* getLocalIndexManager() { | 
| 308 | 
  | 
      return &localIndexMan_; | 
| 338 | 
  | 
      return globalMolMembership_[id]; | 
| 339 | 
  | 
    } | 
| 340 | 
  | 
 | 
| 341 | 
< | 
    RealType getCutoffRadius() { | 
| 342 | 
< | 
      return cutoffRadius_; | 
| 343 | 
< | 
    } | 
| 341 | 
> | 
    /**  | 
| 342 | 
> | 
     * returns a vector which maps the local atom index on this | 
| 343 | 
> | 
     * processor to the global atom index.  With only one processor, | 
| 344 | 
> | 
     * these should be identical. | 
| 345 | 
> | 
     */ | 
| 346 | 
> | 
    vector<int> getGlobalAtomIndices(); | 
| 347 | 
  | 
 | 
| 348 | 
< | 
    RealType getSwitchingRadius() { | 
| 349 | 
< | 
      return switchingRadius_; | 
| 350 | 
< | 
    } | 
| 348 | 
> | 
    /**  | 
| 349 | 
> | 
     * returns a vector which maps the local cutoff group index on | 
| 350 | 
> | 
     * this processor to the global cutoff group index.  With only one | 
| 351 | 
> | 
     * processor, these should be identical. | 
| 352 | 
> | 
     */ | 
| 353 | 
> | 
    vector<int> getGlobalGroupIndices(); | 
| 354 | 
  | 
 | 
| 356 | 
– | 
    RealType getListRadius() { | 
| 357 | 
– | 
      return listRadius_; | 
| 358 | 
– | 
    } | 
| 355 | 
  | 
         | 
| 356 | 
  | 
    string getFinalConfigFileName() { | 
| 357 | 
  | 
      return finalConfigFileName_; | 
| 411 | 
  | 
    } | 
| 412 | 
  | 
 | 
| 413 | 
  | 
 | 
| 414 | 
< | 
    bool isFortranInitialized() { | 
| 415 | 
< | 
      return fortranInitialized_; | 
| 414 | 
> | 
    bool isTopologyDone() { | 
| 415 | 
> | 
      return topologyDone_; | 
| 416 | 
  | 
    } | 
| 417 | 
  | 
         | 
| 418 | 
  | 
    bool getCalcBoxDipole() { | 
| 472 | 
  | 
     */ | 
| 473 | 
  | 
    void removeInteractionPairs(Molecule* mol); | 
| 474 | 
  | 
 | 
| 479 | 
– | 
 | 
| 480 | 
– | 
    /** Returns the unique atom types of local processor in an array */ | 
| 481 | 
– | 
    set<AtomType*> getUniqueAtomTypes(); | 
| 482 | 
– | 
 | 
| 475 | 
  | 
    /** Returns the set of atom types present in this simulation */ | 
| 476 | 
  | 
    set<AtomType*> getSimulatedAtomTypes(); | 
| 477 | 
  | 
         | 
| 484 | 
  | 
    /** fill up the simtype struct and other simulation-related variables */ | 
| 485 | 
  | 
    void setupSimVariables(); | 
| 486 | 
  | 
 | 
| 495 | 
– | 
    /** | 
| 496 | 
– | 
     * Setup Fortran Simulation | 
| 497 | 
– | 
     * @see #setupFortranParallel | 
| 498 | 
– | 
     */ | 
| 499 | 
– | 
    void setupFortranSim(); | 
| 500 | 
– | 
 | 
| 501 | 
– | 
    /** Figure out the cutoff radius and cutoff method */ | 
| 502 | 
– | 
    void setupCutoffs(); | 
| 503 | 
– | 
    /** Figure out the switching radius and polynomial type for the switching function */ | 
| 504 | 
– | 
    void setupSwitching(); | 
| 505 | 
– | 
    /** Figure out the simulation variables associated with electrostatics */ | 
| 506 | 
– | 
    void setupElectrostatics();    | 
| 507 | 
– | 
    /** Figure out the neighbor list skin thickness */ | 
| 508 | 
– | 
    void setupNeighborlists(); | 
| 487 | 
  | 
 | 
| 488 | 
  | 
    /** Determine if we need to accumulate the simulation box dipole */ | 
| 489 | 
  | 
    void setupAccumulateBoxDipole(); | 
| 539 | 
  | 
    bool requiresSkipCorrection_; /**< does this simulation require a skip-correction? */ | 
| 540 | 
  | 
    bool requiresSelfCorrection_; /**< does this simulation require a self-correction? */ | 
| 541 | 
  | 
 | 
| 542 | 
+ | 
  public: | 
| 543 | 
+ | 
    bool usesElectrostaticAtoms() { return usesElectrostaticAtoms_; } | 
| 544 | 
+ | 
    bool usesDirectionalAtoms() { return usesDirectionalAtoms_; } | 
| 545 | 
+ | 
    bool usesMetallicAtoms() { return usesMetallicAtoms_; } | 
| 546 | 
+ | 
    bool usesAtomicVirial() { return usesAtomicVirial_; } | 
| 547 | 
+ | 
    bool requiresPrepair() { return requiresPrepair_; } | 
| 548 | 
+ | 
    bool requiresSkipCorrection() { return requiresSkipCorrection_;} | 
| 549 | 
+ | 
    bool requiresSelfCorrection() { return requiresSelfCorrection_;} | 
| 550 | 
+ | 
 | 
| 551 | 
+ | 
  private: | 
| 552 | 
  | 
    /// Data structures holding primary simulation objects | 
| 553 | 
  | 
    map<int, Molecule*>  molecules_;  /**< map holding pointers to LOCAL molecules */ | 
| 554 | 
< | 
    simtype fInfo_;                   /**< A dual struct shared by C++ | 
| 567 | 
< | 
                                         and Fortran to pass | 
| 568 | 
< | 
                                         information about what types | 
| 569 | 
< | 
                                         of calculation are | 
| 570 | 
< | 
                                         required */ | 
| 571 | 
< | 
     | 
| 554 | 
> | 
 | 
| 555 | 
  | 
    /// Stamps are templates for objects that are then used to create | 
| 556 | 
  | 
    /// groups of objects.  For example, a molecule stamp contains | 
| 557 | 
  | 
    /// information on how to build that molecule (i.e. the topology, | 
| 567 | 
  | 
     * the simulation.  It should be nGlobalAtoms_ in size. | 
| 568 | 
  | 
     */ | 
| 569 | 
  | 
    vector<int> globalGroupMembership_;  | 
| 570 | 
+ | 
  public: | 
| 571 | 
+ | 
    vector<int> getGlobalGroupMembership() { return globalGroupMembership_; } | 
| 572 | 
+ | 
  private: | 
| 573 | 
  | 
 | 
| 574 | 
  | 
    /** | 
| 575 | 
  | 
     * A vector that maps between the global index of an atom and the | 
| 577 | 
  | 
     * by SimCreator once and only once, since it is never changed | 
| 578 | 
  | 
     * during the simulation. It shoudl be nGlobalAtoms_ in size. | 
| 579 | 
  | 
     */ | 
| 580 | 
< | 
    vector<int> globalMolMembership_;         | 
| 580 | 
> | 
    vector<int> globalMolMembership_;  | 
| 581 | 
> | 
 | 
| 582 | 
> | 
    /**  | 
| 583 | 
> | 
     * A vector that maps between the local index of an atom and the | 
| 584 | 
> | 
     * index of the AtomType. | 
| 585 | 
> | 
     */ | 
| 586 | 
> | 
    vector<int> identArray_; | 
| 587 | 
> | 
  public: | 
| 588 | 
> | 
    vector<int> getIdentArray() { return identArray_; } | 
| 589 | 
> | 
  private: | 
| 590 | 
> | 
     | 
| 591 | 
> | 
    /**  | 
| 592 | 
> | 
     * A vector which contains the fractional contribution of an | 
| 593 | 
> | 
     * atom's mass to the total mass of the cutoffGroup that atom | 
| 594 | 
> | 
     * belongs to.  In the case of single atom cutoff groups, the mass | 
| 595 | 
> | 
     * factor for that atom is 1.  For massless atoms, the factor is | 
| 596 | 
> | 
     * also 1. | 
| 597 | 
> | 
     */ | 
| 598 | 
> | 
    vector<RealType> massFactors_; | 
| 599 | 
> | 
  public: | 
| 600 | 
> | 
    vector<RealType> getMassFactors() { return massFactors_; } | 
| 601 | 
> | 
 | 
| 602 | 
> | 
    PairList getExcludedInteractions() { return excludedInteractions_; } | 
| 603 | 
> | 
    PairList getOneTwoInteractions() { return oneTwoInteractions_; } | 
| 604 | 
> | 
    PairList getOneThreeInteractions() { return oneThreeInteractions_; } | 
| 605 | 
> | 
    PairList getOneFourInteractions() { return oneFourInteractions_; } | 
| 606 | 
> | 
 | 
| 607 | 
> | 
  private: | 
| 608 | 
> | 
 | 
| 609 | 
  | 
                | 
| 610 | 
  | 
    /// lists to handle atoms needing special treatment in the non-bonded interactions | 
| 611 | 
  | 
    PairList excludedInteractions_;  /**< atoms excluded from interacting with each other */ | 
| 635 | 
  | 
    string statFileName_; | 
| 636 | 
  | 
    string restFileName_; | 
| 637 | 
  | 
         | 
| 624 | 
– | 
    RealType cutoffRadius_;         /**< cutoff radius for non-bonded interactions */ | 
| 625 | 
– | 
    RealType switchingRadius_;      /**< inner radius of switching function */ | 
| 626 | 
– | 
    RealType listRadius_;           /**< Verlet neighbor list radius */ | 
| 627 | 
– | 
    RealType skinThickness_;        /**< Verlet neighbor list skin thickness */     | 
| 628 | 
– | 
    CutoffMethod cutoffMethod_;     /**< Cutoff Method for most non-bonded interactions */ | 
| 629 | 
– | 
    SwitchingFunctionType sft_;     /**< Type of switching function in use */ | 
| 638 | 
  | 
 | 
| 639 | 
< | 
    bool fortranInitialized_; /** flag to indicate whether the fortran side is initialized */ | 
| 639 | 
> | 
    bool topologyDone_;  /** flag to indicate whether the topology has | 
| 640 | 
> | 
                             been scanned and all the relevant | 
| 641 | 
> | 
                             bookkeeping has been done*/ | 
| 642 | 
  | 
     | 
| 643 | 
  | 
    bool calcBoxDipole_; /**< flag to indicate whether or not we calculate  | 
| 644 | 
  | 
                            the simulation box dipole moment */ | 
| 679 | 
  | 
    } | 
| 680 | 
  | 
         | 
| 681 | 
  | 
  private: | 
| 672 | 
– | 
 | 
| 673 | 
– | 
    void setupFortranParallel(); | 
| 682 | 
  | 
         | 
| 683 | 
  | 
    /**  | 
| 684 | 
  | 
     * The size of molToProcMap_ is equal to total number of molecules |