ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/ExtendedSystem.cpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/ExtendedSystem.cpp (file contents):
Revision 457 by gezelter, Fri Apr 4 19:16:11 2003 UTC vs.
Revision 468 by gezelter, Mon Apr 7 16:56:38 2003 UTC

# Line 5 | Line 5 | ExtendedSystem::ExtendedSystem( SimInfo &info ) {
5   #include "Thermo.hpp"
6   #include "ExtendedSystem.hpp"
7  
8 < ExtendedSystem::ExtendedSystem( SimInfo &info ) {
8 > ExtendedSystem::ExtendedSystem( SimInfo* the_entry_plug ) {
9  
10    // get what information we need from the SimInfo object
11    
12 <  entry_plug = &info;
13 <  nAtoms = info.n_atoms;
14 <  atoms = info.atoms;
15 <  nMols = info.n_mol;
16 <  molecules = info.molecules;
12 >  entry_plug = the_entry_plug;
13 >  nAtoms = entry_plug->n_atoms;
14 >  atoms = entry_plug->atoms;
15 >  nMols = entry_plug->n_mol;
16 >  molecules = entry_plug->molecules;
17 >  nOriented = entry_plug->n_oriented;
18 >  ndf = entry_plug->ndf;
19    zeta = 0.0;
20    epsilonDot = 0.0;
21  
22   }
23  
22 ExtendedSystem::~ExtendedSystem() {  
23 }
24
25
24   void ExtendedSystem::NoseHooverNVT( double dt, double ke ){
25  
26    // Basic thermostating via Hoover, Phys.Rev.A, 1985, Vol. 31 (5) 1695-1697
# Line 33 | Line 31 | void ExtendedSystem::NoseHooverNVT( double dt, double
31    const double kB = 8.31451e-7;     // boltzmann constant in amu*Ang^2*fs^-2/K
32    const double e_convert = 4.184e-4;    // to convert ke from kcal/mol to
33                                          // amu*Ang^2*fs^-2/K
34 <    
34 >  DirectionalAtom* dAtom;    
35 >
36    ke_temp = ke * e_convert;
37 <  NkBT = (double)getNDF() * kB * targetTemp;
37 >  NkBT = (double)ndf * kB * targetTemp;
38  
39    // advance the zeta term to zeta(t + dt) - zeta is 0.0d0 on config. readin
40    // qmass is set in the parameter file
# Line 44 | Line 43 | void ExtendedSystem::NoseHooverNVT( double dt, double
43    zetaScale = zeta * dt;
44  
45    // perform thermostat scaling on linear velocities and angular momentum
46 <  for(i = 0; i < n_atoms; i++){
46 >  for(i = 0; i < nAtoms; i++){
47      
48      vx = atoms[i]->get_vx();
49      vy = atoms[i]->get_vy();
# Line 54 | Line 53 | void ExtendedSystem::NoseHooverNVT( double dt, double
53      atoms[i]->set_vy(vy * (1.0 - zetaScale));
54      atoms[i]->set_vz(vz * (1.0 - zetaScale));
55    }
56 <  if( n_oriented ){
56 >  if( nOriented ){
57      
58 <    for( i=0; i < n_atoms; i++ ){
58 >    for( i=0; i < nAtoms; i++ ){
59        
60        if( atoms[i]->isDirectional() ){
61          
# Line 89 | Line 88 | void ExtendedSystem::NoseHooverAndersonNPT( double dt,
88    const double e_convert = 4.184e-4;    // to convert ke from kcal/mol to
89                                          // amu*Ang^2*fs^-2/K
90  
91 <  double p_ext;
91 >  double p_ext, zetaScale, epsilonScale, scale, NkBT, ke_temp;
92 >  double volume, p_mol;
93 >  double vx, vy, vz, jx, jy, jz;
94 >  DirectionalAtom* dAtom;
95 >  int i;
96  
97    p_ext = targetPressure * p_units;
98    p_mol = p_int * p_units;
99  
100 <  getBox(oldBox);
100 >  entry_plug->getBox(oldBox);
101  
102    volume = oldBox[0]*oldBox[1]*oldBox[2];
103  
104    ke_temp = ke * e_convert;
105 <  NkBT = (double)getNDF() * kB * targetTemp;
105 >  NkBT = (double)ndf * kB * targetTemp;
106  
107    // propogate the strain rate
108  
# Line 114 | Line 117 | void ExtendedSystem::NoseHooverAndersonNPT( double dt,
117    newBox[2] = oldBox[2] * scale;
118    volume = newBox[0]*newBox[1]*newBox[2];
119  
120 +  entry_plug->setBox(newBox);
121 +
122    // perform affine transform to update positions with volume fluctuations
123    this->AffineTransform( oldBox, newBox );
124  
# Line 126 | Line 131 | void ExtendedSystem::NoseHooverAndersonNPT( double dt,
131    zetaScale = zeta * dt;
132    
133    // apply barostating and thermostating to velocities and angular momenta
134 <  for(i = 0; i < n_atoms; i++){
134 >  for(i = 0; i < nAtoms; i++){
135      
136      vx = atoms[i]->get_vx();
137      vy = atoms[i]->get_vy();
# Line 136 | Line 141 | void ExtendedSystem::NoseHooverAndersonNPT( double dt,
141      atoms[i]->set_vy(vy * (1.0 - zetaScale - epsilonScale));
142      atoms[i]->set_vz(vz * (1.0 - zetaScale - epsilonScale));
143    }
144 <  if( n_oriented ){
144 >  if( nOriented ){
145      
146 <    for( i=0; i < n_atoms; i++ ){
146 >    for( i=0; i < nAtoms; i++ ){
147        
148        if( atoms[i]->isDirectional() ){
149          
# Line 171 | Line 176 | void ExtendedSystem::AffineTransform( double oldBox[3]
176    
177    for (i=0; i < nMols; i++) {
178      
179 <    molecules[i]->getCOM(r);
179 >    molecules[i].getCOM(r);
180      
181      // find the minimum image coordinates of the molecular centers of mass:    
182      
# Line 197 | Line 202 | void ExtendedSystem::AffineTransform( double oldBox[3]
202      r[1] = ryi + boxNum[1];
203      r[2] = rzi + boxNum[2];
204  
205 <    molecules[i]->moveCOM(r);
205 >    molecules[i].moveCOM(r);
206    }
207   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines