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

Comparing:
trunk/src/brains/SimInfo.cpp (file contents), Revision 1129 by chrisfen, Fri Apr 20 18:15:48 2007 UTC vs.
branches/development/src/brains/SimInfo.cpp (file contents), Revision 1505 by gezelter, Sun Oct 3 22:18:59 2010 UTC

# Line 6 | Line 6
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.
# Line 37 | Line 28
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]  Vardeman & Gezelter, in progress (2009).                        
40   */
41  
42   /**
# Line 55 | Line 55
55   #include "primitives/Molecule.hpp"
56   #include "primitives/StuntDouble.hpp"
57   #include "UseTheForce/fCutoffPolicy.h"
58 #include "UseTheForce/DarkSide/fElectrostaticSummationMethod.h"
59 #include "UseTheForce/DarkSide/fElectrostaticScreeningMethod.h"
58   #include "UseTheForce/DarkSide/fSwitchingFunctionType.h"
59   #include "UseTheForce/doForces_interface.h"
60   #include "UseTheForce/DarkSide/neighborLists_interface.h"
63 #include "UseTheForce/DarkSide/electrostatic_interface.h"
61   #include "UseTheForce/DarkSide/switcheroo_interface.h"
62   #include "utils/MemoryUtils.hpp"
63   #include "utils/simError.h"
# Line 74 | Line 71
71   #include "UseTheForce/DarkSide/simParallel_interface.h"
72   #endif
73  
74 < namespace oopse {
74 > namespace OpenMD {
75    std::set<int> getRigidSet(int index, std::map<int, std::set<int> >& container) {
76      std::map<int, std::set<int> >::iterator i = container.find(index);
77      std::set<int> result;
# Line 90 | Line 87 | namespace oopse {
87      ndf_(0), fdf_local(0), ndfRaw_(0), ndfTrans_(0), nZconstraint_(0),
88      nGlobalMols_(0), nGlobalAtoms_(0), nGlobalCutoffGroups_(0),
89      nGlobalIntegrableObjects_(0), nGlobalRigidBodies_(0),
90 <    nAtoms_(0), nBonds_(0),  nBends_(0), nTorsions_(0), nRigidBodies_(0),
91 <    nIntegrableObjects_(0),  nCutoffGroups_(0), nConstraints_(0),
92 <    sman_(NULL), fortranInitialized_(false), calcBoxDipole_(false),
93 <    useAtomicVirial_(true) {
90 >    nAtoms_(0), nBonds_(0),  nBends_(0), nTorsions_(0), nInversions_(0),
91 >    nRigidBodies_(0), nIntegrableObjects_(0), nCutoffGroups_(0),
92 >    nConstraints_(0), sman_(NULL), fortranInitialized_(false),
93 >    calcBoxDipole_(false), useAtomicVirial_(true) {
94 >
95  
96        MoleculeStamp* molStamp;
97        int nMolWithSameStamp;
# Line 102 | Line 100 | namespace oopse {
100        CutoffGroupStamp* cgStamp;    
101        RigidBodyStamp* rbStamp;
102        int nRigidAtoms = 0;
103 +
104        std::vector<Component*> components = simParams->getComponents();
105        
106        for (std::vector<Component*>::iterator i = components.begin(); i !=components.end(); ++i) {
# Line 156 | Line 155 | namespace oopse {
155                                                  + nGlobalRigidBodies_;
156    
157        nGlobalMols_ = molStampIds_.size();
159
160 #ifdef IS_MPI    
158        molToProcMap_.resize(nGlobalMols_);
162 #endif
163
159      }
160  
161    SimInfo::~SimInfo() {
# Line 198 | Line 193 | namespace oopse {
193        nBonds_ += mol->getNBonds();
194        nBends_ += mol->getNBends();
195        nTorsions_ += mol->getNTorsions();
196 +      nInversions_ += mol->getNInversions();
197        nRigidBodies_ += mol->getNRigidBodies();
198        nIntegrableObjects_ += mol->getNIntegrableObjects();
199        nCutoffGroups_ += mol->getNCutoffGroups();
200        nConstraints_ += mol->getNConstraintPairs();
201  
202 <      addExcludePairs(mol);
203 <        
202 >      addInteractionPairs(mol);
203 >  
204        return true;
205      } else {
206        return false;
# Line 223 | Line 219 | namespace oopse {
219        nBonds_ -= mol->getNBonds();
220        nBends_ -= mol->getNBends();
221        nTorsions_ -= mol->getNTorsions();
222 +      nInversions_ -= mol->getNInversions();
223        nRigidBodies_ -= mol->getNRigidBodies();
224        nIntegrableObjects_ -= mol->getNIntegrableObjects();
225        nCutoffGroups_ -= mol->getNCutoffGroups();
226        nConstraints_ -= mol->getNConstraintPairs();
227  
228 <      removeExcludePairs(mol);
228 >      removeInteractionPairs(mol);
229        molecules_.erase(mol->getGlobalIndex());
230  
231        delete mol;
# Line 354 | Line 351 | namespace oopse {
351  
352    }
353  
354 <  void SimInfo::addExcludePairs(Molecule* mol) {
354 >  void SimInfo::addInteractionPairs(Molecule* mol) {
355 >    ForceFieldOptions& options_ = forceField_->getForceFieldOptions();
356      std::vector<Bond*>::iterator bondIter;
357      std::vector<Bend*>::iterator bendIter;
358      std::vector<Torsion*>::iterator torsionIter;
359 +    std::vector<Inversion*>::iterator inversionIter;
360      Bond* bond;
361      Bend* bend;
362      Torsion* torsion;
363 +    Inversion* inversion;
364      int a;
365      int b;
366      int c;
367      int d;
368  
369 <    std::map<int, std::set<int> > atomGroups;
369 >    // atomGroups can be used to add special interaction maps between
370 >    // groups of atoms that are in two separate rigid bodies.
371 >    // However, most site-site interactions between two rigid bodies
372 >    // are probably not special, just the ones between the physically
373 >    // bonded atoms.  Interactions *within* a single rigid body should
374 >    // always be excluded.  These are done at the bottom of this
375 >    // function.
376  
377 +    std::map<int, std::set<int> > atomGroups;
378      Molecule::RigidBodyIterator rbIter;
379      RigidBody* rb;
380      Molecule::IntegrableObjectIterator ii;
381      StuntDouble* integrableObject;
382      
383 <    for (integrableObject = mol->beginIntegrableObject(ii); integrableObject != NULL;
384 <           integrableObject = mol->nextIntegrableObject(ii)) {
385 <
383 >    for (integrableObject = mol->beginIntegrableObject(ii);
384 >         integrableObject != NULL;
385 >         integrableObject = mol->nextIntegrableObject(ii)) {
386 >      
387        if (integrableObject->isRigidBody()) {
388 <          rb = static_cast<RigidBody*>(integrableObject);
389 <          std::vector<Atom*> atoms = rb->getAtoms();
390 <          std::set<int> rigidAtoms;
391 <          for (int i = 0; i < atoms.size(); ++i) {
392 <            rigidAtoms.insert(atoms[i]->getGlobalIndex());
393 <          }
394 <          for (int i = 0; i < atoms.size(); ++i) {
395 <            atomGroups.insert(std::map<int, std::set<int> >::value_type(atoms[i]->getGlobalIndex(), rigidAtoms));
396 <          }      
388 >        rb = static_cast<RigidBody*>(integrableObject);
389 >        std::vector<Atom*> atoms = rb->getAtoms();
390 >        std::set<int> rigidAtoms;
391 >        for (int i = 0; i < static_cast<int>(atoms.size()); ++i) {
392 >          rigidAtoms.insert(atoms[i]->getGlobalIndex());
393 >        }
394 >        for (int i = 0; i < static_cast<int>(atoms.size()); ++i) {
395 >          atomGroups.insert(std::map<int, std::set<int> >::value_type(atoms[i]->getGlobalIndex(), rigidAtoms));
396 >        }      
397        } else {
398          std::set<int> oneAtomSet;
399          oneAtomSet.insert(integrableObject->getGlobalIndex());
400          atomGroups.insert(std::map<int, std::set<int> >::value_type(integrableObject->getGlobalIndex(), oneAtomSet));        
401        }
402      }  
403 +          
404 +    for (bond= mol->beginBond(bondIter); bond != NULL;
405 +         bond = mol->nextBond(bondIter)) {
406  
396    
397    
398    for (bond= mol->beginBond(bondIter); bond != NULL; bond = mol->nextBond(bondIter)) {
407        a = bond->getAtomA()->getGlobalIndex();
408 <      b = bond->getAtomB()->getGlobalIndex();        
409 <      exclude_.addPair(a, b);
408 >      b = bond->getAtomB()->getGlobalIndex();  
409 >    
410 >      if (options_.havevdw12scale() || options_.haveelectrostatic12scale()) {
411 >        oneTwoInteractions_.addPair(a, b);
412 >      } else {
413 >        excludedInteractions_.addPair(a, b);
414 >      }
415      }
416  
417 <    for (bend= mol->beginBend(bendIter); bend != NULL; bend = mol->nextBend(bendIter)) {
417 >    for (bend= mol->beginBend(bendIter); bend != NULL;
418 >         bend = mol->nextBend(bendIter)) {
419 >
420        a = bend->getAtomA()->getGlobalIndex();
421        b = bend->getAtomB()->getGlobalIndex();        
422        c = bend->getAtomC()->getGlobalIndex();
408      std::set<int> rigidSetA = getRigidSet(a, atomGroups);
409      std::set<int> rigidSetB = getRigidSet(b, atomGroups);
410      std::set<int> rigidSetC = getRigidSet(c, atomGroups);
411
412      exclude_.addPairs(rigidSetA, rigidSetB);
413      exclude_.addPairs(rigidSetA, rigidSetC);
414      exclude_.addPairs(rigidSetB, rigidSetC);
423        
424 <      //exclude_.addPair(a, b);
425 <      //exclude_.addPair(a, c);
426 <      //exclude_.addPair(b, c);        
424 >      if (options_.havevdw12scale() || options_.haveelectrostatic12scale()) {
425 >        oneTwoInteractions_.addPair(a, b);      
426 >        oneTwoInteractions_.addPair(b, c);
427 >      } else {
428 >        excludedInteractions_.addPair(a, b);
429 >        excludedInteractions_.addPair(b, c);
430 >      }
431 >
432 >      if (options_.havevdw13scale() || options_.haveelectrostatic13scale()) {
433 >        oneThreeInteractions_.addPair(a, c);      
434 >      } else {
435 >        excludedInteractions_.addPair(a, c);
436 >      }
437      }
438  
439 <    for (torsion= mol->beginTorsion(torsionIter); torsion != NULL; torsion = mol->nextTorsion(torsionIter)) {
439 >    for (torsion= mol->beginTorsion(torsionIter); torsion != NULL;
440 >         torsion = mol->nextTorsion(torsionIter)) {
441 >
442        a = torsion->getAtomA()->getGlobalIndex();
443        b = torsion->getAtomB()->getGlobalIndex();        
444        c = torsion->getAtomC()->getGlobalIndex();        
445 <      d = torsion->getAtomD()->getGlobalIndex();        
426 <      std::set<int> rigidSetA = getRigidSet(a, atomGroups);
427 <      std::set<int> rigidSetB = getRigidSet(b, atomGroups);
428 <      std::set<int> rigidSetC = getRigidSet(c, atomGroups);
429 <      std::set<int> rigidSetD = getRigidSet(d, atomGroups);
445 >      d = torsion->getAtomD()->getGlobalIndex();      
446  
447 <      exclude_.addPairs(rigidSetA, rigidSetB);
448 <      exclude_.addPairs(rigidSetA, rigidSetC);
449 <      exclude_.addPairs(rigidSetA, rigidSetD);
450 <      exclude_.addPairs(rigidSetB, rigidSetC);
451 <      exclude_.addPairs(rigidSetB, rigidSetD);
452 <      exclude_.addPairs(rigidSetC, rigidSetD);
447 >      if (options_.havevdw12scale() || options_.haveelectrostatic12scale()) {
448 >        oneTwoInteractions_.addPair(a, b);      
449 >        oneTwoInteractions_.addPair(b, c);
450 >        oneTwoInteractions_.addPair(c, d);
451 >      } else {
452 >        excludedInteractions_.addPair(a, b);
453 >        excludedInteractions_.addPair(b, c);
454 >        excludedInteractions_.addPair(c, d);
455 >      }
456  
457 <      /*
458 <      exclude_.addPairs(rigidSetA.begin(), rigidSetA.end(), rigidSetB.begin(), rigidSetB.end());
459 <      exclude_.addPairs(rigidSetA.begin(), rigidSetA.end(), rigidSetC.begin(), rigidSetC.end());
460 <      exclude_.addPairs(rigidSetA.begin(), rigidSetA.end(), rigidSetD.begin(), rigidSetD.end());
461 <      exclude_.addPairs(rigidSetB.begin(), rigidSetB.end(), rigidSetC.begin(), rigidSetC.end());
462 <      exclude_.addPairs(rigidSetB.begin(), rigidSetB.end(), rigidSetD.begin(), rigidSetD.end());
463 <      exclude_.addPairs(rigidSetC.begin(), rigidSetC.end(), rigidSetD.begin(), rigidSetD.end());
464 <        
465 <      
466 <      exclude_.addPair(a, b);
467 <      exclude_.addPair(a, c);
468 <      exclude_.addPair(a, d);
469 <      exclude_.addPair(b, c);
451 <      exclude_.addPair(b, d);
452 <      exclude_.addPair(c, d);        
453 <      */
457 >      if (options_.havevdw13scale() || options_.haveelectrostatic13scale()) {
458 >        oneThreeInteractions_.addPair(a, c);      
459 >        oneThreeInteractions_.addPair(b, d);      
460 >      } else {
461 >        excludedInteractions_.addPair(a, c);
462 >        excludedInteractions_.addPair(b, d);
463 >      }
464 >
465 >      if (options_.havevdw14scale() || options_.haveelectrostatic14scale()) {
466 >        oneFourInteractions_.addPair(a, d);      
467 >      } else {
468 >        excludedInteractions_.addPair(a, d);
469 >      }
470      }
471  
472 <    for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) {
472 >    for (inversion= mol->beginInversion(inversionIter); inversion != NULL;
473 >         inversion = mol->nextInversion(inversionIter)) {
474 >
475 >      a = inversion->getAtomA()->getGlobalIndex();
476 >      b = inversion->getAtomB()->getGlobalIndex();        
477 >      c = inversion->getAtomC()->getGlobalIndex();        
478 >      d = inversion->getAtomD()->getGlobalIndex();        
479 >
480 >      if (options_.havevdw12scale() || options_.haveelectrostatic12scale()) {
481 >        oneTwoInteractions_.addPair(a, b);      
482 >        oneTwoInteractions_.addPair(a, c);
483 >        oneTwoInteractions_.addPair(a, d);
484 >      } else {
485 >        excludedInteractions_.addPair(a, b);
486 >        excludedInteractions_.addPair(a, c);
487 >        excludedInteractions_.addPair(a, d);
488 >      }
489 >
490 >      if (options_.havevdw13scale() || options_.haveelectrostatic13scale()) {
491 >        oneThreeInteractions_.addPair(b, c);    
492 >        oneThreeInteractions_.addPair(b, d);    
493 >        oneThreeInteractions_.addPair(c, d);      
494 >      } else {
495 >        excludedInteractions_.addPair(b, c);
496 >        excludedInteractions_.addPair(b, d);
497 >        excludedInteractions_.addPair(c, d);
498 >      }
499 >    }
500 >
501 >    for (rb = mol->beginRigidBody(rbIter); rb != NULL;
502 >         rb = mol->nextRigidBody(rbIter)) {
503        std::vector<Atom*> atoms = rb->getAtoms();
504 <      for (int i = 0; i < atoms.size() -1 ; ++i) {
505 <        for (int j = i + 1; j < atoms.size(); ++j) {
504 >      for (int i = 0; i < static_cast<int>(atoms.size()) -1 ; ++i) {
505 >        for (int j = i + 1; j < static_cast<int>(atoms.size()); ++j) {
506            a = atoms[i]->getGlobalIndex();
507            b = atoms[j]->getGlobalIndex();
508 <          exclude_.addPair(a, b);
508 >          excludedInteractions_.addPair(a, b);
509          }
510        }
511      }        
512  
513    }
514  
515 <  void SimInfo::removeExcludePairs(Molecule* mol) {
515 >  void SimInfo::removeInteractionPairs(Molecule* mol) {
516 >    ForceFieldOptions& options_ = forceField_->getForceFieldOptions();
517      std::vector<Bond*>::iterator bondIter;
518      std::vector<Bend*>::iterator bendIter;
519      std::vector<Torsion*>::iterator torsionIter;
520 +    std::vector<Inversion*>::iterator inversionIter;
521      Bond* bond;
522      Bend* bend;
523      Torsion* torsion;
524 +    Inversion* inversion;
525      int a;
526      int b;
527      int c;
528      int d;
529  
530      std::map<int, std::set<int> > atomGroups;
482
531      Molecule::RigidBodyIterator rbIter;
532      RigidBody* rb;
533      Molecule::IntegrableObjectIterator ii;
534      StuntDouble* integrableObject;
535      
536 <    for (integrableObject = mol->beginIntegrableObject(ii); integrableObject != NULL;
537 <           integrableObject = mol->nextIntegrableObject(ii)) {
538 <
536 >    for (integrableObject = mol->beginIntegrableObject(ii);
537 >         integrableObject != NULL;
538 >         integrableObject = mol->nextIntegrableObject(ii)) {
539 >      
540        if (integrableObject->isRigidBody()) {
541 <          rb = static_cast<RigidBody*>(integrableObject);
542 <          std::vector<Atom*> atoms = rb->getAtoms();
543 <          std::set<int> rigidAtoms;
544 <          for (int i = 0; i < atoms.size(); ++i) {
545 <            rigidAtoms.insert(atoms[i]->getGlobalIndex());
546 <          }
547 <          for (int i = 0; i < atoms.size(); ++i) {
548 <            atomGroups.insert(std::map<int, std::set<int> >::value_type(atoms[i]->getGlobalIndex(), rigidAtoms));
549 <          }      
541 >        rb = static_cast<RigidBody*>(integrableObject);
542 >        std::vector<Atom*> atoms = rb->getAtoms();
543 >        std::set<int> rigidAtoms;
544 >        for (int i = 0; i < static_cast<int>(atoms.size()); ++i) {
545 >          rigidAtoms.insert(atoms[i]->getGlobalIndex());
546 >        }
547 >        for (int i = 0; i < static_cast<int>(atoms.size()); ++i) {
548 >          atomGroups.insert(std::map<int, std::set<int> >::value_type(atoms[i]->getGlobalIndex(), rigidAtoms));
549 >        }      
550        } else {
551          std::set<int> oneAtomSet;
552          oneAtomSet.insert(integrableObject->getGlobalIndex());
# Line 505 | Line 554 | namespace oopse {
554        }
555      }  
556  
557 <    
558 <    for (bond= mol->beginBond(bondIter); bond != NULL; bond = mol->nextBond(bondIter)) {
557 >    for (bond= mol->beginBond(bondIter); bond != NULL;
558 >         bond = mol->nextBond(bondIter)) {
559 >      
560        a = bond->getAtomA()->getGlobalIndex();
561 <      b = bond->getAtomB()->getGlobalIndex();        
562 <      exclude_.removePair(a, b);
561 >      b = bond->getAtomB()->getGlobalIndex();  
562 >    
563 >      if (options_.havevdw12scale() || options_.haveelectrostatic12scale()) {
564 >        oneTwoInteractions_.removePair(a, b);
565 >      } else {
566 >        excludedInteractions_.removePair(a, b);
567 >      }
568      }
569  
570 <    for (bend= mol->beginBend(bendIter); bend != NULL; bend = mol->nextBend(bendIter)) {
570 >    for (bend= mol->beginBend(bendIter); bend != NULL;
571 >         bend = mol->nextBend(bendIter)) {
572 >
573        a = bend->getAtomA()->getGlobalIndex();
574        b = bend->getAtomB()->getGlobalIndex();        
575        c = bend->getAtomC()->getGlobalIndex();
519
520      std::set<int> rigidSetA = getRigidSet(a, atomGroups);
521      std::set<int> rigidSetB = getRigidSet(b, atomGroups);
522      std::set<int> rigidSetC = getRigidSet(c, atomGroups);
523
524      exclude_.removePairs(rigidSetA, rigidSetB);
525      exclude_.removePairs(rigidSetA, rigidSetC);
526      exclude_.removePairs(rigidSetB, rigidSetC);
576        
577 <      //exclude_.removePair(a, b);
578 <      //exclude_.removePair(a, c);
579 <      //exclude_.removePair(b, c);        
577 >      if (options_.havevdw12scale() || options_.haveelectrostatic12scale()) {
578 >        oneTwoInteractions_.removePair(a, b);      
579 >        oneTwoInteractions_.removePair(b, c);
580 >      } else {
581 >        excludedInteractions_.removePair(a, b);
582 >        excludedInteractions_.removePair(b, c);
583 >      }
584 >
585 >      if (options_.havevdw13scale() || options_.haveelectrostatic13scale()) {
586 >        oneThreeInteractions_.removePair(a, c);      
587 >      } else {
588 >        excludedInteractions_.removePair(a, c);
589 >      }
590      }
591  
592 <    for (torsion= mol->beginTorsion(torsionIter); torsion != NULL; torsion = mol->nextTorsion(torsionIter)) {
592 >    for (torsion= mol->beginTorsion(torsionIter); torsion != NULL;
593 >         torsion = mol->nextTorsion(torsionIter)) {
594 >
595        a = torsion->getAtomA()->getGlobalIndex();
596        b = torsion->getAtomB()->getGlobalIndex();        
597        c = torsion->getAtomC()->getGlobalIndex();        
598 <      d = torsion->getAtomD()->getGlobalIndex();        
598 >      d = torsion->getAtomD()->getGlobalIndex();      
599 >  
600 >      if (options_.havevdw12scale() || options_.haveelectrostatic12scale()) {
601 >        oneTwoInteractions_.removePair(a, b);      
602 >        oneTwoInteractions_.removePair(b, c);
603 >        oneTwoInteractions_.removePair(c, d);
604 >      } else {
605 >        excludedInteractions_.removePair(a, b);
606 >        excludedInteractions_.removePair(b, c);
607 >        excludedInteractions_.removePair(c, d);
608 >      }
609  
610 <      std::set<int> rigidSetA = getRigidSet(a, atomGroups);
611 <      std::set<int> rigidSetB = getRigidSet(b, atomGroups);
612 <      std::set<int> rigidSetC = getRigidSet(c, atomGroups);
613 <      std::set<int> rigidSetD = getRigidSet(d, atomGroups);
610 >      if (options_.havevdw13scale() || options_.haveelectrostatic13scale()) {
611 >        oneThreeInteractions_.removePair(a, c);      
612 >        oneThreeInteractions_.removePair(b, d);      
613 >      } else {
614 >        excludedInteractions_.removePair(a, c);
615 >        excludedInteractions_.removePair(b, d);
616 >      }
617  
618 <      exclude_.removePairs(rigidSetA, rigidSetB);
619 <      exclude_.removePairs(rigidSetA, rigidSetC);
620 <      exclude_.removePairs(rigidSetA, rigidSetD);
621 <      exclude_.removePairs(rigidSetB, rigidSetC);
622 <      exclude_.removePairs(rigidSetB, rigidSetD);
623 <      exclude_.removePairs(rigidSetC, rigidSetD);
618 >      if (options_.havevdw14scale() || options_.haveelectrostatic14scale()) {
619 >        oneFourInteractions_.removePair(a, d);      
620 >      } else {
621 >        excludedInteractions_.removePair(a, d);
622 >      }
623 >    }
624  
625 <      /*
626 <      exclude_.removePairs(rigidSetA.begin(), rigidSetA.end(), rigidSetB.begin(), rigidSetB.end());
553 <      exclude_.removePairs(rigidSetA.begin(), rigidSetA.end(), rigidSetC.begin(), rigidSetC.end());
554 <      exclude_.removePairs(rigidSetA.begin(), rigidSetA.end(), rigidSetD.begin(), rigidSetD.end());
555 <      exclude_.removePairs(rigidSetB.begin(), rigidSetB.end(), rigidSetC.begin(), rigidSetC.end());
556 <      exclude_.removePairs(rigidSetB.begin(), rigidSetB.end(), rigidSetD.begin(), rigidSetD.end());
557 <      exclude_.removePairs(rigidSetC.begin(), rigidSetC.end(), rigidSetD.begin(), rigidSetD.end());
625 >    for (inversion= mol->beginInversion(inversionIter); inversion != NULL;
626 >         inversion = mol->nextInversion(inversionIter)) {
627  
628 <      
629 <      exclude_.removePair(a, b);
630 <      exclude_.removePair(a, c);
631 <      exclude_.removePair(a, d);
632 <      exclude_.removePair(b, c);
633 <      exclude_.removePair(b, d);
634 <      exclude_.removePair(c, d);        
635 <      */
628 >      a = inversion->getAtomA()->getGlobalIndex();
629 >      b = inversion->getAtomB()->getGlobalIndex();        
630 >      c = inversion->getAtomC()->getGlobalIndex();        
631 >      d = inversion->getAtomD()->getGlobalIndex();        
632 >
633 >      if (options_.havevdw12scale() || options_.haveelectrostatic12scale()) {
634 >        oneTwoInteractions_.removePair(a, b);      
635 >        oneTwoInteractions_.removePair(a, c);
636 >        oneTwoInteractions_.removePair(a, d);
637 >      } else {
638 >        excludedInteractions_.removePair(a, b);
639 >        excludedInteractions_.removePair(a, c);
640 >        excludedInteractions_.removePair(a, d);
641 >      }
642 >
643 >      if (options_.havevdw13scale() || options_.haveelectrostatic13scale()) {
644 >        oneThreeInteractions_.removePair(b, c);    
645 >        oneThreeInteractions_.removePair(b, d);    
646 >        oneThreeInteractions_.removePair(c, d);      
647 >      } else {
648 >        excludedInteractions_.removePair(b, c);
649 >        excludedInteractions_.removePair(b, d);
650 >        excludedInteractions_.removePair(c, d);
651 >      }
652      }
653  
654 <    for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) {
654 >    for (rb = mol->beginRigidBody(rbIter); rb != NULL;
655 >         rb = mol->nextRigidBody(rbIter)) {
656        std::vector<Atom*> atoms = rb->getAtoms();
657 <      for (int i = 0; i < atoms.size() -1 ; ++i) {
658 <        for (int j = i + 1; j < atoms.size(); ++j) {
657 >      for (int i = 0; i < static_cast<int>(atoms.size()) -1 ; ++i) {
658 >        for (int j = i + 1; j < static_cast<int>(atoms.size()); ++j) {
659            a = atoms[i]->getGlobalIndex();
660            b = atoms[j]->getGlobalIndex();
661 <          exclude_.removePair(a, b);
661 >          excludedInteractions_.removePair(a, b);
662          }
663        }
664      }        
665 <
665 >    
666    }
667 <
668 <
667 >  
668 >  
669    void SimInfo::addMoleculeStamp(MoleculeStamp* molStamp, int nmol) {
670      int curStampId;
671 <
671 >    
672      //index from 0
673      curStampId = moleculeStamps_.size();
674  
# Line 674 | Line 760 | namespace oopse {
760      useRF = 0;
761      useSF = 0;
762      useSP = 0;
763 +    useBoxDipole = 0;
764  
678
765      if (simParams_->haveElectrostaticSummationMethod()) {
766        std::string myMethod = simParams_->getElectrostaticSummationMethod();
767        toUpper(myMethod);
# Line 775 | Line 861 | namespace oopse {
861      MPI_Allreduce(&temp, &useAtomicVirial_, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);
862  
863   #endif
778
864      fInfo_.SIM_uses_PBC = usePBC;    
865      fInfo_.SIM_uses_DirectionalAtoms = useDirectionalAtom;
866      fInfo_.SIM_uses_LennardJones = useLennardJones;
# Line 798 | Line 883 | namespace oopse {
883  
884    void SimInfo::setupFortranSim() {
885      int isError;
886 <    int nExclude;
886 >    int nExclude, nOneTwo, nOneThree, nOneFour;
887      std::vector<int> fortranGlobalGroupMembership;
888      
804    nExclude = exclude_.getSize();
889      isError = 0;
890  
891      //globalGroupMembership_ is filled by SimCreator    
# Line 833 | Line 917 | namespace oopse {
917            else
918              mfact.push_back( 1.0 );
919          }
836
920        }      
921      }
922  
# Line 857 | Line 940 | namespace oopse {
940      }
941      
942      //setup fortran simulation
860    int nGlobalExcludes = 0;
861    int* globalExcludes = NULL;
862    int* excludeList = exclude_.getExcludeList();
863    setFortranSim( &fInfo_, &nGlobalAtoms_, &nAtoms_, &identArray[0], &nExclude, excludeList ,
864                   &nGlobalExcludes, globalExcludes, &molMembershipArray[0],
865                   &mfact[0], &nCutoffGroups_, &fortranGlobalGroupMembership[0], &isError);
943  
944 <    if( isError ){
944 >    nExclude = excludedInteractions_.getSize();
945 >    nOneTwo = oneTwoInteractions_.getSize();
946 >    nOneThree = oneThreeInteractions_.getSize();
947 >    nOneFour = oneFourInteractions_.getSize();
948  
949 +    int* excludeList = excludedInteractions_.getPairList();
950 +    int* oneTwoList = oneTwoInteractions_.getPairList();
951 +    int* oneThreeList = oneThreeInteractions_.getPairList();
952 +    int* oneFourList = oneFourInteractions_.getPairList();
953 +
954 +    setFortranSim( &fInfo_, &nGlobalAtoms_, &nAtoms_, &identArray[0],
955 +                   &nExclude, excludeList,
956 +                   &nOneTwo, oneTwoList,
957 +                   &nOneThree, oneThreeList,
958 +                   &nOneFour, oneFourList,
959 +                   &molMembershipArray[0], &mfact[0], &nCutoffGroups_,
960 +                   &fortranGlobalGroupMembership[0], &isError);
961 +    
962 +    if( isError ){
963 +      
964        sprintf( painCave.errMsg,
965                 "There was an error setting the simulation information in fortran.\n" );
966        painCave.isFatal = 1;
967 <      painCave.severity = OOPSE_ERROR;
967 >      painCave.severity = OPENMD_ERROR;
968        simError();
969      }
970 <
971 < #ifdef IS_MPI
970 >    
971 >    
972      sprintf( checkPointMsg,
973               "succesfully sent the simulation information to fortran.\n");
974 <    MPIcheckPoint();
975 < #endif // is_mpi
976 <
974 >    
975 >    errorCheckPoint();
976 >    
977      // Setup number of neighbors in neighbor list if present
978      if (simParams_->haveNeighborListNeighbors()) {
979        int nlistNeighbors = simParams_->getNeighborListNeighbors();
# Line 889 | Line 984 | namespace oopse {
984    }
985  
986  
892 #ifdef IS_MPI
987    void SimInfo::setupFortranParallel() {
988 <    
988 > #ifdef IS_MPI    
989      //SimInfo is responsible for creating localToGlobalAtomIndex and localToGlobalGroupIndex
990      std::vector<int> localToGlobalAtomIndex(getNAtoms(), 0);
991      std::vector<int> localToGlobalCutoffGroupIndex;
# Line 941 | Line 1035 | namespace oopse {
1035      }
1036  
1037      sprintf(checkPointMsg, " mpiRefresh successful.\n");
1038 <    MPIcheckPoint();
945 <
1038 >    errorCheckPoint();
1039  
1040 + #endif
1041    }
1042  
949 #endif
950
1043    void SimInfo::setupCutoff() {          
1044      
1045      ForceFieldOptions& forceFieldOptions_ = forceField_->getForceFieldOptions();
# Line 956 | Line 1048 | namespace oopse {
1048      int cp =  TRADITIONAL_CUTOFF_POLICY; // Set to traditional by default
1049  
1050      // Set LJ shifting bools to false
1051 <    ljsp_ = false;
1052 <    ljsf_ = false;
1051 >    ljsp_ = 0;
1052 >    ljsf_ = 0;
1053  
1054      std::string myPolicy;
1055      if (forceFieldOptions_.haveCutoffPolicy()){
# Line 1008 | Line 1100 | namespace oopse {
1100            rsw_ = 0.85 * rcut_;
1101            sprintf(painCave.errMsg,
1102                    "SimCreator Warning: No value was set for the switchingRadius.\n"
1103 <                  "\tOOPSE will use a default value of 85 percent of the cutoffRadius.\n"
1103 >                  "\tOpenMD will use a default value of 85 percent of the cutoffRadius.\n"
1104                    "\tswitchingRadius = %f. for this simulation\n", rsw_);
1105          painCave.isFatal = 0;
1106          simError();
# Line 1016 | Line 1108 | namespace oopse {
1108            rsw_ = rcut_;
1109            sprintf(painCave.errMsg,
1110                    "SimCreator Warning: No value was set for the switchingRadius.\n"
1111 <                  "\tOOPSE will use the same value as the cutoffRadius.\n"
1111 >                  "\tOpenMD will use the same value as the cutoffRadius.\n"
1112                    "\tswitchingRadius = %f. for this simulation\n", rsw_);
1113            painCave.isFatal = 0;
1114            simError();
# Line 1028 | Line 1120 | namespace oopse {
1120          toUpper(myMethod);
1121          
1122          if (myMethod == "SHIFTED_POTENTIAL") {
1123 <          ljsp_ = true;
1123 >          ljsp_ = 1;
1124          } else if (myMethod == "SHIFTED_FORCE") {
1125 <          ljsf_ = true;
1125 >          ljsf_ = 1;
1126          }
1127        }
1128 +
1129        notifyFortranCutoffs(&rcut_, &rsw_, &ljsp_, &ljsf_);
1130        
1131      } else {
# Line 1041 | Line 1134 | namespace oopse {
1134        if (fInfo_.SIM_uses_Charges | fInfo_.SIM_uses_Dipoles | fInfo_.SIM_uses_RF) {
1135          sprintf(painCave.errMsg,
1136                  "SimCreator Warning: No value was set for the cutoffRadius.\n"
1137 <                "\tOOPSE will use a default value of 15.0 angstroms"
1137 >                "\tOpenMD will use a default value of 15.0 angstroms"
1138                  "\tfor the cutoffRadius.\n");
1139          painCave.isFatal = 0;
1140          simError();
# Line 1050 | Line 1143 | namespace oopse {
1143          if (simParams_->haveElectrostaticSummationMethod()) {
1144            std::string myMethod = simParams_->getElectrostaticSummationMethod();
1145            toUpper(myMethod);
1146 <      
1147 <      // For the time being, we're tethering the LJ shifted behavior to the
1148 <      // electrostaticSummationMethod keyword options
1146 >          
1147 >          // For the time being, we're tethering the LJ shifted behavior to the
1148 >          // electrostaticSummationMethod keyword options
1149            if (myMethod == "SHIFTED_POTENTIAL") {
1150 <            ljsp_ = true;
1150 >            ljsp_ = 1;
1151            } else if (myMethod == "SHIFTED_FORCE") {
1152 <            ljsf_ = true;
1152 >            ljsf_ = 1;
1153            }
1154            if (myMethod == "SHIFTED_POTENTIAL" || myMethod == "SHIFTED_FORCE") {
1155              if (simParams_->haveSwitchingRadius()){
# Line 1075 | Line 1168 | namespace oopse {
1168          } else {        
1169            sprintf(painCave.errMsg,
1170                    "SimCreator Warning: No value was set for switchingRadius.\n"
1171 <                  "\tOOPSE will use a default value of\n"
1171 >                  "\tOpenMD will use a default value of\n"
1172                    "\t0.85 * cutoffRadius for the switchingRadius\n");
1173            painCave.isFatal = 0;
1174            simError();
1175            rsw_ = 0.85 * rcut_;
1176          }
1177  
1178 +        Electrostatic::setElectrostaticCutoffRadius(rcut_, rsw_);
1179          notifyFortranCutoffs(&rcut_, &rsw_, &ljsp_, &ljsf_);
1180  
1181        } else {
# Line 1097 | Line 1191 | namespace oopse {
1191    void SimInfo::setupElectrostaticSummationMethod( int isError ) {    
1192      
1193      int errorOut;
1194 <    int esm =  NONE;
1195 <    int sm = UNDAMPED;
1194 >    ElectrostaticSummationMethod esm = NONE;
1195 >    ElectrostaticScreeningMethod sm = UNDAMPED;
1196      RealType alphaVal;
1197      RealType dielectric;
1198      
# Line 1185 | Line 1279 | namespace oopse {
1279        }
1280      }
1281      
1282 <    // let's pass some summation method variables to fortran
1283 <    setElectrostaticSummationMethod( &esm );
1284 <    setFortranElectrostaticMethod( &esm );
1285 <    setScreeningMethod( &sm );
1286 <    setDampingAlpha( &alphaVal );
1193 <    setReactionFieldDielectric( &dielectric );
1282 >
1283 >    Electrostatic::setElectrostaticSummationMethod( esm );
1284 >    Electrostatic::setElectrostaticScreeningMethod( sm );
1285 >    Electrostatic::setDampingAlpha( alphaVal );
1286 >    Electrostatic::setReactionFieldDielectric( dielectric );
1287      initFortranFF( &errorOut );
1288    }
1289  
# Line 1377 | Line 1470 | namespace oopse {
1470  
1471  
1472         [  Ixx -Ixy  -Ixz ]
1473 <  J =| -Iyx  Iyy  -Iyz |
1473 >    J =| -Iyx  Iyy  -Iyz |
1474         [ -Izx -Iyz   Izz ]
1475      */
1476  
# Line 1536 | Line 1629 | namespace oopse {
1629        return sdByGlobalIndex_.at(index);
1630      }  
1631   */  
1632 < }//end namespace oopse
1632 > }//end namespace OpenMD
1633  

Comparing:
trunk/src/brains/SimInfo.cpp (property svn:keywords), Revision 1129 by chrisfen, Fri Apr 20 18:15:48 2007 UTC vs.
branches/development/src/brains/SimInfo.cpp (property svn:keywords), Revision 1505 by gezelter, Sun Oct 3 22:18:59 2010 UTC

# Line 0 | Line 1
1 + Author Id Revision Date

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines