| 10 |
|
// get what information we need from the SimInfo object |
| 11 |
|
|
| 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; |
| 13 |
|
zeta = 0.0; |
| 14 |
|
epsilonDot = 0.0; |
| 21 |
– |
|
| 15 |
|
} |
| 16 |
|
|
| 17 |
|
void ExtendedSystem::NoseHooverNVT( double dt, double ke ){ |
| 25 |
|
const double e_convert = 4.184e-4; // to convert ke from kcal/mol to |
| 26 |
|
// amu*Ang^2*fs^-2/K |
| 27 |
|
DirectionalAtom* dAtom; |
| 28 |
+ |
atoms = entry_plug->atoms; |
| 29 |
|
|
| 30 |
|
ke_temp = ke * e_convert; |
| 31 |
< |
NkBT = (double)ndf * kB * targetTemp; |
| 31 |
> |
NkBT = (double)entry_plug->ndf * kB * targetTemp; |
| 32 |
|
|
| 33 |
|
// advance the zeta term to zeta(t + dt) - zeta is 0.0d0 on config. readin |
| 34 |
|
// qmass is set in the parameter file |
| 35 |
|
|
| 36 |
|
zeta += dt * ( (ke_temp*2.0 - NkBT) / qmass ); |
| 43 |
– |
std::cerr << "ke_temp = " << ke_temp << "\n"; |
| 37 |
|
|
| 38 |
|
zetaScale = zeta * dt; |
| 39 |
|
|
| 40 |
+ |
std::cerr << "zetaScale = " << zetaScale << "\n"; |
| 41 |
|
|
| 48 |
– |
|
| 42 |
|
// perform thermostat scaling on linear velocities and angular momentum |
| 43 |
< |
for(i = 0; i < nAtoms; i++){ |
| 43 |
> |
for(i = 0; i < entry_plug->n_atoms; i++){ |
| 44 |
|
|
| 45 |
|
vx = atoms[i]->get_vx(); |
| 46 |
|
vy = atoms[i]->get_vy(); |
| 47 |
|
vz = atoms[i]->get_vz(); |
| 48 |
< |
|
| 48 |
> |
|
| 49 |
|
atoms[i]->set_vx(vx * (1.0 - zetaScale)); |
| 50 |
|
atoms[i]->set_vy(vy * (1.0 - zetaScale)); |
| 51 |
|
atoms[i]->set_vz(vz * (1.0 - zetaScale)); |
| 52 |
|
} |
| 53 |
< |
if( nOriented ){ |
| 53 |
> |
if( entry_plug->n_oriented ){ |
| 54 |
|
|
| 55 |
< |
for( i=0; i < nAtoms; i++ ){ |
| 55 |
> |
for( i=0; i < entry_plug->n_atoms; i++ ){ |
| 56 |
|
|
| 57 |
|
if( atoms[i]->isDirectional() ){ |
| 58 |
|
|
| 85 |
|
const double e_convert = 4.184e-4; // to convert ke from kcal/mol to |
| 86 |
|
// amu*Ang^2*fs^-2/K |
| 87 |
|
|
| 88 |
+ |
int i; |
| 89 |
|
double p_ext, zetaScale, epsilonScale, scale, NkBT, ke_temp; |
| 90 |
|
double volume, p_mol; |
| 91 |
|
double vx, vy, vz, jx, jy, jz; |
| 92 |
|
DirectionalAtom* dAtom; |
| 93 |
< |
int i; |
| 93 |
> |
atoms = entry_plug->atoms; |
| 94 |
|
|
| 95 |
|
p_ext = targetPressure * p_units; |
| 96 |
< |
p_mol = p_int * p_units; |
| 96 |
> |
p_mol = p_int; |
| 97 |
|
|
| 98 |
|
entry_plug->getBox(oldBox); |
| 99 |
|
|
| 100 |
|
volume = oldBox[0]*oldBox[1]*oldBox[2]; |
| 101 |
|
|
| 102 |
|
ke_temp = ke * e_convert; |
| 103 |
< |
NkBT = (double)ndf * kB * targetTemp; |
| 103 |
> |
NkBT = (double)entry_plug->ndf * kB * targetTemp; |
| 104 |
|
|
| 105 |
|
// propogate the strain rate |
| 106 |
|
|
| 107 |
|
epsilonDot += dt * ((p_mol - p_ext) * volume / |
| 108 |
|
(tauRelax*tauRelax * kB * targetTemp) ); |
| 109 |
|
|
| 110 |
+ |
|
| 111 |
+ |
std::cerr << "p_mol = " << p_mol << " p_ext = " << p_ext << " volume = " << volume << " tauRelax = " << tauRelax << "\n"; |
| 112 |
+ |
|
| 113 |
+ |
|
| 114 |
|
// determine the change in cell volume |
| 115 |
|
scale = pow( (1.0 + dt * 3.0 * epsilonDot), (1.0 / 3.0)); |
| 116 |
|
|
| 131 |
|
|
| 132 |
|
zeta += dt * ( (ke_temp*2.0 - NkBT) / qmass ); |
| 133 |
|
zetaScale = zeta * dt; |
| 134 |
+ |
|
| 135 |
+ |
std::cerr << "zetaScale = " << zetaScale << "epsilonScale = " << epsilonScale << "\n"; |
| 136 |
|
|
| 137 |
|
// apply barostating and thermostating to velocities and angular momenta |
| 138 |
< |
for(i = 0; i < nAtoms; i++){ |
| 138 |
> |
for(i = 0; i < entry_plug->n_atoms; i++){ |
| 139 |
|
|
| 140 |
|
vx = atoms[i]->get_vx(); |
| 141 |
|
vy = atoms[i]->get_vy(); |
| 145 |
|
atoms[i]->set_vy(vy * (1.0 - zetaScale - epsilonScale)); |
| 146 |
|
atoms[i]->set_vz(vz * (1.0 - zetaScale - epsilonScale)); |
| 147 |
|
} |
| 148 |
< |
if( nOriented ){ |
| 148 |
> |
if( entry_plug->n_oriented ){ |
| 149 |
|
|
| 150 |
< |
for( i=0; i < nAtoms; i++ ){ |
| 150 |
> |
for( i=0; i < entry_plug->n_atoms; i++ ){ |
| 151 |
|
|
| 152 |
|
if( atoms[i]->isDirectional() ){ |
| 153 |
|
|
| 172 |
|
double boxNum[3]; |
| 173 |
|
double percentScale[3]; |
| 174 |
|
double rxi, ryi, rzi; |
| 175 |
+ |
|
| 176 |
+ |
molecules = entry_plug->molecules; |
| 177 |
|
|
| 178 |
|
// first determine the scaling factor from the box size change |
| 179 |
|
percentScale[0] = (newBox[0] - oldBox[0]) / oldBox[0]; |
| 180 |
|
percentScale[1] = (newBox[1] - oldBox[1]) / oldBox[1]; |
| 181 |
|
percentScale[2] = (newBox[2] - oldBox[2]) / oldBox[2]; |
| 182 |
|
|
| 183 |
< |
for (i=0; i < nMols; i++) { |
| 183 |
> |
for (i=0; i < entry_plug->n_mol; i++) { |
| 184 |
|
|
| 185 |
|
molecules[i].getCOM(r); |
| 186 |
|
|