47 #if defined(USE_GETTIMEOFDAY) 52 gettimeofday(&t, NULL);
53 double sec = double(t.tv_sec);
54 double usec = double (t.tv_usec);
55 double totalSec = sec + 1e-6 * usec;
60 return CmiWallTimer();
64 #if(CMK_CCS_AVAILABLE && CMK_WEB_MODE) 65 extern "C" void CApplicationDepositNode0Data(
char *);
69 #define MIN_DEBUG_LEVEL 3 73 #define XXXBIGREAL 1.0e32 78 static char tmp_string[21];
79 sprintf(tmp_string,
"FepEnergy: %6d ",
X);
85 static char tmp_string[21];
86 sprintf(tmp_string,
"FepE_back: %6d ",
X);
92 static char tmp_string[21];
93 sprintf(tmp_string,
"FEP: %7d",
X);
99 static char tmp_string[21];
100 sprintf(tmp_string,
"TI: %7d",
X);
118 const char *myname,
int outputfreq)
119 : nslabs(numslabs), freq(outputfreq) {
120 name = strdup(myname);
121 nelements = 3*nslabs * numpartitions;
138 double inv_volume = 1.0 / lattice.
volume();
140 int arraysize = 3*nslabs;
141 for (i=0; i<nelements; i++) {
144 total[i % arraysize] += val;
147 if (!(step % freq)) {
151 iout <<
"PPROFILE" << name <<
": " << step <<
" ";
152 if (step == firsttimestep) {
154 for (i=0; i<nelements; i++)
155 iout << reduction->
item(i)*scalefac*inv_volume <<
" ";
159 for (i=0; i<nelements; i++)
175 computeChecksum(0), marginViolations(0), pairlistWarnings(0),
180 firstCTime(CmiTimer()),
188 #if defined(NAMD_CUDA) || defined(NAMD_HIP) 190 CProxy_PatchData cpdata(CkpvAccess(BOCclass_group).patchData);
191 PatchData* patchData = cpdata.ckLocalBranch();
194 #endif // defined(NAMD_CUDA) || defined(NAMD_HIP) 210 #if defined(NAMD_CUDA) || defined(NAMD_HIP) 214 #endif // defined(NAMD_CUDA) || defined(NAMD_HIP) 225 int npairs = (ntypes * (ntypes+1))/2;
231 nslabs, npairs,
"BONDED", freq);
233 nslabs, npairs,
"NONBONDED", freq);
236 nslabs, ntypes,
"INTERNAL", freq);
240 nslabs, npairs,
"NONBONDED", freq);
262 #define AVGXY(T) T.xy = T.yx = 0; T.xx = T.yy = 0.5 * ( T.xx + T.yy );\ 263 T.xz = T.zx = T.yz = T.zy = 0.5 * ( T.xz + T.yz ); 293 for (
int i=0;i < n;i++) {
337 #if defined(NAMD_CUDA) || defined(NAMD_HIP) 361 DebugM(4,
"Starting thread in controller on this=" <<
this <<
"\n");
363 threadWrapper->
thread = CthCreate((CthVoidFn)&(threadRun),(
void*)(
this),
CTRL_STK_SZ);
364 CthSetStrategyDefault(threadWrapper->
thread);
365 #if CMK_BLUEGENE_CHARM 372 CthAwaken(threadWrapper->
thread);
385 #ifdef NODEGROUP_FORCE_REGISTER 386 CProxy_PatchData cpdata(CkpvAccess(BOCclass_group).patchData);
387 PatchData *patchData = cpdata.ckLocalBranch();
389 switch ( scriptTask ) {
423 NAMD_die(
"Unable to revert, checkpoint was never called!");
451 NAMD_die(
"Unable to load checkpoint, requested key was never stored.");
468 NAMD_die(
"Unable to swap checkpoint, requested key was never stored.");
485 NAMD_die(
"Unable to free checkpoint, requested key was never stored.");
506 NAMD_bug(
"Unknown task in Controller::algorithm");
558 if ( zeroMomentum && dofull && ! (step %
slowFreq) )
567 sprintf(traceNote,
"s:%d", step);
568 traceUserSuppliedNote(traceNote);
580 for ( ++step ; step <= numberOfSteps; ++step )
591 if ( zeroMomentum && dofull && ! (step %
slowFreq) )
606 sprintf(traceNote,
"s:%d", step);
607 traceUserSuppliedNote(traceNote);
633 #ifdef MEASURE_NAMD_WITH_PAPI 635 int bstep =
simParams->papiMeasureStartStep;
636 int estep = bstep +
simParams->numPapiMeasureSteps;
638 papiMeasureBarrier(1, step);
641 papiMeasureBarrier(0, step);
664 #ifdef NODEGROUP_FORCE_REGISTER 666 void Controller::printStep(
int step){
685 if ( zeroMomentum && dofull && ! (step %
slowFreq) )
694 sprintf(traceNote,
"s:%d", step);
695 traceUserSuppliedNote(traceNote);
714 if ( zeroMomentum && dofull && ! (step %
slowFreq) )
729 sprintf(traceNote,
"s:%d", step);
730 traceUserSuppliedNote(traceNote);
740 printMinimizeEnergies(step); \ 741 outputExtendedSystem(step); \ 742 rebalanceLoad(step); \ 743 if ( step == numberOfSteps ) return; \ 747 if ( step == numberOfSteps ) { \ 748 if ( minVerbose ) { iout << "LINE MINIMIZER: RETURNING TO " << mid.x << " FROM " << last.x << "\n" << endi; } \ 749 if ( newDir || (mid.x-last.x) ) { \ 750 broadcast->minimizeCoefficient.publish(minSeq++,mid.x-last.x); \ 752 broadcast->minimizeCoefficient.publish(minSeq++,0.); \ 753 broadcast->minimizeCoefficient.publish(minSeq++,0.); \ 754 min_reduction->require(); \ 755 broadcast->minimizeCoefficient.publish(minSeq++,0.); \ 757 enqueueCollections(step); \ 759 } else if ( (X)-last.x ) { \ 760 broadcast->minimizeCoefficient.publish(minSeq++,(X)-last.x); \ 763 enqueueCollections(step); \ 765 last.u = min_energy; \ 766 last.dudx = -1. * min_f_dot_v; \ 767 last.noGradient = min_huge_count; \ 768 if ( minVerbose ) { \ 769 iout << "LINE MINIMIZER: POSITION " << last.x << " ENERGY " << last.u << " GRADIENT " << last.dudx; \ 770 if ( last.noGradient ) iout << " HUGECOUNT " << last.noGradient; \ 771 iout << "\n" << endi; \ 788 const BigReal goldenRatio = 0.5 * ( sqrt(5.0) - 1.0 );
795 int old_min_huge_count = 2000000000;
796 int steps_at_same_min_huge_count = 0;
797 for (
int i_slow = 0;
min_huge_count && i_slow < 100; ++i_slow ) {
799 if ( ++steps_at_same_min_huge_count > 10 )
break;
802 steps_at_same_min_huge_count = 0;
812 iout <<
"MINIMIZER STARTING CONJUGATE GRADIENT ALGORITHM\n" <<
endi;
815 int errorFactor = 10;
834 iout <<
"LINE MINIMIZER: POSITION " << last.
x <<
" ENERGY " << last.
u <<
" GRADIENT " << last.
dudx;
839 iout <<
"LINE MINIMIZER REDUCING GRADIENT FROM " <<
846 while ( last.
u < mid.
u ) {
847 if ( last.
dudx < mid.
dudx * (5.5 - x/maxstep)/5. ) {
848 x = 6 * maxstep;
break;
850 lo = mid; mid = last;
852 if ( x > 5.5 * maxstep )
break;
855 if ( x > 5.5 * maxstep ) {
856 iout <<
"MINIMIZER RESTARTING CONJUGATE GRADIENT ALGORITHM DUE TO POOR PROGRESS\n" <<
endi;
866 #define PRINT_BRACKET \ 867 iout << "LINE MINIMIZER BRACKET: DX " \ 868 << (mid.x-lo.x) << " " << (hi.x-mid.x) << \ 869 " DU " << (mid.u-lo.u) << " " << (hi.u-mid.u) << " DUDX " << \ 870 lo.dudx << " " << mid.dudx << " " << hi.dudx << " \n" << endi; 874 for ( itcnt = 10; itcnt > 0; --itcnt ) {
878 if ( ( mid.
x - lo.
x ) > ( hi.
x - mid.
x ) ) {
879 x = (1.0 - goldenRatio) * lo.
x + goldenRatio * mid.
x;
881 if ( last.
u <= mid.
u ) {
882 hi = mid; mid = last;
887 x = (1.0 - goldenRatio) * hi.
x + goldenRatio * mid.
x;
889 if ( last.
u <= mid.
u ) {
890 lo = mid; mid = last;
896 if ( mid.
dudx > 0. ) {
897 BigReal altxhi = 0.1 * lo.
x + 0.9 * mid.
x;
898 BigReal altxlo = 0.9 * lo.
x + 0.1 * mid.
x;
899 x = mid.
dudx*(mid.
x*mid.
x-lo.
x*lo.
x) + 2*mid.
x*(lo.
u-mid.
u);
901 if ( xdiv ) x /= xdiv;
else x = last.
x;
902 if ( x > altxhi ) x = altxhi;
903 if ( x < altxlo ) x = altxlo;
904 if ( x-last.
x == 0 )
break;
906 if ( last.
u <= mid.
u ) {
907 hi = mid; mid = last;
909 if ( lo.
dudx < 0. && last.
dudx > 0. ) progress = 0;
913 BigReal altxlo = 0.1 * hi.
x + 0.9 * mid.
x;
914 BigReal altxhi = 0.9 * hi.
x + 0.1 * mid.
x;
915 x = mid.
dudx*(mid.
x*mid.
x-hi.
x*hi.
x) + 2*mid.
x*(hi.
u-mid.
u);
917 if ( xdiv ) x /= xdiv;
else x = last.
x;
918 if ( x < altxlo ) x = altxlo;
919 if ( x > altxhi ) x = altxhi;
920 if ( x-last.
x == 0 )
break;
922 if ( last.
u <= mid.
u ) {
923 lo = mid; mid = last;
925 if ( hi.
dudx > 0. && last.
dudx < 0. ) progress = 0;
935 if ( fabs(last.
dudx) < tol )
break;
936 if ( lo.
x != mid.
x && (lo.
u-mid.
u) < tol * (mid.
x-lo.
x) )
break;
937 if ( mid.
x != hi.
x && (hi.
u-mid.
u) < tol * (hi.
x-mid.
x) )
break;
942 c = ( c > 1.5 ? 1.5 : c );
943 if ( atStart ) { c = 0; --atStart; }
946 if ( errorFactor < 100 ) errorFactor += 10;
949 iout <<
"MINIMIZER RESTARTING CONJUGATE GRADIENT ALGORITHM\n" <<
endi;
969 BigReal NGfac = 1.0/sqrt(3.0*NG + 1.0);
986 if (callNumber == 1) {
1009 GET_TENSOR(virial_normal, reduction, REDUCTION_VIRIAL_NORMAL);
1010 GET_TENSOR(virial_nbond, reduction, REDUCTION_VIRIAL_NBOND);
1011 GET_TENSOR(virial_slow, reduction, REDUCTION_VIRIAL_SLOW);
1012 GET_TENSOR(intVirial_normal, reduction, REDUCTION_INT_VIRIAL_NORMAL);
1013 GET_TENSOR(intVirial_nbond, reduction, REDUCTION_INT_VIRIAL_NBOND);
1014 GET_TENSOR(intVirial_slow, reduction, REDUCTION_INT_VIRIAL_SLOW);
1015 GET_VECTOR(extForce_normal, reduction, REDUCTION_EXT_FORCE_NORMAL);
1016 GET_VECTOR(extForce_nbond, reduction, REDUCTION_EXT_FORCE_NBOND);
1017 GET_VECTOR(extForce_slow, reduction, REDUCTION_EXT_FORCE_SLOW);
1018 calcPressure(step, 0, virial_normal, virial_nbond, virial_slow,
1019 intVirial_normal, intVirial_nbond, intVirial_slow,
1020 extForce_normal, extForce_nbond, extForce_slow);
1021 if (callNumber == 2) {
1051 for (
int i=n-1;i >= 0;i--) {
1055 }
else if (i == n-1) {
1065 if (callNumber == 1)
1087 for (
int i=0;i < n;i++) {
1091 }
else if (i == n-1) {
1125 BigReal W = (3.0*NG + 1.0)*kT0*tauV*tauV;
1157 reduction->
require(clear_reduction_data);
1161 BigReal weight = (totalEnergyNew - totalEnergyOld);
1162 weight += (pressureTarget * (volumeNew - volumeOld));
1163 weight -= (numAtom * kbT * log(volumeNew / volumeOld));
1164 weight -= (surfTensionTarget * (areaNew - areaOld));
1165 BigReal totalWeight = exp(-weight / kbT);
1169 printf(
"MC-data (accept): step: %d, Pe: %d, numAtom: %d\n", step, CkMyPe(), numAtom);
1170 printf(
" oldE: %f, newE: %f, deltaE: %f\n", totalEnergyOld, totalEnergyNew, totalEnergyNew - totalEnergyOld);
1171 printf(
" oldV: %f, newV: %f, deltaV: %f\n", volumeOld, volumeNew, volumeNew - volumeOld);
1172 printf(
" surfTen: %f, deltaA: %f \n", surfTensionTarget, areaNew - areaOld);
1173 printf(
" weight: %f, accepted: %d\n\n", totalWeight, accepted);
1189 if (accRate > 0.0) {
1201 iout <<
iWARN <<
"Small volume change in MC barostat!\n" <<
endi;
1202 iout <<
iWARN <<
"Maximum volume change is set to 0.001 A^3.\n" <<
endi;
1205 iout <<
iWARN <<
"Large volume change in MC barostat!\n" <<
endi;
1206 iout <<
iWARN <<
"Maximum volume change is set to " << maxVolume <<
" A^3.\n" <<
endi;
1214 iout <<
iWARN <<
"Small volume change in MC barostat!\n" <<
endi;
1215 iout <<
iWARN <<
"Maximum volume change is set to 0.001 A^3.\n" <<
endi;
1218 iout <<
iWARN <<
"Large volume change in MC barostat!\n" <<
endi;
1219 iout <<
iWARN <<
"Maximum volume change is set to " << maxVolume <<
" A^3.\n" <<
endi;
1227 iout <<
iWARN <<
"Small volume change in MC barostat!\n" <<
endi;
1228 iout <<
iWARN <<
"Maximum volume change is set to 0.001 A^3.\n" <<
endi;
1231 iout <<
iWARN <<
"Large volume change in MC barostat!\n" <<
endi;
1232 iout <<
iWARN <<
"Maximum volume change is set to " << maxVolume <<
" A^3.\n" <<
endi;
1244 " ACCEPTED: " <<
mc_totalAccept <<
" %ACCEPTANCE: " << acceptPerc;
1276 reduction->
require(clear_reduction_data);
1286 bool constZ, constY, constX;
1292 constZ = constY = constX =
false;
1301 factor.
zz = (oldVolume + dV) / oldVolume;
1302 }
else if (constRatio) {
1306 if (probAxis < 1.0) {
1310 BigReal scale = sqrt((oldVolume + dV)/oldVolume);
1311 factor.
xx = factor.
yy = scale;
1313 }
else if (probAxis < 2.0 && !constZ) {
1317 BigReal scale = (oldVolume + dV)/oldVolume;
1326 if (probAxis < 1.0 && !constX) {
1330 factor.
xx = (oldVolume + dV) / oldVolume;
1332 }
else if (probAxis < 2.0 && !constY) {
1336 factor.
yy = (oldVolume + dV) / oldVolume;
1338 }
else if (probAxis < 3.0 && !constZ) {
1342 factor.
zz = (oldVolume + dV) / oldVolume;
1351 BigReal scale = pow((oldVolume + dV)/oldVolume, 1.0/3.0);
1352 factor.
xx = factor.
yy = factor.
zz = scale;
1366 #define LIMIT_SCALING(VAR,MIN,MAX,FLAG) {\ 1367 if ( VAR < (MIN) ) { VAR = (MIN); FLAG = 1; } \ 1368 if ( VAR > (MAX) ) { VAR = (MAX); FLAG = 1; } } 1392 " cell rescaling factor limited.\n" <<
endi;
1403 #undef LIMIT_SCALING 1417 #ifdef DEBUG_PRESSURE 1418 iout <<
iINFO <<
"entering langevinPiston1, strain rate: " << strainRate <<
"\n";
1424 BigReal f1 = exp( -0.5 * dt_long * gamma );
1425 BigReal f2 = sqrt( ( 1. - f1*f1 ) * kT / mass );
1441 #ifdef DEBUG_PRESSURE 1442 iout <<
iINFO <<
"applying langevin, strain rate: " << strainRate <<
"\n";
1456 strainRate += ( 0.5 * dt * cellDims *
state->lattice.
volume() / mass ) *
1466 #ifdef DEBUG_PRESSURE 1467 iout <<
iINFO <<
"integrating half step, strain rate: " << strainRate <<
"\n";
1476 factor.
xx = exp( dt_long * strainRate.xx );
1477 factor.
yy = exp( dt_long * strainRate.yy );
1479 factor.
xx = factor.
yy = 1;
1481 factor.
zz = exp( dt_long * strainRate.zz );
1484 #ifdef DEBUG_PRESSURE 1485 iout <<
iINFO <<
"rescaling by: " << factor <<
"\n";
1495 factor.
xx = exp( dt_long * strainRate.xx );
1496 factor.
yy = exp( dt_long * strainRate.yy );
1498 factor.
xx = factor.
yy = 1;
1500 factor.
zz = exp( dt_long * strainRate.zz );
1506 #ifdef DEBUG_PRESSURE 1518 factor.
xx = factor.
yy = 1;
1530 #ifdef DEBUG_PRESSURE 1531 iout <<
iINFO <<
"correcting strain rate for nbond, ";
1533 strainRate -= ( 0.5 * dt * cellDims *
state->lattice.
volume() / mass ) *
1535 #ifdef DEBUG_PRESSURE 1536 iout <<
"strain rate: " << strainRate <<
"\n";
1541 #ifdef DEBUG_PRESSURE 1542 iout <<
iINFO <<
"correcting strain rate for slow, ";
1544 strainRate -= ( 0.5 * dt * cellDims *
state->lattice.
volume() / mass ) *
1546 #ifdef DEBUG_PRESSURE 1547 iout <<
"strain rate: " << strainRate <<
"\n";
1575 #ifdef DEBUG_PRESSURE 1576 iout <<
iINFO <<
"correcting strain rate for nbond, ";
1578 strainRate += ( 0.5 * dt * cellDims *
state->lattice.
volume() / mass ) *
1580 #ifdef DEBUG_PRESSURE 1581 iout <<
"strain rate: " << strainRate <<
"\n";
1586 #ifdef DEBUG_PRESSURE 1587 iout <<
iINFO <<
"correcting strain rate for slow, ";
1589 strainRate += ( 0.5 * dt * cellDims *
state->lattice.
volume() / mass ) *
1591 #ifdef DEBUG_PRESSURE 1592 iout <<
"strain rate: " << strainRate <<
"\n";
1606 strainRate += ( 0.5 * dt * cellDims *
state->lattice.
volume() / mass ) *
1610 #ifdef DEBUG_PRESSURE 1611 iout <<
iINFO <<
"integrating half step, strain rate: " << strainRate <<
"\n";
1617 BigReal f1 = exp( -0.5 * dt_long * gamma );
1618 BigReal f2 = sqrt( ( 1. - f1*f1 ) * kT / mass );
1633 #ifdef DEBUG_PRESSURE 1634 iout <<
iINFO <<
"applying langevin, strain rate: " << strainRate <<
"\n";
1638 #ifdef DEBUG_PRESSURE 1639 iout <<
iINFO <<
"exiting langevinPiston2, strain rate: " << strainRate <<
"\n";
1654 if ( rescaleFreq > 0 ) {
1663 BigReal factor = sqrt(rescaleTemp/avgTemp);
1678 momentum.
x = reduction->
item(REDUCTION_HALFSTEP_MOMENTUM_X);
1679 momentum.
y = reduction->
item(REDUCTION_HALFSTEP_MOMENTUM_Y);
1680 momentum.
z = reduction->
item(REDUCTION_HALFSTEP_MOMENTUM_Z);
1683 if ( momentum.
length2() == 0. )
1684 iout <<
iERROR <<
"Momentum is exactly zero; probably a bug.\n" <<
endi;
1686 NAMD_die(
"Total mass is zero in Controller::correctMomentum");
1688 momentum *= (-1./mass);
1703 iout <<
"FEP: RESETTING FOR NEW FEP WINDOW " 1704 <<
"LAMBDA SET TO " << alchLambda <<
" LAMBDA2 " << alchLambda2;
1705 if ( alchLambdaIDWS >= 0. ) {
1706 iout <<
" LAMBDA_IDWS " << alchLambdaIDWS;
1708 iout <<
"\nFEP: WINDOW TO HAVE " << alchEquilSteps
1709 <<
" STEPS OF EQUILIBRATION PRIOR TO FEP DATA COLLECTION.\n" 1710 <<
"FEP: USING CONSTANT TEMPERATURE OF " << alchTemp
1711 <<
" K FOR FEP CALCULATION\n" <<
endi;
1720 iout <<
"TI: RESETTING FOR NEW WINDOW " 1721 <<
"LAMBDA SET TO " << alchLambda
1722 <<
"\nTI: WINDOW TO HAVE " << alchEquilSteps
1723 <<
" STEPS OF EQUILIBRATION PRIOR TO TI DATA COLLECTION.\n" <<
endi;
1731 if ( ( reassignFreq > 0 ) && ! ( step % reassignFreq ) ) {
1738 if ( newTemp < simParams->reassignHold )
1741 iout <<
"REASSIGNING VELOCITIES AT STEP " << step
1742 <<
" TO " << newTemp <<
" KELVIN.\n" <<
endi;
1786 double coefficient = 1;
1810 static char tmp_string[50];
1811 static char format_string[50];
1812 const double maxnum = 99999999999.9999;
1813 if (
X > maxnum )
X = maxnum;
1814 if (
X < -maxnum )
X = -maxnum;
1816 int whole = (decimal <= 4 ? 14 : 10 + decimal);
1817 sprintf(format_string,
" %%%d.%df", whole, decimal);
1818 sprintf(tmp_string, format_string,
X);
1822 static char *
FORMAT(
const char *
X,
int decimal = 4)
1824 static char tmp_string[50];
1825 static char format_string[50];
1827 int width = (decimal <= 4 ? 14 : 10 + decimal);
1828 sprintf(format_string,
" %%%ds", width);
1829 sprintf(tmp_string, format_string,
X);
1835 static char tmp_string[21];
1836 sprintf(tmp_string,
"ENERGY: %7d",
X);
1878 int numFixedGroups = ( numFixedAtoms ? molecule->
numFixedGroups : 0 );
1881 if ( numFixedGroups ) numGroupDegFreedom -= 3 * numFixedGroups;
1885 numGroupDegFreedom -= 3;
1892 int numFixedRigidBonds =
1897 numDegFreedom -= ( numRigidBonds - numFixedRigidBonds - numLonepairs);
1899 BigReal groupKineticEnergyHalfstep, groupKineticEnergyCentered;
1911 BigReal groupTempHalfstep = 2.0 * groupKineticEnergyHalfstep
1913 BigReal groupTempCentered = 2.0 * groupKineticEnergyCentered
1927 GET_TENSOR(virial_normal, reduction,REDUCTION_VIRIAL_NORMAL);
1928 GET_TENSOR(virial_nbond, reduction,REDUCTION_VIRIAL_NBOND);
1929 GET_TENSOR(virial_slow, reduction,REDUCTION_VIRIAL_SLOW);
1932 GET_TENSOR(altVirial_normal, reduction,REDUCTION_ALT_VIRIAL_NORMAL);
1933 GET_TENSOR(altVirial_nbond, reduction,REDUCTION_ALT_VIRIAL_NBOND);
1934 GET_TENSOR(altVirial_slow, reduction,REDUCTION_ALT_VIRIAL_SLOW);
1937 GET_TENSOR(intVirial_normal, reduction,REDUCTION_INT_VIRIAL_NORMAL);
1938 GET_TENSOR(intVirial_nbond, reduction,REDUCTION_INT_VIRIAL_NBOND);
1939 GET_TENSOR(intVirial_slow, reduction,REDUCTION_INT_VIRIAL_SLOW);
1941 GET_VECTOR(extForce_normal, reduction,REDUCTION_EXT_FORCE_NORMAL);
1942 GET_VECTOR(extForce_nbond, reduction,REDUCTION_EXT_FORCE_NBOND);
1943 GET_VECTOR(extForce_slow, reduction,REDUCTION_EXT_FORCE_SLOW);
1955 BigReal drudeComKE, drudeBondKE;
1985 virial_normal, virial_nbond, virial_slow,
1986 intVirial_normal, intVirial_nbond, intVirial_slow,
1987 extForce_normal, extForce_nbond, extForce_slow);
1989 #ifdef DEBUG_PRESSURE 2018 const Tensor& virial_normal_in,
const Tensor& virial_nbond_in,
const Tensor& virial_slow_in,
2019 const Tensor& intVirial_normal,
const Tensor& intVirial_nbond,
const Tensor& intVirial_slow,
2020 const Vector& extForce_normal,
const Vector& extForce_nbond,
const Vector& extForce_slow) {
2022 Tensor virial_normal = virial_normal_in;
2023 Tensor virial_nbond = virial_nbond_in;
2024 Tensor virial_slow = virial_slow_in;
2027 Tensor tmp = virial_normal;
2028 fprintf(stderr,
"VIRIAL_NORMAL %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf\n",
2032 fprintf(stderr,
"VIRIAL_NBOND %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf\n",
2036 fprintf(stderr,
"VIRIAL_SLOW %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf\n",
2039 tmp = intVirial_normal;
2040 fprintf(stderr,
"INT_VIRIAL_NORMAL %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf\n",
2043 tmp = intVirial_nbond;
2044 fprintf(stderr,
"INT_VIRIAL_NBOND %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf\n",
2047 tmp = intVirial_slow;
2048 fprintf(stderr,
"INT_VIRIAL_SLOW %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf %1.2lf\n",
2051 Vector ext = extForce_normal;
2052 fprintf(stderr,
"EXT_FORCE_NORMAL %1.2lf %1.2lf %1.2lf\n",
2053 ext.
x, ext.
y, ext.
z);
2055 ext = extForce_nbond;
2056 fprintf(stderr,
"EXT_FORCE_NBOND %1.2lf %1.2lf %1.2lf\n",
2057 ext.
x, ext.
y, ext.
z);
2059 ext = extForce_slow;
2060 fprintf(stderr,
"EXT_FORCE_SLOW %1.2lf %1.2lf %1.2lf\n",
2061 ext.
x, ext.
y, ext.
z);
2064 fprintf(stderr,
"LATTICE %lf %lf %lf %lf %lf %lf %lf %lf %lf\n",
2069 fprintf(stderr,
"VOLUME %3.10lf\n",
state->lattice.
volume());
2075 Molecule *molecule = node->molecule;
2080 virial_normal -=
outer(extForce_normal,extPosition);
2081 virial_nbond -=
outer(extForce_nbond,extPosition);
2082 virial_slow -=
outer(extForce_slow,extPosition);
2084 if ( (volume=lattice.
volume()) != 0. )
2088 #ifdef MEM_OPT_VERSION 2089 NAMD_bug(
"LJcorrection not supported in memory optimized build.");
2184 #define AVGXY(T) T.xy = T.yx = 0; T.xx = T.yy = 0.5 * ( T.xx + T.yy );\ 2185 T.xz = T.zx = T.yz = T.zy = 0.5 * ( T.xz + T.yz ); 2212 else if(testV < *Vmin){
2217 delta = testV - *Vavg;
2219 *M2 += delta * (testV - (*Vavg));
2221 *sigmaV = sqrt(*M2/n);
2229 *k0 = (1-sigma0/sigmaV) * (Vmax-Vmin) / (Vavg-Vmin);
2237 *E = Vmin + (Vmax-Vmin)/(*k0);
2243 *k0 = (sigma0 / sigmaV) * (Vmax-Vmin) / (Vmax-Vavg);
2250 *k = *k0 / (Vmax - Vmin);
2260 *vir += vir_orig * (*factor);
2261 *dV += (*factor) * VE/2.;
2270 (
int step_n,
char type,
int V_n,
BigReal Vmax,
BigReal Vmin,
BigReal Vavg,
BigReal sigmaV,
BigReal M2,
BigReal E,
BigReal k,
bool write_topic,
bool lasttime){
2272 char timestepstr[20];
2276 const char *bsuffix;
2278 if(lasttime ||
simParams->restartFrequency == 0){
2287 baselen = strlen(filename);
2288 restart_name =
new char[baselen+26];
2290 strcpy(restart_name, filename);
2291 if (
simParams->restartSave && !lasttime) {
2292 sprintf(timestepstr,
".%d",step_n);
2293 strcat(restart_name, timestepstr);
2296 strcat(restart_name,
".gamd");
2301 rest = fopen(restart_name,
"w");
2303 fprintf(rest,
"# NAMD accelMDG restart file\n" 2304 "# D/T Vn Vmax Vmin Vavg sigmaV M2 E k\n" 2305 "%c %d %.17lg %.17lg %.17lg %.17lg %.17le %.17lg %.17lg\n",
2306 type, V_n-1, Vmax, Vmin, Vavg, sigmaV, M2, E, k);
2308 iout <<
"GAUSSIAN ACCELERATED MD RESTART DATA WRITTEN TO " << restart_name <<
"\n" <<
endi;
2311 iout <<
iWARN <<
"Cannot write accelMDG restart file\n" <<
endi;
2314 rest = fopen(restart_name,
"a");
2316 fprintf(rest,
"%c %d %.17lg %.17lg %.17lg %.17lg %.17le %.17lg %.17lg\n",
2317 type, V_n-1, Vmax, Vmin, Vavg, sigmaV, M2, E, k);
2321 iout <<
iWARN <<
"Cannot write accelMDG restart file\n" <<
endi;
2324 delete[] restart_name;
2358 static BigReal VmaxP, VminP, VavgP, M2P=0, sigmaVP;
2359 static BigReal VmaxD, VminD, VavgD, M2D=0, sigmaVD;
2362 static int V_n = 1, iEusedD, iEusedP;
2363 static char warnD, warnP;
2364 static int restfreq;
2383 BigReal amd_ljEnergy_Corr = 0.;
2400 volume = lattice.
volume();
2444 potentialEnergy = bondEnergy + angleEnergy + dihedralEnergy +
2445 improperEnergy + amd_electEnergy + amd_electEnergySlow + amd_ljEnergy +
2446 crosstermEnergy + boundaryEnergy + miscEnergy +
2447 amd_goTotalEnergy + amd_groLJEnergy + amd_groGaussEnergy;
2452 if(step == firststep) {
2454 warnD = warnP =
'\0';
2460 int dihe_n=0, tot_n=0;
2466 while(fgets(line, 256, rest)){
2468 dihe_n = sscanf(line+1,
" %d %la %la %la %la %la %la %la",
2469 &V_n, &VmaxD, &VminD, &VavgD, &sigmaVD, &M2D, &ED, &kD);
2471 else if(line[0] ==
'T'){
2472 tot_n = sscanf(line+1,
" %d %la %la %la %la %la %la %la",
2473 &V_n, &VmaxP, &VminP, &VavgP, &sigmaVP, &M2P, &EP, &kP);
2484 NAMD_die(
"Invalid dihedral potential energy format in accelMDG restart file");
2485 k0D = kD * (VmaxD - VminD);
2486 iout <<
"GAUSSIAN ACCELERATED MD READ FROM RESTART FILE: DIHED" 2487 <<
" Vmax " << VmaxD <<
" Vmin " << VminD
2488 <<
" Vavg " << VavgD <<
" sigmaV " << sigmaVD
2489 <<
" E " << ED <<
" k " << kD
2496 NAMD_die(
"Invalid total potential energy format in accelMDG restart file");
2497 k0P = kP * (VmaxP - VminP);
2498 iout <<
"GAUSSIAN ACCELERATED MD READ FROM RESTART FILE: TOTAL" 2499 <<
" Vmax " << VmaxP <<
" Vmin " << VminP
2500 <<
" Vavg " << VavgP <<
" sigmaV " << sigmaVP
2501 <<
" E " << EP <<
" k " << kP
2505 iEusedD = (ED == VmaxD) ? 1 : 2;
2506 iEusedP = (EP == VmaxP) ? 1 : 2;
2514 testV = dihedralEnergy + crosstermEnergy;
2517 if(step > firststep && step % restfreq == 0)
2518 write_accelMDG_rest_file(step,
'D', V_n, VmaxD, VminD, VavgD, sigmaVD, M2D, ED, kD,
2523 write_accelMDG_rest_file(step,
'D', V_n, VmaxD, VminD, VavgD, sigmaVD, M2D, ED, kD,
2527 write_accelMDG_rest_file(step,
'D', V_n, VmaxD, VminD, VavgD, sigmaVD, M2D, ED, kD,
2535 VmaxD = VminD = VavgD = testV;
2539 else if(step == ntcmdprep && ntcmdprep != 0){
2541 VmaxD = VminD = VavgD = testV;
2543 iout <<
"GAUSSIAN ACCELERATED MD: RESET DIHEDRAL POTENTIAL STATISTICS\n" <<
endi;
2546 else if(ntave > 0 && step % ntave == 0){
2548 if(testV > VmaxD) VmaxD = testV;
2549 if(testV < VminD) VminD = testV;
2553 iout <<
"GAUSSIAN ACCELERATED MD: RESET DIHEDRAL POTENTIAL AVG AND STD\n" <<
endi;
2558 &VmaxD, &VminD, &VavgD, &M2D, &sigmaVD) ;
2561 if(step == ntcmd - 1){
2563 VmaxD, VminD, VavgD, sigmaVD, &k0D, &kD, &ED, &iEusedD, &warnD);
2567 else if(step < nteb){
2569 &dV, &factor_dihe, &vir);
2574 VmaxD = VminD = VavgD = testV;
2576 iout <<
"GAUSSIAN ACCELERATED MD: RESET DIHEDRAL POTENTIAL STATISTICS\n" <<
endi;
2579 else if(ntave > 0 && step % ntave == 0){
2581 if(testV > VmaxD) VmaxD = testV;
2582 if(testV < VminD) VminD = testV;
2586 iout <<
"GAUSSIAN ACCELERATED MD: RESET DIHEDRAL POTENTIAL AVG AND STD\n" <<
endi;
2590 &VmaxD, &VminD, &VavgD, &M2D, &sigmaVD) ;
2593 if(step >= ntebprep)
2594 if((ntave > 0 && step % ntave == 0) || ntave <= 0)
2596 VmaxD, VminD, VavgD, sigmaVD, &k0D, &kD, &ED, &iEusedD, &warnD);
2601 &dV, &factor_dihe, &vir);
2607 Tensor vir_tot = vir_normal + vir_nbond + vir_slow;
2608 testV = potentialEnergy;
2610 testV -= dihedralEnergy + crosstermEnergy;
2611 vir_tot -= vir_dihe;
2615 if(step > firststep && step % restfreq == 0)
2616 write_accelMDG_rest_file(step,
'T', V_n, VmaxP, VminP, VavgP, sigmaVP, M2P, EP, kP,
2621 write_accelMDG_rest_file(step,
'T', V_n, VmaxP, VminP, VavgP, sigmaVP, M2P, EP, kP,
2625 write_accelMDG_rest_file(step,
'T', V_n, VmaxP, VminP, VavgP, sigmaVP, M2P, EP, kP,
2633 VmaxP = VminP = VavgP = testV;
2637 else if(step == ntcmdprep && ntcmdprep != 0){
2639 VmaxP = VminP = VavgP = testV;
2641 iout <<
"GAUSSIAN ACCELERATED MD: RESET TOTAL POTENTIAL STATISTICS\n" <<
endi;
2644 else if(ntave > 0 && step % ntave == 0){
2646 if(testV > VmaxP) VmaxP = testV;
2647 if(testV < VminP) VminP = testV;
2651 iout <<
"GAUSSIAN ACCELERATED MD: RESET TOTAL POTENTIAL AVG AND STD\n" <<
endi;
2656 &VmaxP, &VminP, &VavgP, &M2P, &sigmaVP);
2658 if(step == ntcmd - 1){
2660 VmaxP, VminP, VavgP, sigmaVP, &k0P, &kP, &EP, &iEusedP, &warnP);
2664 else if(step < nteb){
2666 &dV, &factor_tot, &vir);
2671 VmaxP = VminP = VavgP = testV;
2673 iout <<
"GAUSSIAN ACCELERATED MD: RESET TOTAL POTENTIAL STATISTICS\n" <<
endi;
2676 else if(ntave > 0 && step % ntave == 0){
2678 if(testV > VmaxP) VmaxP = testV;
2679 if(testV < VminP) VminP = testV;
2683 iout <<
"GAUSSIAN ACCELERATED MD: RESET TOTAL POTENTIAL AVG AND STD\n" <<
endi;
2687 &VmaxP, &VminP, &VavgP, &M2P, &sigmaVP);
2690 if(step >= ntebprep)
2691 if((ntave > 0 && step % ntave == 0) || ntave <= 0)
2693 VmaxP, VminP, VavgP, sigmaVP, &k0P, &kP, &EP, &iEusedP, &warnP);
2698 &dV, &factor_tot, &vir);
2705 if((ntcmdprep > 0 && step == ntcmdprep) ||
2706 (step < nteb && ntave > 0 && step % ntave == 0) ||
2719 testV = dihedralEnergy + crosstermEnergy;
2720 if ( testV < accelMDE ) {
2721 factor_dihe = accelMDalpha/(accelMDalpha + accelMDE - testV);
2722 factor_dihe *= factor_dihe;
2723 vir = vir_dihe * (factor_dihe - 1.0);
2724 dV = (accelMDE - testV)*(accelMDE - testV)/(accelMDalpha + accelMDE - testV);
2730 testV = dihedralEnergy + crosstermEnergy;
2731 if ( testV < accelMDE ) {
2732 factor_dihe = accelMDalpha/(accelMDalpha + accelMDE - testV);
2733 factor_dihe *= factor_dihe;
2734 vir = vir_dihe * (factor_dihe - 1.0) ;
2735 dV = (accelMDE - testV)*(accelMDE - testV)/(accelMDalpha + accelMDE - testV);
2738 testV = potentialEnergy - dihedralEnergy - crosstermEnergy;
2739 if ( testV < accelMDTE ) {
2740 factor_tot = accelMDTalpha/(accelMDTalpha + accelMDTE - testV);
2741 factor_tot *= factor_tot;
2742 vir += (vir_normal - vir_dihe + vir_nbond + vir_slow) * (factor_tot - 1.0);
2743 dV += (accelMDTE - testV)*(accelMDTE - testV)/(accelMDTalpha + accelMDTE - testV);
2749 testV = potentialEnergy;
2750 if ( testV < accelMDE ) {
2751 factor_tot = accelMDalpha/(accelMDalpha + accelMDE - testV);
2752 factor_tot *= factor_tot;
2753 vir = (vir_normal + vir_nbond + vir_slow) * (factor_tot - 1.0);
2754 dV = (accelMDE - testV)*(accelMDE - testV)/(accelMDalpha + accelMDE - testV);
2760 accelMDfactor[0]=factor_dihe;
2761 accelMDfactor[1]=factor_tot;
2767 if ( factor_tot < 0.001 ) {
2768 iout <<
iWARN <<
"accelMD is using a very high boost potential, simulation may become unstable!" 2772 if ( ! (step % accelMDOutFreq) ) {
2776 iout <<
"ACCELERATED MD: STEP " << step
2779 <<
" BOND " << bondEnergy
2780 <<
" ANGLE " << angleEnergy
2781 <<
" DIHED " << dihedralEnergy+crosstermEnergy
2782 <<
" IMPRP " << improperEnergy
2783 <<
" ELECT " << amd_electEnergy+amd_electEnergySlow
2784 <<
" VDW " << amd_ljEnergy
2785 <<
" POTENTIAL " << potentialEnergy;
2786 if(amd_ljEnergy_Corr)
2787 iout <<
" LJcorr " << amd_ljEnergy_Corr;
2791 iout <<
"GAUSSIAN ACCELERATED MD: DIHED iE " << iEusedD
2792 <<
" Vmax " << VmaxD <<
" Vmin " << VminD
2793 <<
" Vavg " << VavgD <<
" sigmaV " << sigmaVD
2794 <<
" E " << ED <<
" k0 " << k0D <<
" k " << kD
2797 iout <<
"GAUSSIAN ACCELERATED MD: DIHED !!! WARNING: k0 > 1, " 2798 <<
"SWITCHED TO iE = 1 MODE !!!\n" <<
endi;
2800 iout <<
"GAUSSIAN ACCELERATED MD: DIHED !!! WARNING: k0 <= 0, " 2801 <<
"SWITCHED TO iE = 1 MODE !!!\n" <<
endi;
2803 iout <<
"GAUSSIAN ACCELERATED MD: TOTAL iE " << iEusedP
2804 <<
" Vmax " << VmaxP <<
" Vmin " << VminP
2805 <<
" Vavg " << VavgP <<
" sigmaV " << sigmaVP
2806 <<
" E " << EP <<
" k0 " << k0P <<
" k " << kP
2809 iout <<
"GAUSSIAN ACCELERATED MD: TOTAL !!! WARNING: k0 > 1, " 2810 <<
"SWITCHED TO iE = 1 MODE !!!\n" <<
endi;
2812 iout <<
"GAUSSIAN ACCELERATED MD: TOTAL !!! WARNING: k0 <= 0, " 2813 <<
"SWITCHED TO iE = 1 MODE !!!\n" <<
endi;
2814 warnD = warnP =
'\0';
2824 if ( volume != 0. ) {
2825 p_normal = vir_normal/volume;
2826 p_nbond = vir_nbond/volume;
2827 p_slow = vir_slow/volume;
2830 iout <<
" accelMD Scaling Factor: " << accelMDfactor <<
"\n" 2831 <<
" accelMD PNORMAL " << trace(p_normal)*
PRESSUREFACTOR/3. <<
"\n" 2832 <<
" accelMD PNBOND " << trace(p_nbond)*
PRESSUREFACTOR/3. <<
"\n" 2842 iout <<
iINFO <<
"INITIALISING ADAPTIVE TEMPERING\n" <<
endi;
2847 iout <<
iINFO <<
"READING ADAPTIVE TEMPERING RESTART FILE\n" <<
endi;
2849 if (adaptTempRead) {
2854 adaptTempRead >> readInt;
2887 adaptTempRead.close();
2889 else NAMD_die(
"Could not open ADAPTIVE TEMPERING restart file.\n");
2929 iout <<
iINFO <<
"ADAPTIVE TEMPERING: ADAPTIVE BIN AVERAGING PARAMETER: " <<
adaptTempCg <<
"\n";
2930 iout <<
iINFO <<
"ADAPTIVE TEMPERING: SCALING CONSTANT FOR LANGEVIN TEMPERATURE UPDATES: " <<
adaptTempDt <<
"\n";
2936 NAMD_die(
"Error opening restart file");
2943 iout <<
"ADAPTEMP: WRITING RESTART FILE AT STEP " << step <<
"\n" <<
endi;
2975 if (
minimize || (step < simParams->adaptTempFirstStep ) ||
2985 <<
" adaptTempBeta: " << adaptTempBeta
3004 potEnergyVariance -= potEnergyAverage*potEnergyAverage;
3017 BigReal deltaBeta = 0.04*adaptTempBeta;
3024 betaMinus = adaptTempBeta - deltaBeta;
3025 betaPlus = adaptTempBeta + deltaBeta;
3026 BigReal betaMinus2 = betaMinus*betaMinus;
3027 BigReal betaPlus2 = betaPlus*betaPlus;
3045 DeltaE2AveSum += DeltaE2Ave;
3054 A0 /= (betaNp1-betaMinus);
3061 DeltaE2AveSum += DeltaE2Ave;
3072 A1 /= (betaPlus-betaNp1);
3081 if (DeltaE2Ave != 0) {
3082 aplus = (A0-A2)/(A0-A1);
3092 potEnergyAve0 /= (betaNp1-betaMinus);
3097 potEnergyAve1 /= (betaPlus-betaNp1);
3098 potEnergyAverage = aminus*potEnergyAve0;
3099 potEnergyAverage += aplus*potEnergyAve1;
3102 iout <<
"ADAPTEMP DEBUG:" <<
"\n" 3105 <<
" adaptTempBeta: " << adaptTempBeta <<
"\n" 3109 <<
" gammaAve: " << gammaAve <<
"\n" 3110 <<
" deltaBeta: " << deltaBeta <<
"\n" 3111 <<
" betaMinus: " << betaMinus <<
"\n" 3112 <<
" betaPlus: " << betaPlus <<
"\n" 3113 <<
" nMinus: " << nMinus <<
"\n" 3114 <<
" nPlus: " << nPlus <<
"\n" 3115 <<
" A0: " << A0 <<
"\n" 3116 <<
" A1: " << A1 <<
"\n" 3117 <<
" A2: " << A2 <<
"\n" 3118 <<
" a+: " << aplus <<
"\n" 3119 <<
" a-: " << aminus <<
"\n" 3125 iout <<
"ADAPTEMP DEBUG:" <<
"\n" 3128 <<
" adaptTempBeta: " << adaptTempBeta <<
"\n" 3132 <<
" gammaAve: " << gammaAve <<
"\n" 3133 <<
" deltaBeta: N/A\n" 3134 <<
" betaMinus: N/A\n" 3135 <<
" betaPlus: N/A\n" 3194 if (adaptTempTdiff > 0) {
3206 iout <<
"ADAPTEMP: " << step <<
" FRAC " << Frac <<
"\n";
3209 iout <<
"ADAPTEMP: Updating adaptTempDt to ";
3222 if (adaptTempTdiff > 0) {
3234 iout <<
"ADAPTEMP: " << step <<
" FRAC " << Frac <<
"\n";
3237 iout <<
"ADAPTEMP: Updating adaptTempDt to ";
3252 if ( ! (step % adaptTempOutFreq) ) {
3253 iout <<
"ADAPTEMP: STEP " << step
3255 <<
" ENERGY " << std::setprecision(10) << potentialEnergy
3256 <<
" ENERGYAVG " << std::setprecision(10) << potEnergyAverage
3257 <<
" ENERGYVAR " << std::setprecision(10) << potEnergyVariance;
3275 if ( ((
int)checksum) != molecule->
numAtoms && step != 0) {
3276 sprintf(errmsg,
"Bad global atom count! (%d vs %d)\n",
3277 (
int)checksum, molecule->
numAtoms);
3285 computesPartitioned = 0;
3286 }
else if ( (
int)checksum >
computeChecksum && ! computesPartitioned ) {
3287 computesPartitioned = 1;
3289 NAMD_bug(
"Bad global compute count!\n");
3294 if ( checksum_b && (((
int)checksum) != molecule->
numCalcBonds) ) {
3295 sprintf(errmsg,
"Bad global bond count! (%d vs %d)\n",
3297 if ( forgiving && (((
int)checksum) < molecule->
numCalcBonds) )
3304 if ( checksum_b && (((
int)checksum) != molecule->
numCalcAngles) ) {
3305 sprintf(errmsg,
"Bad global angle count! (%d vs %d)\n",
3307 if ( forgiving && (((
int)checksum) < molecule->
numCalcAngles) )
3313 sprintf(errmsg,
"Bad global dihedral count! (%d vs %d)\n",
3322 sprintf(errmsg,
"Bad global improper count! (%d vs %d)\n",
3330 if ( checksum_b && (((
int)checksum) != molecule->
numCalcTholes) ) {
3331 sprintf(errmsg,
"Bad global Thole count! (%d vs %d)\n",
3333 if ( forgiving && (((
int)checksum) < molecule->
numCalcTholes) )
3339 if ( checksum_b && (((
int)checksum) != molecule->
numCalcAnisos) ) {
3340 sprintf(errmsg,
"Bad global Aniso count! (%d vs %d)\n",
3342 if ( forgiving && (((
int)checksum) < molecule->
numCalcAnisos) )
3349 sprintf(errmsg,
"Bad global crossterm count! (%d vs %d)\n",
3358 sprintf(errmsg,
"Bad global 1-4 NbThole count! (%d vs %d)\n",
3369 iout <<
iWARN <<
"High global exclusion count (" 3370 << ((
int64)checksum) <<
" vs " 3372 <<
iWARN <<
"This warning is not unusual during minimization.\n" 3373 <<
iWARN <<
"Decreasing pairlistdist or cutoff that is too close to periodic cell size may avoid this.\n" <<
endi;
3376 sprintf(errmsg,
"High global exclusion count! (%lld vs %lld) System unstable or pairlistdist or cutoff too close to periodic cell size.\n",
3385 iout <<
iWARN <<
"Low global exclusion count! (" 3389 <<
iWARN <<
"This warning is not unusual during minimization.\n" 3390 <<
iWARN <<
"Increasing pairlistdist or cutoff may avoid this.\n";
3392 iout <<
" System unstable or pairlistdist or cutoff too small.\n";
3397 sprintf(errmsg,
"Low global exclusion count! (%lld vs %lld) System unstable or pairlistdist or cutoff too small.\n",
3403 #if defined(NAMD_CUDA) || defined(NAMD_HIP) 3408 iout <<
iWARN <<
"High global CUDA exclusion count (" 3409 << ((
int64)checksum) <<
" vs " 3411 <<
iWARN <<
"This warning is not unusual during minimization.\n" 3412 <<
iWARN <<
"Decreasing pairlistdist or cutoff that is too close to periodic cell size may avoid this.\n" <<
endi;
3415 sprintf(errmsg,
"High global CUDA exclusion count! (%lld vs %lld) System unstable or pairlistdist or cutoff too close to periodic cell size.\n",
3424 iout <<
iWARN <<
"Low global CUDA exclusion count! (" 3428 <<
iWARN <<
"This warning is not unusual during minimization.\n" 3429 <<
iWARN <<
"Increasing pairlistdist or cutoff may avoid this.\n";
3431 iout <<
" System unstable or pairlistdist or cutoff too small.\n";
3436 sprintf(errmsg,
"Low global CUDA exclusion count! (%lld vs %lld) System unstable or pairlistdist or cutoff too small.\n",
3445 iout <<
iERROR <<
"Margin is too small for " << ((int)checksum) <<
3446 " atoms during timestep " << step <<
".\n" <<
iERROR <<
3447 "Incorrect nonbonded forces and energies may be calculated!\n" <<
endi;
3454 "Pairlistdist is too small for " << ((int)checksum) <<
3455 " computes during timestep " << step <<
".\n" <<
endi;
3462 iout <<
iWARN <<
"Stray PME grid charges ignored!\n" <<
endi;
3463 else NAMD_bug(
"Stray PME grid charges detected!\n");
3472 const double endCTime = CmiTimer() - firstCTime;
3475 if ( (((
int)endWTime)>>6) != (((
int)startWTime)>>6 ) )
fflush_count = 2;
3477 const double elapsedW =
3479 const double elapsedC =
3482 const double remainingW = elapsedW * (
simParams->
N - step);
3483 const double remainingW_hours = remainingW / 3600;
3485 startWTime = endWTime;
3486 startCTime = endCTime;
3488 #if defined(NAMD_CUDA) || defined(NAMD_HIP) 3491 iout <<
iWARN <<
"Energy evaluation is expensive, increase computeEnergies to improve performance.\n" <<
endi;
3492 iout <<
iWARN <<
"If computeEnergies is not defined, its value defaults to the same as outputEnergies, and increasing outputEnergies would be helpful to improve the performance.\n" <<
endi;
3498 BigReal days = 1.0 / (24.0 * 60.0 * 60.0);
3499 BigReal nsPerDay = ns / (elapsedW * days);
3500 CmiPrintf(
"TIMING: %d CPU: %g, %g/step Wall: %g, %g/step" 3502 ", %g hours remaining, %f MB of memory in use.\n",
3503 step, endCTime, elapsedC, endWTime, elapsedW,
3508 CmiPrintf(
"TIMING: %d CPU: %g, %g/step Wall: %g, %g/step" 3509 ", %g hours remaining, %f MB of memory in use.\n",
3510 step, endCTime, elapsedC, endWTime, elapsedW,
3520 double ns_per_day = (
simParams->
dt / t_avg) * (60 * 60 * 24 * 1e-6);
3521 CmiPrintf(
"PERFORMANCE: %d averaging %g ns/day, %g sec/step with" 3522 " standard deviation %g\n", step, ns_per_day, t_avg, t_std);
3526 if (benchmarkTime > 0 && benchmarkTime <= endWTime) {
3529 sprintf(s,
"Exceeded benchmark time limit %g seconds",
3555 #ifdef DEBUG_MINIMIZE 3556 printf(
"%s, line %d\n", __FILE__, __LINE__);
3557 printf(
"Step %d:\n", step);
3581 BigReal totalPotentialEnergy = 0.0;
3582 BigReal bondEnergy, angleEnergy, dihedralEnergy;
3583 BigReal improperEnergy, crosstermEnergy;
3597 totalPotentialEnergy += bondEnergy + angleEnergy + dihedralEnergy +
3598 improperEnergy + crosstermEnergy + miscEnergy
3617 #ifdef MEM_OPT_VERSION 3618 NAMD_bug(
"LJcorrection not supported in memory optimized build.");
3627 printf(
"MC-data (TotalPotentialEnergy): step: %d, Pe: %d, Bond: %f, Angle: %f, Dih: %f, IMP: %f, Cross: %f\n",
3628 step, CkMyPe(), bondEnergy, angleEnergy, dihedralEnergy, improperEnergy, crosstermEnergy);
3629 printf(
"MC-data (TotalPotentialEnergy): step: %d, Pe: %d, LJ: %f, Real: %f, Recip: %f\n", step, CkMyPe(),
3631 printf(
"MC-data (TotalPotentialEnergy): step: %d, Pe: %d, MISC: %f, BC: %f, TOTAL: %f\n", step, CkMyPe(),
3632 miscEnergy, bcEnergy, totalPotentialEnergy);
3635 return totalPotentialEnergy;
3715 #ifdef MEM_OPT_VERSION 3716 NAMD_bug(
"LJcorrection not supported in memory optimized build.");
3745 momentum.
x = reduction->
item(REDUCTION_MOMENTUM_X);
3746 momentum.
y = reduction->
item(REDUCTION_MOMENTUM_Y);
3747 momentum.
z = reduction->
item(REDUCTION_MOMENTUM_Z);
3748 angularMomentum.
x = reduction->
item(REDUCTION_ANGULAR_MOMENTUM_X);
3749 angularMomentum.
y = reduction->
item(REDUCTION_ANGULAR_MOMENTUM_Y);
3750 angularMomentum.
z = reduction->
item(REDUCTION_ANGULAR_MOMENTUM_Z);
3753 potentialEnergy = (bondEnergy + angleEnergy + dihedralEnergy
3756 + crosstermEnergy + boundaryEnergy + miscEnergy +
goTotalEnergy 3760 if ( ! cudaIntegrator) {
3777 if (step <= simParams->firstTimestep &&
3785 iout <<
"MOMENTUM: " << step
3786 <<
" P: " << momentum
3787 <<
" L: " << angularMomentum
3792 if ( ! cudaIntegrator ) {
3798 if (cudaIntegrator) {
3834 iout <<
"PRESSURE: " << step <<
" " 3836 <<
"GPRESSURE: " << step <<
" " 3842 <<
"GPRESSAVG: " << step <<
" " 3848 iout <<
"PRESSURE: " << step <<
" " 3850 <<
"GPRESSURE: " << step <<
" " 3854 <<
"GPRESSAVG: " << step <<
" " 3870 memset(total, 0, arraysize*
sizeof(
BigReal));
3879 if (!(step % freq)) {
3883 iout <<
"PRESSUREPROFILE: " << step <<
" ";
3884 if (step == first) {
3886 for (
int i=0; i<arraysize; i++) {
3887 iout << total[i] * scalefac <<
" ";
3892 for (
int i=0; i<arraysize; i++)
3907 if ( benchPhase > 0 && benchPhase < 10 ) {
3908 #if defined(NAMD_CUDA) || defined(NAMD_HIP) 3910 iout <<
iWARN <<
"Energy evaluation is expensive, increase computeEnergies to improve performance.\n";
3911 iout <<
iWARN <<
"If computeEnergies is not defined, its value defaults to the same as outputEnergies, and increasing outputEnergies would be helpful to improve the performance.\n";
3915 if ( benchPhase < 4 )
iout <<
"Initial time: ";
3916 else iout <<
"Benchmark time: ";
3917 iout << CkNumPes() <<
" CPUs ";
3923 BigReal days = 1.0 / (24.0 * 60.0 * 60.0);
3926 BigReal nsPerDay = ns / (wallPerStep * days);
3927 iout << wallPerStep <<
" s/step " << nsPerDay <<
" ns/day ";
3930 BigReal daysPerNano = wallPerStep * days / ns;
3931 iout << wallPerStep <<
" s/step " << daysPerNano <<
" days/ns ";
3944 Vector pairVDWForce, pairElectForce;
3946 GET_VECTOR(pairVDWForce,reduction,REDUCTION_PAIR_VDW_FORCE);
3947 GET_VECTOR(pairElectForce,reduction,REDUCTION_PAIR_ELECT_FORCE);
3957 #define CALLBACKDATA(LABEL,VALUE) \ 3958 labels << (LABEL) << " "; values << (VALUE) << " "; 3959 #define CALLBACKLIST(LABEL,VALUE) \ 3960 labels << (LABEL) << " "; values << "{" << (VALUE) << "} "; 3963 std::ostringstream labels, values;
3966 values.precision(16);
3968 values << std::setprecision(16);
3991 labels <<
"PERIODIC "; values <<
"{" << lattice.
a_p() <<
" " 3992 << lattice.
b_p() <<
" " << lattice.
c_p() <<
"} ";
4018 CALLBACKLIST(
"BOND2", bondEnergy + angleEnergy + dihedralEnergy +
4025 labels <<
'\0'; values <<
'\0';
4026 state->callback_labelstring = labels.str();
4027 state->callback_valuestring = values.str();
4033 if ( ! cudaIntegrator) {
4045 " steps.\n" <<
endi;
4056 #ifdef NODEGROUP_FORCE_REGISTER 4058 CProxy_PatchData cpdata(CkpvAccess(BOCclass_group).patchData);
4059 imd = cpdata.ckLocalBranch()->imd;
4078 energies.
tstep = step;
4081 energies.
Epot = potentialEnergy;
4084 energies.
Ebond = bondEnergy;
4085 energies.
Eangle = angleEnergy;
4086 energies.
Edihe = dihedralEnergy + crosstermEnergy;
4087 energies.
Eimpr = improperEnergy;
4108 if (cudaIntegrator) {
4119 " margin violations detected since previous energy output.\n" <<
endi;
4126 iout <<
"ETITLE: TS";
4142 if (cudaIntegrator) {
4150 if ( volume != 0. ) {
4188 iout <<
"\nTITITLE: TS";
4202 iout <<
"\nFEPTITLE: TS";
4215 iout <<
"QMETITLE: TS";
4230 iout <<
FORMAT(dihedralEnergy+crosstermEnergy, precision);
4246 if (cudaIntegrator) {
4261 if (cudaIntegrator) {
4318 iout <<
FORMAT(bondEnergy + angleEnergy + dihedralEnergy
4330 #if(CMK_CCS_AVAILABLE && CMK_WEB_MODE) 4333 (
int)(potentialEnergy),
4335 CApplicationDepositNode0Data(webout);
4339 iout <<
"PAIR INTERACTION:";
4340 iout <<
" STEP: " << step;
4341 iout <<
" VDW_FORCE: ";
4345 iout <<
" ELECT_FORCE: ";
4365 file <<
"#$LABELS step";
4366 if ( lattice.
a_p() ) file <<
" a_x a_y a_z";
4367 if ( lattice.
b_p() ) file <<
" b_x b_y b_z";
4368 if ( lattice.
c_p() ) file <<
" c_x c_y c_z";
4369 file <<
" o_x o_y o_z";
4371 file <<
" s_x s_y s_z s_u s_v s_w";
4374 file <<
" v_x v_y v_z";
4383 if ( lattice.
a_p() ) file <<
" " << lattice.
a().
x <<
" " << lattice.
a().
y <<
" " << lattice.
a().
z;
4384 if ( lattice.
b_p() ) file <<
" " << lattice.
b().
x <<
" " << lattice.
b().
y <<
" " << lattice.
b().
z;
4385 if ( lattice.
c_p() ) file <<
" " << lattice.
c().
x <<
" " << lattice.
c().
y <<
" " << lattice.
c().
z;
4390 file <<
" " << strainRate.
x;
4391 file <<
" " << strainRate.
y;
4392 file <<
" " << strainRate.
z;
4393 file <<
" " << strainRate2.
x;
4394 file <<
" " << strainRate2.
y;
4395 file <<
" " << strainRate2.
z;
4430 #ifndef MEM_OPT_VERSION 4453 if (alchEnsembleAvg && (stepInRun == 0 || stepInRun == alchEquilSteps)) {
4464 #
if defined(NAMD_CUDA) || defined(NAMD_HIP)
4481 if (stepInRun == 0) {
4485 iout <<
"OPENING FEP ENERGY OUTPUT FILE\n" <<
endi;
4486 if(alchEnsembleAvg){
4489 <<
"vdW dE dE_avg Temp dG\n" 4491 <<
" l l+dl E(l+dl)-E(l)" << std::endl;
4497 <<
" l l+dl E(l+dl)-E(l)" << std::endl;
4501 fepFile <<
"#NEW FEP WINDOW: " 4502 <<
"LAMBDA SET TO " << alchLambda <<
" LAMBDA2 " 4510 if ((alchEquilSteps) && (stepInRun == alchEquilSteps)) {
4511 fepFile <<
"#" << alchEquilSteps <<
" STEPS OF EQUILIBRATION AT " 4513 <<
"#STARTING COLLECTION OF ENSEMBLE AVERAGE" << std::endl;
4519 if (alchEnsembleAvg && (step ==
simParams->
N)) {
4521 fepFile <<
"#Free energy change for lambda window [ " << alchLambda
4523 <<
" ; net change until now is " <<
fepSum << std::endl;
4536 if (stepInRun == 0 || stepInRun == alchEquilSteps) {
4549 #if defined(NAMD_CUDA) || defined(NAMD_HIP) 4562 computeTIderivative(step);
4563 #if defined(NAMD_CUDA) || defined(NAMD_HIP) 4570 if (stepInRun == 0 || stepInRun == alchEquilSteps
4583 #if defined(NAMD_CUDA) || defined(NAMD_HIP) 4596 #if defined(NAMD_CUDA) || defined(NAMD_HIP) 4600 if (stepInRun == 0) {
4610 iout <<
"OPENING TI ENERGY OUTPUT FILE\n" <<
endi;
4611 tiFile <<
"#TITITLE: TS";
4626 if (alchLambdaFreq > 0) {
4633 if (alchLambdaFreq > 0) {
4634 tiFile <<
"#ALCHEMICAL SWITCHING ACTIVE " 4636 <<
"\n#LAMBDA SCHEDULE: " 4638 <<
" Freq: " << alchLambdaFreq;
4648 tiFile <<
"#NEW TI WINDOW: " 4649 <<
"LAMBDA " << alchLambda
4650 <<
"\n#PARTITION 1 SCALING: BOND " << bond_lambda_1
4651 <<
" VDW " << vdw_lambda_1 <<
" ELEC " << elec_lambda_1
4652 <<
"\n#PARTITION 2 SCALING: BOND " << bond_lambda_2
4653 <<
" VDW " << vdw_lambda_2 <<
" ELEC " << elec_lambda_2;
4659 if ((alchEquilSteps) && (stepInRun == alchEquilSteps)) {
4660 tiFile <<
"#" << alchEquilSteps <<
" STEPS OF EQUILIBRATION AT " 4662 <<
"#STARTING COLLECTION OF ENSEMBLE AVERAGE" << std::endl;
4696 (elec_lambda_12 - elec_lambda_1)*
4700 (elec_lambda_22 - elec_lambda_2)*
4706 void Controller::computeTIderivative(
const int step) {
4758 if(alchEnsembleAvg){
4763 if(alchEnsembleAvg){
4806 iout <<
"OPENING EXTENDED SYSTEM TRAJECTORY FILE\n" <<
endi;
4810 if ( errno == EINTR ) {
4811 CkPrintf(
"Warning: Interrupted system call opening XST trajectory file, retrying.\n");
4820 xstFile <<
"# NAMD extended system trajectory file" << std::endl;
4833 iout <<
"WRITING EXTENDED SYSTEM TO RESTART FILE AT STEP " 4834 << step <<
"\n" <<
endi;
4836 const char *bsuffix =
".old";
4839 char timestepstr[20];
4840 sprintf(timestepstr,
".%d",step);
4841 strcat(fname, timestepstr);
4844 strcat(fname,
".xsc");
4848 if ( errno == EINTR ) {
4849 CkPrintf(
"Warning: Interrupted system call opening XSC restart file, retrying.\n");
4851 xscFile.
open(fname);
4855 sprintf(err_msg,
"Error opening XSC restart file %s",fname);
4858 xscFile <<
"# NAMD extended system configuration restart file" << std::endl;
4863 sprintf(err_msg,
"Error writing XSC restart file %s",fname);
4875 iout <<
"WRITING EXTENDED SYSTEM TO OUTPUT FILE AT STEP " 4876 << realstep <<
"\n" <<
endi;
4879 strcat(fname,
".xsc");
4883 if ( errno == EINTR ) {
4884 CkPrintf(
"Warning: Interrupted system call opening XSC output file, retrying.\n");
4886 xscFile.
open(fname);
4890 sprintf(err_msg,
"Error opening XSC output file %s",fname);
4893 xscFile <<
"# NAMD extended system configuration output file" << std::endl;
4898 sprintf(err_msg,
"Error writing XSC output file %s",fname);
4907 iout <<
"CLOSING EXTENDED SYSTEM TRAJECTORY FILE\n" <<
endi;
4924 NAMD_die(
"Unable to load checkpoint, requested key was never stored.");
4930 NAMD_die(
"Unable to swap checkpoint, requested key was never stored.");
4936 NAMD_die(
"Unable to free checkpoint, requested key was never stored.");
4949 CkpvAccess(_qd)->process();
4970 broadcast->cycleBarrier.publish(step,1);
4971 CkPrintf(
"Cycle time at sync Wall: %f CPU %f\n",
4978 CkPrintf(
"Cycle time at trace sync (begin) Wall at step %d: %f CPU %f\n", step,
namdWallTimer()-firstWTime,CmiTimer()-firstCTime);
4979 CProxy_Node nd(CkpvAccess(BOCclass_group).node);
4980 nd.traceBarrier(turnOnTrace, step);
4986 CkPrintf(
"Cycle time at trace sync (end) Wall at step %d: %f CPU %f\n", step,
namdWallTimer()-firstWTime,CmiTimer()-firstCTime);
4990 #ifdef MEASURE_NAMD_WITH_PAPI 4991 void Controller::papiMeasureBarrier(
int turnOnMeasure,
int step){
4992 CkPrintf(
"Cycle time at PAPI measurement sync (begin) Wall at step %d: %f CPU %f\n", step,
namdWallTimer()-firstWTime,CmiTimer()-firstCTime);
4993 CProxy_Node nd(CkpvAccess(BOCclass_group).node);
4994 nd.papiMeasureBarrier(turnOnMeasure, step);
4998 void Controller::resumeAfterPapiMeasureBarrier(
int step){
4999 broadcast->papiMeasureBarrier.publish(step,1);
5000 CkPrintf(
"Cycle time at PAPI measurement sync (end) Wall at step %d: %f CPU %f\n", step,
namdWallTimer()-firstWTime,CmiTimer()-firstCTime);
5007 CthFree(threadWrapper->
thread);
5008 delete threadWrapper;
5013 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
Vector gaussian_vector(void)
static NAMD_HOST_DEVICE Tensor symmetric(const Vector &v1, const Vector &v2)
Bool accelMDGresetVaftercmd
BigReal berendsenPressureCompressibility
NAMD_HOST_DEVICE void rescale(Tensor factor)
MovingAverage groupPressureAverage_xx
void enqueueCollections(int)
Tensor controlPressure_slow
char scriptStringArg1[128]
BigReal berendsenPressureRelaxationTime
std::ostream & iINFO(std::ostream &s)
#define CALLBACKDATA(LABEL, VALUE)
void recvCheckpointReq(const char *key, int task, checkpoint &cp)
void cycleBarrier(int, int)
void rescaleVelocities(int)
void rescaleaccelMD(int step, int minimize=0)
MovingAverage groupPressureAverage_yx
BigReal monteCarloAcceptanceRate
void write_accelMDG_rest_file(int step_n, char type, int V_n, BigReal Vmax, BigReal Vmin, BigReal Vavg, BigReal sigmaV, BigReal M2, BigReal E, BigReal k, bool write_topic, bool lasttime)
NAMD_HOST_DEVICE Vector c() const
BigReal getBondLambda(const BigReal) const
void compareChecksums(int, int=0)
Tensor groupPressure_nbond
void NAMD_err(const char *err_msg)
std::map< std::string, checkpoint * > checkpoints
BigReal langevinPistonTemp
SimpleBroadcastObject< int > traceBarrier
void calcPressure(int step, int minimize, const Tensor &virial_normal_in, const Tensor &virial_nbond_in, const Tensor &virial_slow_in, const Tensor &intVirial_normal, const Tensor &intVirial_nbond, const Tensor &intVirial_slow, const Vector &extForce_normal, const Vector &extForce_nbond, const Vector &extForce_slow)
Bool monteCarloPressureOn
NAMD_HOST_DEVICE int c_p() const
void NAMD_quit(const char *err_msg)
int movingAverageWindowSize
MovingAverage pressureAverage_xx
MovingAverage groupPressureAverage_yy
int mc_accept[MC_AXIS_TOTAL]
void adaptTempWriteRestart(int step)
SimpleBroadcastObject< Vector > momentumCorrection
virtual void require(const bool clearData=true)=0
virtual void algorithm(void)
static PatchMap * Object()
void calc_accelMDG_mean_std(BigReal testV, int step_n, BigReal *Vmax, BigReal *Vmin, BigReal *Vavg, BigReal *M2, BigReal *sigmaV)
void adaptTempInit(int step)
MovingAverage groupPressureAverage_zx
NAMD_HOST_DEVICE Tensor outer(const Vector &v1, const Vector &v2)
BigReal alchElecLambdaStart
char adaptTempInFile[NAMD_FILENAME_BUFFER_SIZE]
PressureProfileReduction(int rtag, int numslabs, int numpartitions, const char *myname, int outputfreq)
zVector monteCarloMaxVolume
virtual void submit(void)=0
SimParameters * simParameters
void printMinimizeEnergies(int)
BigReal multigratorPressureTarget
void(* namd_sighandler_t)(int)
int accelMDGEquiPrepSteps
double stochRescaleCoefficient()
Bool CUDASOAintegrateMode
BigReal surfaceTensionTarget
void writeExtendedSystemLabels(ofstream_namd &file)
void monteCarloPressure_accept(int)
MovingAverage pressureAverage_zx
void enqueueVelocities(int seq)
std::vector< BigReal > multigratorOmega
std::ostream & endi(std::ostream &s)
BigReal alchBondLambdaEnd
BigReal sum_of_squared_gaussians(int64_t num_gaussians)
Return the sum of i.i.d. squared Gaussians.
BigReal electEnergySlow_f
MovingAverage totalEnergyAverage
std::vector< BigReal > multigratorNuT
int berendsenPressureFreq
static char * FEPTITLE2(int X)
MovingAverage temperatureAverage
MovingAverage groupPressureAverage_yz
std::ostream & iWARN(std::ostream &s)
SubmitReduction * willSubmit(int setID, int size=-1)
int monteCarloAdjustmentFreq
SimpleBroadcastObject< BigReal > adaptTemperature
Tensor groupPressure_tavg
Bool langevinPistonBarrier
BigReal * adaptTempPotEnergyAveNum
static ReductionMgr * Object(void)
#define NAMD_FILENAME_BUFFER_SIZE
BigReal getElecLambda(const BigReal) const
#define GET_TENSOR(O, R, A)
static char * FEPTITLE(int X)
BigReal recent_dEdl_bond_2
void enqueuePositions(int seq, Lattice &lattice)
SimpleBroadcastObject< BigReal > tcoupleCoefficient
void outputPatchComputeMaps(const char *filename, int tag)
~PressureProfileReduction()
int mc_trial[MC_AXIS_TOTAL]
void swap(Array< T > &s, Array< T > &t)
Molecule stores the structural information for the system.
NAMD_HOST_DEVICE int b_p() const
MovingAverage groupPressureAverage_xy
MovingAverage pressureAverage_yy
void split(int iStream, int numStreams)
RequireReduction * amd_reduction
static NAMD_HOST_DEVICE Tensor identity(BigReal v1=1.0)
char outputFilename[NAMD_FILENAME_BUFFER_SIZE]
void multigratorTemperature(int step, int callNumber)
static double namdWallTimer()
void gather_energies(IMDEnergies *energies)
BigReal mc_totalEnergyOld
MovingAverage pressureAverage_zz
void enqueuePositionsDcdSelection(int seq, Lattice &lattice)
SimpleBroadcastObject< BigReal > stochRescaleCoefficient
void langevinPiston1(int)
SimpleBroadcastObject< int > monteCarloBarostatAcceptance
void outputTiEnergy(int step)
Tensor langevinPiston_strainRate
BigReal langevinPistonDecay
std::vector< BigReal > multigratorNu
BigReal adaptTempDTavenum
Lattice checkpoint_lattice
PressureProfileReduction * ppint
ofstream_namd adaptTempRestartFile
BigReal berendsenPressureTarget
ControllerState checkpoint_state
BigReal stochRescalePeriod
void writeExtendedSystemData(int step, ofstream_namd &file)
ControllerBroadcasts * broadcast
BigReal computeAlchWork(const int step)
static std::pair< int, int > coordinateNeeded(int timestep)
Check if the step requires to output the coordinates.
Tensor groupPressure_slow
BigReal * adaptTempPotEnergyVar
BigReal getEnergyTailCorr(const BigReal, const int)
BigReal groupPressure_avg
int numLonepairs
Number of lone pairs.
double standard_deviation() const
std::vector< BigReal > multigratorZeta
void stochRescaleVelocities(int)
int64 numCalcFullExclusions
void gather_time(IMDTime *time)
void NAMD_bug(const char *err_msg)
BigReal recent_dEdl_elec_2
BigReal bondedEnergyDiff_f
void correctMomentum(int step)
BigReal recent_dEdl_elec_1
bool isMultiTimeStepping()
void berendsenPressure(int)
static NAMD_HOST_DEVICE Tensor diagonal(const Vector &v1)
MovingAverage groupPressureAverage_xz
static char * ETITLE(int X)
void rebalance(Sequencer *seq, PatchID id)
SimpleBroadcastObject< Tensor > velocityRescaleTensor2
void langevinPiston2(int)
int numMolecules
Number of 1-4 atom pairs with NBThole defined.
BigReal kineticEnergyCentered
MovingAverage groupPressureAverage_zy
MovingAverage pressureAverage_zy
BigReal electEnergySlow_ti_1
char adaptTempRestartFile[NAMD_FILENAME_BUFFER_SIZE]
SimpleBroadcastObject< int > IMDTimeEnergyBarrier
SubmitReduction * submit_reduction
void add_sample(double x)
NAMD_HOST_DEVICE BigReal length2(void) const
void recvCheckpointAck(checkpoint &cp)
static char * FORMAT(BigReal X, int decimal=4)
BigReal rescaleVelocities_sumTemps
SimpleBroadcastObject< int > scriptBarrier
RequireReduction * reductionGpuResident
int berendsenPressure_count
int monteCarloPressureFreq
NAMD_HOST_DEVICE BigReal volume(void) const
NAMD_HOST_DEVICE int a_p() const
static char * FEPTITLE_BACK(int X)
int num_fixed_atoms() const
SimpleBroadcastObject< BigReal > velocityRescaleFactor2
RequireReduction * multigratorReduction
BigReal electEnergyPME_ti_1
void receivePressure(int step, int minimize=0)
char alchOutFile[NAMD_FILENAME_BUFFER_SIZE]
int multigratorNoseHooverChainLength
BigReal multigratorTemperatureTarget
#define GET_VECTOR(O, R, A)
BigReal multigratorPressureRelaxationTime
void NAMD_die(const char *err_msg)
Tensor groupPressure_normal
static LdbCoordinator * Object()
BigReal getVirialTailCorr(const BigReal)
static int forceNeeded(int timestep)
Check if the step requires to output the forces.
SimpleBroadcastObject< BigReal > velocityRescaleFactor
void publish(int tag, const T &t)
SimpleBroadcastObject< BigReal > minimizeCoefficient
Bool pressureProfileEwaldOn
NAMD_HOST_DEVICE Vector b() const
void reassignVelocities(int)
SimpleBroadcastObject< Vector > accelMDRescaleFactor
void getData(int firsttimestep, int step, const Lattice &lattice, BigReal *total)
void printEnergies(int step, int minimize)
BigReal multigratorTemperatureRelaxationTime
SimpleBroadcastObject< Tensor > positionRescaleFactor
MovingAverage groupPressureAverage_zz
void NAMD_backup_file(const char *filename, const char *extension)
IMDSessionInfo IMDsendsettings
int numCalcOneFourNbTholes
char restartFilename[NAMD_FILENAME_BUFFER_SIZE]
virtual ~Controller(void)
BigReal multigatorCalcEnthalpy(BigReal potentialEnergy, int step, int minimize)
BigReal langevinPistonPeriod
NodeBroadcast * nodeBroadcast
int num_fixed_groups() const
void monteCarloPressure_prepare(int)
MovingAverage pressureAverage_yx
void outputFepEnergy(int step)
CollectionMaster *const collection
BigReal * adaptTempPotEnergyAveDen
int pressureProfileAtomTypes
BigReal * pressureProfileAverage
RequireReduction * min_reduction
MovingAverage pressureAverage
char accelMDGRestartFile[NAMD_FILENAME_BUFFER_SIZE]
void printFepMessage(int)
BigReal stochRescaleTimefactor
BigReal * adaptTempPotEnergyVarNum
void calc_accelMDG_force_factor(BigReal k, BigReal E, BigReal testV, Tensor vir_orig, BigReal *dV, BigReal *factor, Tensor *vir)
BigReal electEnergyPME_ti_2
BigReal getCurrentLambda2(const int) const
Bool GPUresidentSingleProcessMode
BigReal getCurrentLambda(const int) const
BigReal getLambdaDelta(void) const
BigReal item(int i) const
int rescaleVelocities_numTemps
void calc_accelMDG_E_k(int iE, int V_n, BigReal sigma0, BigReal Vmax, BigReal Vmin, BigReal Vavg, BigReal sigmaV, BigReal *k0, BigReal *k, BigReal *E, int *iEused, char *warn)
int getNumStepsToRun(void)
void resetMovingAverage()
Vector monteCarloMaxVolume
void traceBarrier(int, int)
int * adaptTempPotEnergySamples
PressureProfileReduction * ppnonbonded
MovingAverage groupPressureAverage
void printDynamicsEnergies(int)
int64_t num_deg_freedom(int isInitialReport=0) const
void multigratorPressure(int step, int callNumber)
#define LIMIT_SCALING(VAR, MIN, MAX, FLAG)
int multigratorPressureFreq
static int velocityNeeded(int timestep)
Check if the step requires to output the velocities.
BigReal kineticEnergyHalfstep
BigReal getVdwLambda(const BigReal) const
RequireReduction * willRequire(int setID, int size=-1)
BigReal electEnergySlow_ti_2
void tcoupleVelocities(int)
void enqueueForces(int seq)
static char * TITITLE(int X)
SimParameters *const simParams
Tensor controlPressure_normal
int64_t num_group_deg_freedom() const
int numDrudeAtoms
Number of Drude particles.
std::ostream & iERROR(std::ostream &s)
void resumeAfterTraceBarrier(int)
char xstFilename[NAMD_FILENAME_BUFFER_SIZE]
#define CALLBACKLIST(LABEL, VALUE)
void sendCheckpointReq(int remote, const char *key, int task, Lattice &lat, ControllerState &cs)
BigReal bondedEnergy_ti_2
PressureProfileReduction * ppbonded
BigReal * adaptTempPotEnergyAve
void writeTiEnergyData(int step, ofstream_namd &file)
BigReal monteCarloPressureTarget
NAMD_HOST_DEVICE Vector a() const
SimpleBroadcastObject< Tensor > positionRescaleFactor2
void writeFepEnergyData(int step, ofstream_namd &file)
void open(const char *_fname, std::ios_base::openmode _mode=std::ios_base::out)
void outputExtendedSystem(int step)
SimpleBroadcastObject< Tensor > velocityRescaleTensor
BigReal bondedEnergy_ti_1
Tensor positionRescaleFactor
Tensor langevinPiston_origStrainRate
BigReal goNonnativeEnergy
BigReal langevinPistonTarget
NAMD_HOST_DEVICE Vector origin() const
RequireReduction * reductionBasic
Tensor berendsenPressure_avg
BigReal getTotalPotentialEnergy(int step)
int outputEnergiesPrecision
int multigratorTemperatureFreq
Tensor controlPressure_nbond
void adaptTempUpdate(int step, int minimize=0)
int average(CompAtom *qtilde, const HGArrayVector &q, BigReal *lambda, const int n, const int m, const HGArrayBigReal &imass, const HGArrayBigReal &length2, const HGArrayInt &ial, const HGArrayInt &ibl, const HGArrayVector &refab, const BigReal tolf, const int ntrial)
static void my_sigint_handler(int sig)
BigReal recent_dEdl_bond_1
T get(int tag, const int expected=-1)