ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-3.0/src/integrators/NVE.cpp
(Generate patch)

Comparing branches/new_design/OOPSE-3.0/src/integrators/NVE.cpp (file contents):
Revision 1726 by tim, Wed Nov 10 22:50:03 2004 UTC vs.
Revision 1820 by tim, Thu Dec 2 00:09:35 2004 UTC

# Line 30 | Line 30
30    * @time 15:13am
31    * @version 1.0
32    */
33 <
33 >  
34 > #include "integrators/IntegratorFactory.hpp"
35   #include "integrators/NVE.hpp"
36 + #include "primitives/Molecule.hpp"
37 + #include "utils/OOPSEConstant.hpp"
38 +
39   namespace oopse {
40  
41 + Integrator* createNVE(SimInfo* info) {
42 +    return new NVE(info);
43 + }
44 +
45   //register the creator to IntegratorFactory
46 < REGISTER_CREATOR(IntegratorFactory, "NVE", NVE);
46 > bool registerNVEStatus = IntegratorFactory::getInstance()->registerIntegrator("NVE", createNVE);
47  
48 < NVE::NVE(SimInfo* info) {
48 > NVE::NVE(SimInfo* info) : VelocityVerletIntegrator(info){
49  
50   }
51  
52 < NVE::moveA(){
53 <    typename SimInfo::MoleculeIterator i;
54 <    std::vector<StuntDouble*>::iterator j;
52 > void NVE::moveA(){
53 >    SimInfo::MoleculeIterator i;
54 >    Molecule::IntegrableObjectIterator  j;
55      Molecule* mol;
56      StuntDouble* integrableObject;
57      Vector3d vel;
# Line 52 | Line 60 | NVE::moveA(){
60      Vector3d Tb;
61      Vector3d ji;
62      double mass;
55
56    // Raw degrees of freedom that we have to set
63      
64 <    for (mol = info->beginMolecule(i); mol != NULL; mol = info->nextMolecule(i)) {
64 >    for (mol = info_->beginMolecule(i); mol != NULL; mol = info_->nextMolecule(i)) {
65          for (integrableObject = mol->beginIntegrableObject(j); integrableObject != NULL;
66                 integrableObject = mol->nextIntegrableObject(j)) {
67  
# Line 65 | Line 71 | NVE::moveA(){
71                  mass = integrableObject->getMass();
72                  
73                  // velocity half step
74 <                vel += (halfStep /mass * UnitConstant::eConvert) * frc;
74 >                vel += (dt2 /mass * OOPSEConstant::energyConvert) * frc;
75  
76                  // position whole step
77 <                pos += fullStep * vel;
77 >                pos += dt * vel;
78  
79                  integrableObject->setVel(vel);
80                  integrableObject->setPos(pos);
# Line 83 | Line 89 | NVE::moveA(){
89  
90                      ji = integrableObject->getJ();
91  
92 <                    ji += (halfStep  * UnitConstant::eConvert) * Tb;
92 >                    ji += (dt2  * OOPSEConstant::energyConvert) * Tb;
93  
94 <                    this->rotationPropagation( integrableObject, ji );
94 >                    rotAlgo->rotate(integrableObject, ji, dt);
95  
96                      integrableObject->setJ(ji);
97                  }
98  
99              
100          }
101 <    } //end for(mol = info->beginMolecule(i))
101 >    } //end for(mol = info_->beginMolecule(i))
102      
103 <    constraintAlgorithm->doConstrainA();
103 >    //constraintAlgorithm->doConstrainA();
104      
105   }    
106  
107 < NVE::moveB(){
108 <    typename SimInfo::MoleculeIterator i;
109 <    std::vector<StuntDouble*>::iterator j;
107 > void NVE::moveB(){
108 >    SimInfo::MoleculeIterator i;
109 >    Molecule::IntegrableObjectIterator  j;
110      Molecule* mol;
111      StuntDouble* integrableObject;
112      Vector3d vel;
# Line 109 | Line 115 | NVE::moveB(){
115      Vector3d ji;
116      double mass;
117      
118 <    for (mol = info->beginMolecule(i); mol != NULL; mol = info->nextMolecule(i)) {
118 >    for (mol = info_->beginMolecule(i); mol != NULL; mol = info_->nextMolecule(i)) {
119          for (integrableObject = mol->beginIntegrableObject(j); integrableObject != NULL;
120                 integrableObject = mol->nextIntegrableObject(j)) {
121  
# Line 118 | Line 124 | NVE::moveB(){
124                  mass = integrableObject->getMass();
125                  
126                  // velocity half step
127 <                vel += (halfStep /mass * UnitConstant::eConvert) * frc;
127 >                vel += (dt2 /mass * OOPSEConstant::energyConvert) * frc;
128                  
129                  integrableObject->setVel(vel);
130  
# Line 132 | Line 138 | NVE::moveB(){
138  
139                      ji = integrableObject->getJ();
140  
141 <                    ji += (halfStep  * UnitConstant::eConvert) * Tb;
141 >                    ji += (dt2  * OOPSEConstant::energyConvert) * Tb;
142  
143                      integrableObject->setJ(ji);
144                  }
145  
146              
147          }
148 <    } //end for(mol = info->beginMolecule(i))
148 >    } //end for(mol = info_->beginMolecule(i))
149    
150  
151 <    constraintAlgorithm->doConstrainB();
151 >    //constraintAlgorithm->doConstrainB();
152  
153   }
154  
155 +
156 + double NVE::calcConservedQuantity() {
157 +    return thermo.getTotalE();
158 + }
159 +
160   } //end namespace oopse

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines