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 |
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 |
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(); |
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 |
|
|
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 |
|
|
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 |
|
|
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(); |
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 |
|
|
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 |
|
|
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 |
|
} |