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 1612 by gezelter, Fri Aug 12 19:59:56 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 294 | Line 295 | namespace OpenMD {
295    void ForceManager::initialize() {
296  
297      if (!info_->isTopologyDone()) {
298 +
299        info_->update();
300        interactionMan_->setSimInfo(info_);
301        interactionMan_->initialize();
# Line 301 | Line 303 | namespace OpenMD {
303        // We want to delay the cutoffs until after the interaction
304        // manager has set up the atom-atom interactions so that we can
305        // query them for suggested cutoff values
304
306        setupCutoffs();
307  
308        info_->prepareTopology();      
# Line 309 | Line 310 | namespace OpenMD {
310  
311      ForceFieldOptions& fopts = forceField_->getForceFieldOptions();
312      
313 <    // Force fields can set options on how to scale van der Waals and electrostatic
314 <    // interactions for atoms connected via bonds, bends and torsions
315 <    // in this case the topological distance between atoms is:
313 >    // Force fields can set options on how to scale van der Waals and
314 >    // electrostatic interactions for atoms connected via bonds, bends
315 >    // and torsions in this case the topological distance between
316 >    // atoms is:
317      // 0 = topologically unconnected
318      // 1 = bonded together
319      // 2 = connected via a bend
# Line 363 | Line 365 | namespace OpenMD {
365      
366      for (mol = info_->beginMolecule(mi); mol != NULL;
367           mol = info_->nextMolecule(mi)) {
368 <      for(atom = mol->beginAtom(ai); atom != NULL; atom = mol->nextAtom(ai)) {
368 >      for(atom = mol->beginAtom(ai); atom != NULL;
369 >          atom = mol->nextAtom(ai)) {
370          atom->zeroForcesAndTorques();
371        }
372 <          
372 >      
373        //change the positions of atoms which belong to the rigidbodies
374        for (rb = mol->beginRigidBody(rbIter); rb != NULL;
375             rb = mol->nextRigidBody(rbIter)) {
376          rb->zeroForcesAndTorques();
377        }        
378 <
378 >      
379        if(info_->getNGlobalCutoffGroups() != info_->getNGlobalAtoms()){
380          for(cg = mol->beginCutoffGroup(ci); cg != NULL;
381              cg = mol->nextCutoffGroup(ci)) {
# Line 381 | Line 384 | namespace OpenMD {
384          }
385        }      
386      }
387 <  
387 >    
388      // Zero out the stress tensor
389      tau *= 0.0;
390      
# Line 435 | Line 438 | namespace OpenMD {
438            dataSet.prev.angle = dataSet.curr.angle = angle;
439            dataSet.prev.potential = dataSet.curr.potential = currBendPot;
440            dataSet.deltaV = 0.0;
441 <          bendDataSets.insert(map<Bend*, BendDataSet>::value_type(bend, dataSet));
441 >          bendDataSets.insert(map<Bend*, BendDataSet>::value_type(bend,
442 >                                                                  dataSet));
443          }else {
444            i->second.prev.angle = i->second.curr.angle;
445            i->second.prev.potential = i->second.curr.potential;
# Line 578 | Line 582 | namespace OpenMD {
582          bool update_nlist = fDecomp_->checkNeighborList();
583          if (update_nlist)
584            neighborList = fDecomp_->buildNeighborList();
585 <      }      
586 <        
585 >      }            
586 >
587        for (vector<pair<int, int> >::iterator it = neighborList.begin();
588               it != neighborList.end(); ++it) {
589                  
# Line 614 | Line 618 | namespace OpenMD {
618              for (vector<int>::iterator jb = atomListColumn.begin();
619                   jb != atomListColumn.end(); ++jb) {              
620                atom2 = (*jb);
621 <            
621 >
622                if (!fDecomp_->skipAtomPair(atom1, atom2)) {
623                  vpair = 0.0;
624                  workPot = 0.0;
# Line 636 | Line 640 | namespace OpenMD {
640                    idat.d = &d;
641                    idat.r2 = &r2;
642                  }
643 <                
643 >              
644                  r = sqrt( *(idat.r2) );
645                  idat.rij = &r;
646                
# Line 645 | Line 649 | namespace OpenMD {
649                  } else {
650                    interactionMan_->doPair(idat);
651                    fDecomp_->unpackInteractionData(idat, atom1, atom2);
652 +
653                    vij += vpair;
654                    fij += f1;
655                    tau -= outProduct( *(idat.d), f1);
# Line 708 | Line 713 | namespace OpenMD {
713        }
714  
715        if (iLoop == PREPAIR_LOOP) {
716 <        if (info_->requiresPrepair()) {            
716 >        if (info_->requiresPrepair()) {
717 >
718            fDecomp_->collectIntermediateData();
719  
720            for (int atom1 = 0; atom1 < info_->getNAtoms(); atom1++) {
721              fDecomp_->fillSelfData(sdat, atom1);
722              interactionMan_->doPreForce(sdat);
723            }
724 <          
725 <          
726 <          fDecomp_->distributeIntermediateData();        
724 >
725 >          fDecomp_->distributeIntermediateData();
726 >
727          }
728        }
729  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines