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 458 by gezelter, Fri Apr 4 19:47:19 2003 UTC

# Line 10 | Line 10 | ExtendedSystem::ExtendedSystem( SimInfo &info ) {
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;
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 >
37    ke_temp = ke * e_convert;
38 <  NkBT = (double)getNDF() * kB * targetTemp;
38 >  NkBT = (double)ndf * kB * targetTemp;
39  
40    // advance the zeta term to zeta(t + dt) - zeta is 0.0d0 on config. readin
41    // qmass is set in the parameter file
# Line 44 | Line 44 | void ExtendedSystem::NoseHooverNVT( double dt, double
44    zetaScale = zeta * dt;
45  
46    // perform thermostat scaling on linear velocities and angular momentum
47 <  for(i = 0; i < n_atoms; i++){
47 >  for(i = 0; i < nAtoms; i++){
48      
49      vx = atoms[i]->get_vx();
50      vy = atoms[i]->get_vy();
# Line 54 | Line 54 | void ExtendedSystem::NoseHooverNVT( double dt, double
54      atoms[i]->set_vy(vy * (1.0 - zetaScale));
55      atoms[i]->set_vz(vz * (1.0 - zetaScale));
56    }
57 <  if( n_oriented ){
57 >  if( nOriented ){
58      
59 <    for( i=0; i < n_atoms; i++ ){
59 >    for( i=0; i < nAtoms; i++ ){
60        
61        if( atoms[i]->isDirectional() ){
62          
# Line 89 | Line 89 | void ExtendedSystem::NoseHooverAndersonNPT( double dt,
89    const double e_convert = 4.184e-4;    // to convert ke from kcal/mol to
90                                          // amu*Ang^2*fs^-2/K
91  
92 <  double p_ext;
92 >  double p_ext, zetaScale, epsilonScale, scale, NkBT, ke_temp;
93 >  double volume, p_mol;
94 >  double vx, vy, vz, jx, jy, jz;
95 >  DirectionalAtom* dAtom;
96 >  int i;
97  
98    p_ext = targetPressure * p_units;
99    p_mol = p_int * p_units;
100  
101 <  getBox(oldBox);
101 >  entry_plug->getBox(oldBox);
102  
103    volume = oldBox[0]*oldBox[1]*oldBox[2];
104  
105    ke_temp = ke * e_convert;
106 <  NkBT = (double)getNDF() * kB * targetTemp;
106 >  NkBT = (double)ndf * kB * targetTemp;
107  
108    // propogate the strain rate
109  
# Line 114 | Line 118 | void ExtendedSystem::NoseHooverAndersonNPT( double dt,
118    newBox[2] = oldBox[2] * scale;
119    volume = newBox[0]*newBox[1]*newBox[2];
120  
121 +  entry_plug->setBox(newBox);
122 +
123    // perform affine transform to update positions with volume fluctuations
124    this->AffineTransform( oldBox, newBox );
125  
# Line 126 | Line 132 | void ExtendedSystem::NoseHooverAndersonNPT( double dt,
132    zetaScale = zeta * dt;
133    
134    // apply barostating and thermostating to velocities and angular momenta
135 <  for(i = 0; i < n_atoms; i++){
135 >  for(i = 0; i < nAtoms; i++){
136      
137      vx = atoms[i]->get_vx();
138      vy = atoms[i]->get_vy();
# Line 136 | Line 142 | void ExtendedSystem::NoseHooverAndersonNPT( double dt,
142      atoms[i]->set_vy(vy * (1.0 - zetaScale - epsilonScale));
143      atoms[i]->set_vz(vz * (1.0 - zetaScale - epsilonScale));
144    }
145 <  if( n_oriented ){
145 >  if( nOriented ){
146      
147 <    for( i=0; i < n_atoms; i++ ){
147 >    for( i=0; i < nAtoms; i++ ){
148        
149        if( atoms[i]->isDirectional() ){
150          
# Line 171 | Line 177 | void ExtendedSystem::AffineTransform( double oldBox[3]
177    
178    for (i=0; i < nMols; i++) {
179      
180 <    molecules[i]->getCOM(r);
180 >    molecules[i].getCOM(r);
181      
182      // find the minimum image coordinates of the molecular centers of mass:    
183      
# Line 197 | Line 203 | void ExtendedSystem::AffineTransform( double oldBox[3]
203      r[1] = ryi + boxNum[1];
204      r[2] = rzi + boxNum[2];
205  
206 <    molecules[i]->moveCOM(r);
206 >    molecules[i].moveCOM(r);
207    }
208   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines