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

Comparing branches/development/src/brains/ForceManager.cpp (file contents):
Revision 1587 by gezelter, Fri Jul 8 20:25:32 2011 UTC vs.
Revision 1613 by gezelter, Thu Aug 18 20:18:19 2011 UTC

# Line 86 | Line 86 | namespace OpenMD {
86     *      simulation for suggested cutoff values (e.g. 2.5 * sigma).
87     *      Use the maximum suggested value that was found.
88     *
89 <   * cutoffMethod : (one of HARD, SWITCHED, SHIFTED_FORCE, SHIFTED_POTENTIAL)
89 >   * cutoffMethod : (one of HARD, SWITCHED, SHIFTED_FORCE,
90 >   *                        or SHIFTED_POTENTIAL)
91     *      If cutoffMethod was explicitly set, use that choice.
92     *      If cutoffMethod was not explicitly set, use SHIFTED_FORCE
93     *
# Line 107 | Line 108 | namespace OpenMD {
108      
109      Globals* simParams_ = info_->getSimParams();
110      ForceFieldOptions& forceFieldOptions_ = forceField_->getForceFieldOptions();
111 +    int mdFileVersion;
112      
113 +    if (simParams_->haveMDfileVersion())
114 +      mdFileVersion = simParams_->getMDfileVersion();
115 +    else
116 +      mdFileVersion = 0;
117 +  
118 +
119      if (simParams_->haveCutoffRadius()) {
120        rCut_ = simParams_->getCutoffRadius();
121      } else {      
# Line 294 | Line 302 | namespace OpenMD {
302    void ForceManager::initialize() {
303  
304      if (!info_->isTopologyDone()) {
305 +
306        info_->update();
307        interactionMan_->setSimInfo(info_);
308        interactionMan_->initialize();
# Line 301 | Line 310 | namespace OpenMD {
310        // We want to delay the cutoffs until after the interaction
311        // manager has set up the atom-atom interactions so that we can
312        // query them for suggested cutoff values
304
313        setupCutoffs();
314  
315        info_->prepareTopology();      
# Line 309 | Line 317 | namespace OpenMD {
317  
318      ForceFieldOptions& fopts = forceField_->getForceFieldOptions();
319      
320 <    // Force fields can set options on how to scale van der Waals and electrostatic
321 <    // interactions for atoms connected via bonds, bends and torsions
322 <    // in this case the topological distance between atoms is:
320 >    // Force fields can set options on how to scale van der Waals and
321 >    // electrostatic interactions for atoms connected via bonds, bends
322 >    // and torsions in this case the topological distance between
323 >    // atoms is:
324      // 0 = topologically unconnected
325      // 1 = bonded together
326      // 2 = connected via a bend
# Line 363 | Line 372 | namespace OpenMD {
372      
373      for (mol = info_->beginMolecule(mi); mol != NULL;
374           mol = info_->nextMolecule(mi)) {
375 <      for(atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) {
375 >      for(atom = mol->beginAtom(ai); atom != NULL;
376 >          atom = mol->nextAtom(ai)) {
377          atom->zeroForcesAndTorques();
378        }
379 <          
379 >      
380        //change the positions of atoms which belong to the rigidbodies
381        for (rb = mol->beginRigidBody(rbIter); rb != NULL;
382             rb = mol->nextRigidBody(rbIter)) {
383          rb->zeroForcesAndTorques();
384        }        
385 <
385 >      
386        if(info_->getNGlobalCutoffGroups() != info_->getNGlobalAtoms()){
387          for(cg = mol->beginCutoffGroup(ci); cg != NULL;
388              cg = mol->nextCutoffGroup(ci)) {
# Line 381 | Line 391 | namespace OpenMD {
391          }
392        }      
393      }
394 <  
394 >    
395      // Zero out the stress tensor
396      tau *= 0.0;
397      
# Line 435 | Line 445 | namespace OpenMD {
445            dataSet.prev.angle = dataSet.curr.angle = angle;
446            dataSet.prev.potential = dataSet.curr.potential = currBendPot;
447            dataSet.deltaV = 0.0;
448 <          bendDataSets.insert(map<Bend*, BendDataSet>::value_type(bend, dataSet));
448 >          bendDataSets.insert(map<Bend*, BendDataSet>::value_type(bend,
449 >                                                                  dataSet));
450          }else {
451            i->second.prev.angle = i->second.curr.angle;
452            i->second.prev.potential = i->second.curr.potential;
# Line 578 | Line 589 | namespace OpenMD {
589          bool update_nlist = fDecomp_->checkNeighborList();
590          if (update_nlist)
591            neighborList = fDecomp_->buildNeighborList();
592 <      }      
593 <        
592 >      }            
593 >
594        for (vector<pair<int, int> >::iterator it = neighborList.begin();
595               it != neighborList.end(); ++it) {
596                  
# Line 589 | Line 600 | namespace OpenMD {
600          cuts = fDecomp_->getGroupCutoffs(cg1, cg2);
601  
602          d_grp  = fDecomp_->getIntergroupVector(cg1, cg2);
603 +
604          curSnapshot->wrapVector(d_grp);        
605          rgrpsq = d_grp.lengthSquare();
594
606          rCutSq = cuts.second;
607  
608          if (rgrpsq < rCutSq) {
# Line 606 | Line 617 | namespace OpenMD {
617                
618            atomListRow = fDecomp_->getAtomsInGroupRow(cg1);
619            atomListColumn = fDecomp_->getAtomsInGroupColumn(cg2);
620 +                      
621  
622            for (vector<int>::iterator ia = atomListRow.begin();
623                 ia != atomListRow.end(); ++ia) {            
# Line 614 | Line 626 | namespace OpenMD {
626              for (vector<int>::iterator jb = atomListColumn.begin();
627                   jb != atomListColumn.end(); ++jb) {              
628                atom2 = (*jb);
629 <            
629 >
630                if (!fDecomp_->skipAtomPair(atom1, atom2)) {
631                  vpair = 0.0;
632                  workPot = 0.0;
# Line 636 | Line 648 | namespace OpenMD {
648                    idat.d = &d;
649                    idat.r2 = &r2;
650                  }
651 <                
651 >              
652                  r = sqrt( *(idat.r2) );
653                  idat.rij = &r;
654                
# Line 645 | Line 657 | namespace OpenMD {
657                  } else {
658                    interactionMan_->doPair(idat);
659                    fDecomp_->unpackInteractionData(idat, atom1, atom2);
660 +
661                    vij += vpair;
662                    fij += f1;
663                    tau -= outProduct( *(idat.d), f1);
# Line 700 | Line 713 | namespace OpenMD {
713                  }
714                }
715              }
716 <            //if (!SIM_uses_AtomicVirial) {
716 >            //if (!info_->usesAtomicVirial()) {
717              //  tau -= outProduct(d_grp, fij);
718              //}
719            }
# Line 708 | Line 721 | namespace OpenMD {
721        }
722  
723        if (iLoop == PREPAIR_LOOP) {
724 <        if (info_->requiresPrepair()) {            
724 >        if (info_->requiresPrepair()) {
725 >
726            fDecomp_->collectIntermediateData();
727  
728            for (int atom1 = 0; atom1 < info_->getNAtoms(); atom1++) {
729              fDecomp_->fillSelfData(sdat, atom1);
730              interactionMan_->doPreForce(sdat);
731            }
732 <          
733 <          
734 <          fDecomp_->distributeIntermediateData();        
732 >
733 >          fDecomp_->distributeIntermediateData();
734 >
735          }
736        }
723
737      }
738      
739      fDecomp_->collectData();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines