| 5 |
|
#include "Thermo.hpp" |
| 6 |
|
#include "ReadWrite.hpp" |
| 7 |
|
#include "ForceFields.hpp" |
| 8 |
+ |
#include "ExtendedSystem.hpp" |
| 9 |
|
#include "simError.h" |
| 10 |
|
|
| 11 |
|
extern "C"{ |
| 31 |
|
|
| 32 |
|
|
| 33 |
|
|
| 34 |
< |
Symplectic::Symplectic( SimInfo* the_entry_plug, ForceFields* the_ff ){ |
| 34 |
> |
Symplectic::Symplectic( SimInfo* the_entry_plug, ForceFields* the_ff, |
| 35 |
> |
ExtendedSystem* the_es ){ |
| 36 |
|
entry_plug = the_entry_plug; |
| 37 |
|
myFF = the_ff; |
| 38 |
+ |
myES = the_es; |
| 39 |
|
isFirst = 1; |
| 40 |
|
|
| 41 |
|
molecules = entry_plug->molecules; |
| 51 |
|
mass = new double[entry_plug->n_atoms]; |
| 52 |
|
for(int i = 0; i < entry_plug->n_atoms; i++){ |
| 53 |
|
mass[i] = entry_plug->atoms[i]->getMass(); |
| 54 |
< |
} |
| 52 |
< |
|
| 53 |
< |
|
| 54 |
> |
} |
| 55 |
|
|
| 56 |
|
// check for constraints |
| 57 |
|
|
| 66 |
|
SRI** theArray; |
| 67 |
|
for(int i = 0; i < nMols; i++){ |
| 68 |
|
|
| 69 |
< |
theArray = molecules[i].getMyBonds(); |
| 70 |
< |
for(int j=0; j<molecules[i].getNbonds(); j++){ |
| 69 |
> |
theArray = (SRI**) molecules[i].getMyBonds(); |
| 70 |
> |
for(int j=0; j<molecules[i].getNBonds(); j++){ |
| 71 |
|
|
| 72 |
|
constrained = theArray[j]->is_constrained(); |
| 73 |
|
|
| 74 |
|
if(constrained){ |
| 75 |
|
|
| 76 |
|
dummy_plug = theArray[j]->get_constraint(); |
| 77 |
< |
temp_con[c_n_constrained].set_a( dummy_plug->get_a() ); |
| 78 |
< |
temp_con[c_n_constrained].set_b( dummy_plug->get_b() ); |
| 79 |
< |
temp_con[c_n_constrained].set_dsqr( dummy_plug->get_dsqr() ); |
| 77 |
> |
temp_con[n_constrained].set_a( dummy_plug->get_a() ); |
| 78 |
> |
temp_con[n_constrained].set_b( dummy_plug->get_b() ); |
| 79 |
> |
temp_con[n_constrained].set_dsqr( dummy_plug->get_dsqr() ); |
| 80 |
|
|
| 81 |
< |
c_n_constrained++; |
| 81 |
> |
n_constrained++; |
| 82 |
|
constrained = 0; |
| 83 |
|
} |
| 84 |
|
} |
| 85 |
|
|
| 86 |
< |
theArray = molecules[i].getMyBends(); |
| 87 |
< |
for(int j=0; j<molecules[i].getNbends(); j++){ |
| 86 |
> |
theArray = (SRI**) molecules[i].getMyBends(); |
| 87 |
> |
for(int j=0; j<molecules[i].getNBends(); j++){ |
| 88 |
|
|
| 89 |
|
constrained = theArray[j]->is_constrained(); |
| 90 |
|
|
| 91 |
|
if(constrained){ |
| 92 |
|
|
| 93 |
|
dummy_plug = theArray[j]->get_constraint(); |
| 94 |
< |
temp_con[c_n_constrained].set_a( dummy_plug->get_a() ); |
| 95 |
< |
temp_con[c_n_constrained].set_b( dummy_plug->get_b() ); |
| 96 |
< |
temp_con[c_n_constrained].set_dsqr( dummy_plug->get_dsqr() ); |
| 94 |
> |
temp_con[n_constrained].set_a( dummy_plug->get_a() ); |
| 95 |
> |
temp_con[n_constrained].set_b( dummy_plug->get_b() ); |
| 96 |
> |
temp_con[n_constrained].set_dsqr( dummy_plug->get_dsqr() ); |
| 97 |
|
|
| 98 |
< |
c_n_constrained++; |
| 98 |
> |
n_constrained++; |
| 99 |
|
constrained = 0; |
| 100 |
|
} |
| 101 |
|
} |
| 102 |
|
|
| 103 |
< |
theArray = molecules[i].getMyTorsions(); |
| 104 |
< |
for(int j=0; j<molecules[i].getNtorsions(); j++){ |
| 103 |
> |
theArray = (SRI**) molecules[i].getMyTorsions(); |
| 104 |
> |
for(int j=0; j<molecules[i].getNTorsions(); j++){ |
| 105 |
|
|
| 106 |
|
constrained = theArray[j]->is_constrained(); |
| 107 |
|
|
| 108 |
|
if(constrained){ |
| 109 |
|
|
| 110 |
|
dummy_plug = theArray[j]->get_constraint(); |
| 111 |
< |
temp_con[c_n_constrained].set_a( dummy_plug->get_a() ); |
| 112 |
< |
temp_con[c_n_constrained].set_b( dummy_plug->get_b() ); |
| 113 |
< |
temp_con[c_n_constrained].set_dsqr( dummy_plug->get_dsqr() ); |
| 111 |
> |
temp_con[n_constrained].set_a( dummy_plug->get_a() ); |
| 112 |
> |
temp_con[n_constrained].set_b( dummy_plug->get_b() ); |
| 113 |
> |
temp_con[n_constrained].set_dsqr( dummy_plug->get_dsqr() ); |
| 114 |
|
|
| 115 |
< |
c_n_constrained++; |
| 115 |
> |
n_constrained++; |
| 116 |
|
constrained = 0; |
| 117 |
|
} |
| 118 |
|
} |
| 184 |
|
int status_n = (int)( statusTime / dt ); |
| 185 |
|
int vel_n = (int)( thermalTime / dt ); |
| 186 |
|
|
| 187 |
< |
int calcPot; |
| 187 |
> |
int calcPot, calcStress; |
| 188 |
|
|
| 189 |
|
Thermo *tStats = new Thermo( entry_plug ); |
| 190 |
|
|
| 197 |
|
|
| 198 |
|
// initialize the forces the before the first step |
| 199 |
|
|
| 200 |
< |
myFF->doForces(1,0); |
| 200 |
> |
myFF->doForces(1,1); |
| 201 |
|
|
| 202 |
|
if( entry_plug->setTemp ){ |
| 203 |
|
|
| 325 |
|
|
| 326 |
|
// calculate the forces |
| 327 |
|
|
| 328 |
< |
myFF->doForces(calcPot, 0); |
| 328 |
> |
myFF->doForces(calcPot, calcStress); |
| 329 |
|
|
| 330 |
|
// move b |
| 331 |
|
|
| 396 |
|
if( !(time % vel_n) ) tStats->velocitize(); |
| 397 |
|
} |
| 398 |
|
if( !(time % sample_n) ) dump_out->writeDump( time * dt ); |
| 399 |
< |
if( !((time+1) % status_n) ) calcPot = 1; |
| 400 |
< |
if( !(time % status_n) ){ e_out->writeStat( time * dt ); calcPot = 0; } |
| 399 |
> |
if( !((time+1) % status_n) ) { |
| 400 |
> |
calcPot = 1; |
| 401 |
> |
calcStress = 1; |
| 402 |
> |
} |
| 403 |
> |
if( !(time % status_n) ){ |
| 404 |
> |
e_out->writeStat( time * dt ); |
| 405 |
> |
calcPot = 0; |
| 406 |
> |
calcStress = 0; |
| 407 |
> |
} |
| 408 |
|
} |
| 409 |
|
} |
| 410 |
|
else{ |
| 502 |
|
|
| 503 |
|
// calculate the forces |
| 504 |
|
|
| 505 |
< |
myFF->doForces(calcPot,0); |
| 505 |
> |
myFF->doForces(calcPot,calcStress); |
| 506 |
|
|
| 507 |
|
for( i=0; i< nAtoms; i++ ){ |
| 508 |
|
|
| 561 |
|
if( !(time % vel_n) ) tStats->velocitize(); |
| 562 |
|
} |
| 563 |
|
if( !(time % sample_n) ) dump_out->writeDump( time * dt ); |
| 564 |
< |
if( !((time+1) % status_n) ) calcPot = 1; |
| 565 |
< |
if( !(time % status_n) ){ e_out->writeStat( time * dt ); calcPot = 0; } |
| 564 |
> |
if( !((time+1) % status_n) ) { |
| 565 |
> |
calcPot = 1; |
| 566 |
> |
calcStress = 1; |
| 567 |
> |
} |
| 568 |
> |
if( !(time % status_n) ){ |
| 569 |
> |
e_out->writeStat( time * dt ); |
| 570 |
> |
calcPot = 0; |
| 571 |
> |
calcStress = 0; |
| 572 |
> |
} |
| 573 |
|
} |
| 574 |
|
} |
| 575 |
|
|
| 596 |
|
|
| 597 |
|
for(i=0; i<3; i++){ |
| 598 |
|
for(j=0; j<3; j++){ |
| 599 |
< |
tempA[i][j] = A[i][j]; |
| 599 |
> |
tempA[j][i] = A[i][j]; |
| 600 |
|
} |
| 601 |
|
} |
| 602 |
|
|
| 655 |
|
for(j=0; j<3; j++){ |
| 656 |
|
A[j][i] = 0.0; |
| 657 |
|
for(k=0; k<3; k++){ |
| 658 |
< |
A[j][i] += tempA[k][i] * rot[j][k]; |
| 658 |
> |
A[j][i] += tempA[i][k] * rot[j][k]; |
| 659 |
|
} |
| 660 |
|
} |
| 661 |
|
} |