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

Comparing branches/development/src/brains/Thermo.cpp (file contents):
Revision 1850 by gezelter, Wed Feb 20 15:39:39 2013 UTC vs.
Revision 1866 by gezelter, Thu Apr 25 14:32:56 2013 UTC

# Line 619 | Line 619 | namespace OpenMD {
619    }        
620    
621    /**
622 <   * Return intertia tensor for entire system and angular momentum
623 <   * Vector.
622 >   * \brief Return inertia tensor for entire system and angular momentum
623 >   *  Vector.
624     *
625     *
626     *
# Line 701 | Line 701 | namespace OpenMD {
701      return;
702    }
703  
704 +
705 +  Mat3x3d Thermo::getBoundingBox(){
706 +    
707 +    Snapshot* snap = info_->getSnapshotManager()->getCurrentSnapshot();
708 +    
709 +    if (!(snap->hasBoundingBox)) {
710 +      
711 +      SimInfo::MoleculeIterator i;
712 +      Molecule::RigidBodyIterator ri;
713 +      Molecule::AtomIterator ai;
714 +      Molecule* mol;
715 +      RigidBody* rb;
716 +      Atom* atom;
717 +      Vector3d pos, bMax, bMin;
718 +      int index = 0;
719 +      
720 +      for (mol = info_->beginMolecule(i); mol != NULL;
721 +           mol = info_->nextMolecule(i)) {
722 +        
723 +        //change the positions of atoms which belong to the rigidbodies
724 +        for (rb = mol->beginRigidBody(ri); rb != NULL;
725 +             rb = mol->nextRigidBody(ri)) {          
726 +          rb->updateAtoms();
727 +        }
728 +        
729 +        for(atom = mol->beginAtom(ai); atom != NULL;
730 +            atom = mol->nextAtom(ai)) {
731 +          
732 +          pos = atom->getPos();
733 +
734 +          if (index == 0) {
735 +            bMax = pos;
736 +            bMin = pos;
737 +          } else {
738 +            for (int i = 0; i < 3; i++) {
739 +              bMax[i] = max(bMax[i], pos[i]);
740 +              bMin[i] = min(bMin[i], pos[i]);
741 +            }
742 +          }
743 +          index++;
744 +        }
745 +      }
746 +      
747 + #ifdef IS_MPI
748 +      MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &bMax[0], 3, MPI::REALTYPE,
749 +                                MPI::MAX);
750 +
751 +      MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &bMin[0], 3, MPI::REALTYPE,
752 +                                MPI::MIN);
753 + #endif
754 +      Mat3x3d bBox = Mat3x3d(0.0);
755 +      for (int i = 0; i < 3; i++) {          
756 +        bBox(i,i) = bMax[i] - bMin[i];
757 +      }
758 +      snap->setBoundingBox(bBox);
759 +    }
760 +    
761 +    return snap->getBoundingBox();    
762 +  }
763 +  
764 +  
765    // Returns the angular momentum of the system
766    Vector3d Thermo::getAngularMomentum(){
767      Snapshot* snap = info_->getSnapshotManager()->getCurrentSnapshot();
# Line 902 | Line 963 | namespace OpenMD {
963      return 0.0;
964   #endif
965    }
966 +
967 +
968   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines