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 1545 by gezelter, Fri Apr 8 21:25:19 2011 UTC vs.
Revision 1546 by gezelter, Sun Apr 10 15:16:39 2011 UTC

# Line 76 | Line 76 | namespace OpenMD {
76      
77      if (!info_->isFortranInitialized()) {
78        info_->update();
79 <      nbiMan_->setSimInfo(info_);
80 <      nbiMan_->initialize();
81 <      swfun_ = nbiMan_->getSwitchingFunction();
79 >      interactionMan_->setSimInfo(info_);
80 >      interactionMan_->initialize();
81 >      swfun_ = interactionMan_->getSwitchingFunction();
82        decomp_->distributeInitialData();
83        info_->setupFortran();
84      }
85      
86      preCalculation();  
87 <    calcShortRangeInteraction();
88 <    calcLongRangeInteraction();
87 >    shortRangeInteractions();
88 >    longRangeInteractions();
89      postCalculation();
90      
91    }
# Line 128 | Line 128 | namespace OpenMD {
128      
129    }
130    
131 <  void ForceManager::calcShortRangeInteraction() {
131 >  void ForceManager::shortRangeInteractions() {
132      Molecule* mol;
133      RigidBody* rb;
134      Bond* bond;
# Line 245 | Line 245 | namespace OpenMD {
245      curSnapshot->statData[Stats::INVERSION_POTENTIAL] = inversionPotential;    
246    }
247    
248 <  void ForceManager::calcLongRangeInteraction() {
248 >  void ForceManager::longRangeInteractions() {
249  
250      // some of this initial stuff will go away:
251      Snapshot* curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot();
# Line 280 | Line 280 | namespace OpenMD {
280  
281      decomp_->distributeData();
282  
283 <    int cg1, cg2;
284 <    Vector3d d_grp;
283 >    int cg1, cg2, atom1, atom2;
284 >    Vector3d d_grp, dag;
285      RealType rgrpsq, rgrp;
286 <    RealType vij;
286 >    Vector<RealType, 4> vij;
287      Vector3d fij, fg;
288      pair<int, int> gtypes;
289      RealType rCutSq;
290      bool in_switching_region;
291      RealType sw, dswdr, swderiv;
292 <    vector<int> atomListI;
293 <    vector<int> atomListJ;
292 >    vector<int> atomListI, atomListJ, atomList;
293      InteractionData idat;
294 +    SelfData sdat;
295 +    RealType mf;
296  
297      int loopStart, loopEnd;
298  
299      loopEnd = PAIR_LOOP;
300 <    if (info_->requiresPrepair_) {
300 >    if (info_->requiresPrepair() ) {
301        loopStart = PREPAIR_LOOP;
302      } else {
303        loopStart = PAIR_LOOP;
# Line 320 | Line 321 | namespace OpenMD {
321          d_grp  = decomp_->getIntergroupVector(cg1, cg2);
322          curSnapshot->wrapVector(d_grp);        
323          rgrpsq = d_grp.lengthSquare();
324 <        rCutSq = groupCutoffMap(gtypes).first;
324 >        rCutSq = groupCutoffMap[gtypes].first;
325  
326          if (rgrpsq < rCutSq) {
327 <          idat.rcut = groupCutoffMap(gtypes).second;
327 >          idat.rcut = groupCutoffMap[gtypes].second;
328            if (iLoop == PAIR_LOOP) {
329 <            vij = 0.0;
329 >            vij *= 0.0;
330              fij = V3Zero;
331            }
332            
333 <          in_switching_region = swfun_->getSwitch(rgrpsq, idat.sw, idat.dswdr, rgrp);    
333 <          
333 >          in_switching_region = swfun_->getSwitch(rgrpsq, idat.sw, dswdr, rgrp);              
334            atomListI = decomp_->getAtomsInGroupI(cg1);
335            atomListJ = decomp_->getAtomsInGroupJ(cg2);
336  
# Line 344 | Line 344 | namespace OpenMD {
344                
345                if (!decomp_->skipAtomPair(atom1, atom2)) {
346                  
347 +                idat = decomp_->fillInteractionData(atom1, atom2);
348 +
349                  if (atomListI.size() == 1 && atomListJ.size() == 1) {
350                    idat.d = d_grp;
351                    idat.r2 = rgrpsq;
# Line 353 | Line 355 | namespace OpenMD {
355                    idat.r2 = idat.d.lengthSquare();
356                  }
357                  
358 <                idat.r = sqrt(idat.r2);
359 <                decomp_->fillInteractionData(atom1, atom2, idat);
358 <                
358 >                idat.rij = sqrt(idat.r2);
359 >              
360                  if (iLoop == PREPAIR_LOOP) {
361                    interactionMan_->doPrePair(idat);
362                  } else {
363                    interactionMan_->doPair(idat);
364                    vij += idat.vpair;
365                    fij += idat.f1;
366 <                  tau -= outProduct(idat.d, idat.f);
366 >                  tau -= outProduct(idat.d, idat.f1);
367                  }
368                }
369              }
# Line 389 | Line 390 | namespace OpenMD {
390                  decomp_->addForceToAtomI(atom1, fg);
391  
392                  if (atomListI.size() > 1) {
393 <                  if (info_->usesAtomicVirial_) {
393 >                  if (info_->usesAtomicVirial()) {
394                      // find the distance between the atom
395                      // and the center of the cutoff group:
396                      dag = decomp_->getAtomToGroupVectorI(atom1, cg1);
# Line 407 | Line 408 | namespace OpenMD {
408                  decomp_->addForceToAtomJ(atom2, fg);
409  
410                  if (atomListJ.size() > 1) {
411 <                  if (info_->usesAtomicVirial_) {
411 >                  if (info_->usesAtomicVirial()) {
412                      // find the distance between the atom
413                      // and the center of the cutoff group:
414                      dag = decomp_->getAtomToGroupVectorJ(atom2, cg2);
# Line 424 | Line 425 | namespace OpenMD {
425        }
426  
427        if (iLoop == PREPAIR_LOOP) {
428 <        if (info_->requiresPrepair_) {            
428 >        if (info_->requiresPrepair()) {            
429            decomp_->collectIntermediateData();
430            atomList = decomp_->getAtomList();
431            for (vector<int>::iterator ia = atomList.begin();
432                 ia != atomList.end(); ++ia) {              
433              atom1 = (*ia);            
434 <            decomp_->populateSelfData(atom1, SelfData sdat);
434 >            sdat = decomp_->fillSelfData(atom1);
435              interactionMan_->doPreForce(sdat);
436            }
437            decomp_->distributeIntermediateData();        
# Line 441 | Line 442 | namespace OpenMD {
442      
443      decomp_->collectData();
444      
445 <    if (info_->requiresSkipCorrection_ || info_->requiresSelfCorrection_) {
445 >    if (info_->requiresSkipCorrection() || info_->requiresSelfCorrection()) {
446        atomList = decomp_->getAtomList();
447        for (vector<int>::iterator ia = atomList.begin();
448             ia != atomList.end(); ++ia) {              
449          atom1 = (*ia);    
450  
451 <        if (info_->requiresSkipCorrection_) {
451 >        if (info_->requiresSkipCorrection()) {
452            vector<int> skipList = decomp_->getSkipsForAtom(atom1);
453            for (vector<int>::iterator jb = skipList.begin();
454                 jb != skipList.end(); ++jb) {              
455              atom2 = (*jb);
456 <            decomp_->populateSkipData(atom1, atom2, InteractionData idat);
456 >            idat = decomp_->fillSkipData(atom1, atom2);
457              interactionMan_->doSkipCorrection(idat);
458            }
459          }
460            
461 <        if (info_->requiresSelfCorrection_) {
462 <          decomp_->populateSelfData(atom1, SelfData sdat);
461 >        if (info_->requiresSelfCorrection()) {
462 >          sdat = decomp_->fillSelfData(atom1);
463            interactionMan_->doSelfCorrection(sdat);
464        }
465        

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines