38 |
|
myES = the_es; |
39 |
|
isFirst = 1; |
40 |
|
|
41 |
– |
std::cerr<< "calling symplectic constructor\n"; |
42 |
– |
|
41 |
|
molecules = entry_plug->molecules; |
42 |
|
nMols = entry_plug->n_mol; |
43 |
|
|
170 |
|
double Tb[3]; // torque in the body frame |
171 |
|
double angle; // the angle through which to rotate the rotation matrix |
172 |
|
double A[3][3]; // the rotation matrix |
173 |
+ |
double press[9]; |
174 |
|
|
175 |
|
int time; |
176 |
|
|
191 |
|
StatWriter* e_out; |
192 |
|
DumpWriter* dump_out; |
193 |
|
|
195 |
– |
std::cerr << "about to call new thermo\n"; |
196 |
– |
|
194 |
|
tStats = new Thermo( entry_plug ); |
195 |
|
e_out = new StatWriter( entry_plug ); |
199 |
– |
|
200 |
– |
std::cerr << "calling dumpWriter \n"; |
196 |
|
dump_out = new DumpWriter( entry_plug ); |
202 |
– |
std::cerr << "called dumpWriter \n"; |
197 |
|
|
198 |
|
Atom** atoms = entry_plug->atoms; |
199 |
|
DirectionalAtom* dAtom; |
236 |
|
|
237 |
|
for( tl=0; tl < n_loops; tl++ ){ |
238 |
|
|
245 |
– |
if (!strcasecmp( entry_plug->ensemble, "NVT")) |
246 |
– |
myES->NoseHooverNVT( dt / 2.0 , tStats->getKinetic() ); |
239 |
|
|
240 |
|
for( j=0; j<nAtoms; j++ ){ |
241 |
|
|
334 |
|
} |
335 |
|
} |
336 |
|
|
337 |
+ |
if (!strcasecmp( entry_plug->ensemble, "NVT")) |
338 |
+ |
myES->NoseHooverNVT( dt / 2.0 , tStats->getKinetic() ); |
339 |
+ |
|
340 |
|
// calculate the forces |
341 |
|
|
342 |
|
myFF->doForces(calcPot, calcStress); |
408 |
|
if (!strcasecmp( entry_plug->ensemble, "NVT")) |
409 |
|
myES->NoseHooverNVT( dt / 2.0, tStats->getKinetic() ); |
410 |
|
|
411 |
< |
if (!strcasecmp( entry_plug->ensemble, "NPT") ) |
411 |
> |
if (!strcasecmp( entry_plug->ensemble, "NPT") ) { |
412 |
> |
tStats->getPressureTensor(press); |
413 |
|
myES->NoseHooverAndersonNPT( dt, |
414 |
|
tStats->getKinetic(), |
415 |
< |
tStats->getPressure()); |
415 |
> |
press); |
416 |
> |
} |
417 |
|
|
418 |
|
time = tl + 1; |
419 |
|
|
423 |
|
if( !(time % sample_n) ) dump_out->writeDump( time * dt ); |
424 |
|
if( !((time+1) % status_n) ) { |
425 |
|
calcPot = 1; |
426 |
< |
// bitwise masking in case we need it for NPT |
430 |
< |
calcStress = (!strcasecmp(entry_plug->ensemble,"NPT")) && 1; |
426 |
> |
calcStress = 1; |
427 |
|
} |
428 |
|
if( !(time % status_n) ){ |
429 |
|
e_out->writeStat( time * dt ); |
430 |
|
calcPot = 0; |
431 |
< |
// bitwise masking in case we need it for NPT |
432 |
< |
calcStress = (!strcasecmp(entry_plug->ensemble,"NPT")) && 0; |
431 |
> |
if (!strcasecmp(entry_plug->ensemble, "NPT")) calcStress = 1; |
432 |
> |
else calcStress = 0; |
433 |
|
} |
434 |
|
} |
435 |
|
} |
441 |
|
rot_kE= 0.0; |
442 |
|
trans_kE = 0.0; |
443 |
|
|
448 |
– |
if (!strcasecmp( entry_plug->ensemble, "NVT")) |
449 |
– |
myES->NoseHooverNVT( dt / 2.0, tStats->getKinetic() ); |
450 |
– |
|
444 |
|
for( i=0; i<nAtoms; i++ ){ |
445 |
|
|
446 |
|
// velocity half step |
525 |
|
dAtom->setJz( ji[2] ); |
526 |
|
} |
527 |
|
} |
528 |
+ |
|
529 |
+ |
if (!strcasecmp( entry_plug->ensemble, "NVT")) |
530 |
+ |
myES->NoseHooverNVT( dt / 2.0, tStats->getKinetic() ); |
531 |
|
|
532 |
+ |
|
533 |
|
// calculate the forces |
534 |
|
|
535 |
|
myFF->doForces(calcPot,calcStress); |
582 |
|
dAtom->setJx( ji[0] ); |
583 |
|
dAtom->setJy( ji[1] ); |
584 |
|
dAtom->setJz( ji[2] ); |
585 |
< |
} |
585 |
> |
} |
586 |
> |
|
587 |
|
} |
588 |
|
|
589 |
|
if (!strcasecmp( entry_plug->ensemble, "NVT")) |
590 |
|
myES->NoseHooverNVT( dt / 2.0, tStats->getKinetic() ); |
591 |
|
|
592 |
< |
if (!strcasecmp( entry_plug->ensemble, "NPT") ) |
592 |
> |
if (!strcasecmp( entry_plug->ensemble, "NPT") ) { |
593 |
> |
tStats->getPressureTensor(press); |
594 |
|
myES->NoseHooverAndersonNPT( dt, |
595 |
|
tStats->getKinetic(), |
596 |
< |
tStats->getPressure()); |
596 |
> |
press); |
597 |
> |
} |
598 |
|
|
599 |
|
time = tl + 1; |
600 |
|
|
604 |
|
if( !(time % sample_n) ) dump_out->writeDump( time * dt ); |
605 |
|
if( !((time+1) % status_n) ) { |
606 |
|
calcPot = 1; |
607 |
< |
// bitwise masking in case we need it for NPT |
608 |
< |
calcStress = (!strcasecmp(entry_plug->ensemble,"NPT")) && 1; |
607 |
> |
calcStress = 1; |
608 |
|
} |
609 |
|
if( !(time % status_n) ){ |
610 |
|
e_out->writeStat( time * dt ); |
611 |
|
calcPot = 0; |
612 |
< |
// bitwise masking in case we need it for NPT |
613 |
< |
calcStress = (!strcasecmp(entry_plug->ensemble,"NPT")) && 0; |
612 |
> |
if (!strcasecmp(entry_plug->ensemble, "NPT")) calcStress = 1; |
613 |
> |
else calcStress = 0; |
614 |
|
} |
615 |
|
} |
616 |
|
} |