40 #define access(PATH,MODE) _access(PATH,00) 43 #if defined(WIN32) && !defined(__CYGWIN__) 44 #define PATHSEPSTR "\\" 45 #define MKDIR(X) mkdir(X) 47 #define PATHSEPSTR "/" 48 #define MKDIR(X) mkdir(X,0777) 51 #define NAMD_open NAMD_open64 52 #define NAMD_write NAMD_write64 53 #define NAMD_close NAMD_close64 56 #define O_LARGEFILE 0x0 66 while ( (fd = _open(fname, O_WRONLY|O_CREAT|O_EXCL|O_BINARY|
O_LARGEFILE,_S_IREAD|_S_IWRITE)) < 0) {
69 while ( (fd = open(fname, O_WRONLY|O_CREAT|O_TRUNC|
O_LARGEFILE,
71 while ( (fd = open(fname, O_WRONLY|O_CREAT|O_EXCL|
O_LARGEFILE,
73 S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) < 0) {
75 if ( errno != EINTR ) {
77 sprintf(errmsg,
"Unable to open binary file %s", fname);
86 void NAMD_write(
int fd,
const char *buf,
size_t count,
const char *errmsg=
"NAMD_write64") {
87 double firsttime = 0.;
89 #if defined(WIN32) && !defined(__CYGWIN__) 90 long retval = _write(fd,buf,count);
92 ssize_t retval = write(fd,buf,count);
94 if ( retval < 0 && errno == EINTR ) retval = 0;
95 if ( retval < 0 && errno == ENOMEM ) {
96 if ( firsttime == 0. ) firsttime = CmiWallTimer();
97 if ( (CmiWallTimer() - firsttime) < 300. ) retval = 0;
100 if ( retval > count )
NAMD_bug(
"extra bytes written in NAMD_write64()");
104 if ( firsttime != 0. ) {
105 iout <<
iWARN << errmsg <<
": NAMD_write64() retried for " << (CmiWallTimer() - firsttime) <<
" seconds.\n" <<
endi;
112 while ( _close(fd) ) {
114 while ( close(fd) ) {
116 if ( errno != EINTR ) {
118 sprintf(errmsg,
"Error on closing file %s", fname);
125 #define seek_dcdfile NAMD_seek 128 #define namdMyNode Node::Object() 129 #define simParams simParameters 134 unitcell[0] = unitcell[2] = unitcell[5] = 0.0;
135 unitcell[1] = unitcell[3] = unitcell[4] = 0.0;
141 unitcell[0] = (lattice->
a_p()) ? a.
length() : 0.0;
142 unitcell[2] = (lattice->
b_p()) ? b.
length() : 0.0;
143 unitcell[5] = (lattice->
c_p()) ? c.
length() : 0.0;
144 double cosAB = (lattice->
a_p() && lattice->
b_p() ) ?
145 (a*b)/(unitcell[0]*unitcell[2]) : 0.0;
146 double cosAC = (lattice->
a_p() && lattice->
c_p() ) ?
147 (a*c)/(unitcell[0]*unitcell[5]) : 0.0;
148 double cosBC = (lattice->
b_p() && lattice->
c_p() ) ?
149 (b*c)/(unitcell[2]*unitcell[5]) : 0.0;
150 if (cosAB > 1.0) cosAB = 1.0;
else if (cosAB < -1.0) cosAB = -1.0;
151 if (cosAC > 1.0) cosAC = 1.0;
else if (cosAC < -1.0) cosAC = -1.0;
152 if (cosBC > 1.0) cosBC = 1.0;
else if (cosBC < -1.0) cosBC = -1.0;
203 if(
simParams->benchTimestep)
return std::make_pair(0,0);
205 int positionsNeeded = 0;
206 uint16 dcdSelectionTag = 0;
207 if ( timestep >= 0 ) {
211 ((timestep %
simParams->dcdFrequency) == 0) )
212 { positionsNeeded |= 1; }
219 for(
int index=0; index<16;++index)
223 if(frequency && (timestep % frequency) == 0)
225 if(dcdSelectionTag>0)
227 positionsNeeded |= 4; dcdSelectionTag = tag;
233 ((timestep %
simParams->restartFrequency) == 0) )
234 { positionsNeeded |= 2; }
238 ( ((timestep %
simParams->IMDfreq) == 0) ||
239 (timestep ==
simParams->firstTimestep) ) )
240 { positionsNeeded |= 1; }
248 positionsNeeded |= 2;
250 return std::make_pair(positionsNeeded,dcdSelectionTag);
253 template <
class xVector,
class xDone>
259 const int wrapNearest =
simParams->wrapNearest;
264 #ifndef MEM_OPT_VERSION 266 for ( i = 0; i < n; ++i ) {
271 for ( i = 0; i < n; ++i ) {
272 if ( ! wrapAll && ! molecule->
is_water(i) )
continue;
276 Vector trans = ( wrapNearest ?
280 coor[i] = coor[i] + con[ci];
287 template <
class xVector,
class xDone>
293 const int wrapNearest =
simParams->wrapNearest;
298 #ifndef MEM_OPT_VERSION 300 for ( i = 0; i < n; ++i ) {
307 con[dcdci] += coor[i];
309 for ( i = 0; i < n; ++i ) {
311 if ( ! wrapAll && ! molecule->
is_water(molIndex) )
continue;
314 if ( ci == molIndex ) {
316 Vector trans = ( wrapNearest ?
321 coor[i] = coor[i] + con[dcdci];
350 double coor_wrapped = 0;
351 float fcoor_wrapped = 0;
353 if ( timestep >= 0 ) {
357 ((timestep %
simParams->dcdFrequency) == 0) )
360 output_dcdfile(timestep, n, fcoor,
361 simParams->dcdUnitCell ? &lattice : NULL, 0);
367 bool needCleanup =
false;
369 for(
int index=0; index<16;++index)
374 if(frequency>0 && (timestep % frequency) == 0)
377 int dcdSelectionNpoints = n;
383 dcdSelectionNpoints = size;
384 dcdSelectionFcoor =
new FloatVector[dcdSelectionNpoints];
386 for(
int i=0; i<n ;i++)
390 dcdSelectionFcoor[offset] = fcoor[i];
395 dcdSelectionFcoor = fcoor;
398 output_dcdfile(timestep, dcdSelectionNpoints, dcdSelectionFcoor,
399 simParams->dcdUnitCell ? &lattice : NULL, tag);
401 delete [] dcdSelectionFcoor;
409 ((timestep %
simParams->restartFrequency) == 0) )
411 iout <<
"WRITING COORDINATES TO RESTART FILE AT STEP " 412 << timestep <<
"\n" <<
endi;
414 output_restart_coordinates(coor, n, timestep);
415 iout <<
"FINISHED WRITING RESTART COORDINATES\n" <<
endi;
421 ( ((timestep %
simParams->IMDfreq) == 0) ||
422 (timestep ==
simParams->firstTimestep) ) )
425 #ifdef NODEGROUP_FORCE_REGISTER 427 CProxy_PatchData cpdata(CkpvAccess(BOCclass_group).patchData);
428 imd = cpdata.ckLocalBranch()->imd;
454 iout <<
"WRITING COORDINATES TO OUTPUT FILE AT STEP " 455 << realstep <<
"\n" <<
endi;
458 output_final_coordinates(coor, n, realstep);
466 ? &lattice : NULL, 0);
469 for(
int dcdSelectionIndex=0; dcdSelectionIndex<16;++dcdSelectionIndex)
473 if(dcdSelectionFrequency)
476 ? &lattice : NULL, dcdSelectionTag);
506 int velocitiesNeeded = 0;
508 if ( timestep >= 0 ) {
512 ((timestep %
simParams->velDcdFrequency) == 0) )
513 { velocitiesNeeded |= 1; }
517 ((timestep %
simParams->restartFrequency) == 0) )
518 { velocitiesNeeded |= 2; }
525 velocitiesNeeded |= 2;
528 return velocitiesNeeded;
535 if ( timestep >= 0 ) {
539 ((timestep %
simParams->velDcdFrequency) == 0) )
541 output_veldcdfile(timestep, n, vel);
546 ((timestep %
simParams->restartFrequency) == 0) )
548 iout <<
"WRITING VELOCITIES TO RESTART FILE AT STEP " 549 << timestep <<
"\n" <<
endi;
550 output_restart_velocities(timestep, n, vel);
551 iout <<
"FINISHED WRITING RESTART VELOCITIES\n" <<
endi;
562 iout <<
"WRITING VELOCITIES TO OUTPUT FILE AT STEP " 563 << realstep <<
"\n" <<
endi;
565 output_final_velocities(realstep, n, vel);
601 int forcesNeeded = 0;
603 if ( timestep >= 0 ) {
607 ((timestep %
simParams->forceDcdFrequency) == 0) )
608 { forcesNeeded |= 1; }
625 if ( timestep >= 0 ) {
629 ((timestep %
simParams->forceDcdFrequency) == 0) )
631 output_forcedcdfile(timestep, n, frc);
640 iout <<
"WRITING FORCES TO OUTPUT FILE AT STEP " 641 << realstep <<
"\n" <<
endi;
643 output_forces(realstep, n, frc);
666 void Output::output_restart_coordinates(
Vector *coor,
int n,
int timestep)
670 char timestepstr[20];
672 int baselen = strlen(
namdMyNode->simParams->restartFilename);
673 char *restart_name =
new char[baselen+26];
674 const char *bsuffix =
".old";
676 strcpy(restart_name,
namdMyNode->simParams->restartFilename);
678 sprintf(timestepstr,
".%d",timestep);
679 strcat(restart_name, timestepstr);
682 strcat(restart_name,
".coor");
690 sprintf(comment,
"RESTART COORDINATES WRITTEN BY NAMD AT TIMESTEP %d", timestep);
692 #ifdef NODEGROUP_FORCE_REGISTER 694 CProxy_PatchData cpdata(CkpvAccess(BOCclass_group).patchData);
695 PatchData* pData = cpdata.ckLocalBranch();
696 pData->pdbData->set_all_positions(coor);
697 pData->pdbData->write(restart_name, comment);
703 namdMyNode->pdbData->write(restart_name, comment);
709 write_binary_file(restart_name, n, coor);
712 delete [] restart_name;
714 if (
namdMyNode->simParams->restartSaveDcd ) {
715 if ( ! output_dcdfile(
END_OF_RUN, 0, 0, 0, 0) ) {
716 const char *old_name =
namdMyNode->simParams->dcdFilename;
717 int old_len = strlen(old_name);
718 char *new_name =
new char[old_len+26];
719 strcpy(new_name, old_name);
720 if ( old_len >= 4 && ! strcmp(new_name+old_len-4,
".dcd") ) {
722 new_name[old_len] = 0;
724 sprintf(timestepstr,
".%d",timestep);
725 strcat(new_name, timestepstr);
726 strcat(new_name,
".dcd");
727 iout <<
"RENAMING COORDINATE DCD FILE " << old_name <<
" TO " << new_name <<
"\n" <<
endi;
729 while ( rename(old_name, new_name) ) {
730 if ( errno == EINTR || errno == EXDEV )
continue;
732 sprintf(err_msg,
"Unable to rename DCD file %s to %s", old_name, new_name);
756 void Output::output_restart_velocities(
int timestep,
int n,
Vector *vel)
760 char timestepstr[20];
762 int baselen = strlen(
namdMyNode->simParams->restartFilename);
763 char *restart_name =
new char[baselen+26];
764 const char *bsuffix =
".old";
766 strcpy(restart_name,
namdMyNode->simParams->restartFilename);
768 sprintf(timestepstr,
".%d",timestep);
769 strcat(restart_name, timestepstr);
772 strcat(restart_name,
".vel");
781 sprintf(comment,
"RESTART VELOCITIES WRITTEN BY NAMD AT TIMESTEP %d", timestep);
785 #ifdef NODEGROUP_FORCE_REGISTER 787 CProxy_PatchData cpdata(CkpvAccess(BOCclass_group).patchData);
788 PatchData* pData = cpdata.ckLocalBranch();
789 pData->pdbData->set_all_positions(vel);
790 pData->pdbData->write(restart_name, comment);
796 namdMyNode->pdbData->write(restart_name, comment);
803 write_binary_file(restart_name, n, vel);
806 delete [] restart_name;
816 if ( ! output )
return;
818 output->output_dcdfile(
END_OF_RUN, 0, 0, 0, 0);
820 for(
int dcdSelectionIndex=0; dcdSelectionIndex<16;++dcdSelectionIndex)
824 if(dcdSelectionFrequency)
825 output->output_dcdfile(
END_OF_RUN,0,0,0,dcdSelectionTag);
832 if ( ! output )
return;
839 replicaDcdActive = 1;
840 replicaDcdIndex = index;
844 replicaDcdActive = 1;
845 replicaDcdIndex = index;
848 msg->
srcPart = CmiMyPartition();
851 strcpy(msg->
data, filename);
856 replicaDcdActive = 1;
857 replicaDcdIndex = index;
860 msg->
srcPart = CmiMyPartition();
864 strcpy(msg->
data, filename);
872 iout <<
"CLOSING REPLICA DCD FILE " << msg->
dcdIndex <<
" " << f.filename.c_str() <<
"\n" <<
endi;
876 f.filename = (
const char*) msg->
data;
883 ( ! replicaDcdFiles.count(msg->
dcdIndex) )) {
885 sprintf(err_msg,
"Unknown replicaDcdFile identifier %d\n", msg->
dcdIndex);
892 iout <<
"OPENING REPLICA DCD FILE " << msg->
dcdIndex <<
" " << f.filename.c_str() <<
"\n" <<
endi;
898 sprintf(err_msg,
"DCD file %s already exists!!", f.filename.c_str());
900 }
else if (f.fileid < 0) {
903 sprintf(err_msg,
"Couldn't open DCD Index %d Select Index %d file %s", msg->
dcdIndex, msg->
dcdSelectIndex, f.filename.c_str());
905 sprintf(err_msg,
"Couldn't open DCD Index %d file %s", msg->
dcdIndex, f.filename.c_str());
907 }
else if (! f.fileid) {
908 NAMD_bug(
"Output::recvReplicaDcdData open_dcd_write returned fileid of zero");
917 NAMD_err(
"Writing of DCD header failed!!");
922 iout <<
"WRITING TO REPLICA DCD FILE " << msg->
dcdIndex <<
" " << f.filename.c_str() <<
"\n" <<
endi;
923 float *msgx = (
float*) msg->
data;
928 if (ret_code < 0)
NAMD_err(
"Writing of DCD step failed!!");
949 #define RAD2DEG 180.0/3.14159265359 951 int Output::output_dcdfile(
int timestep,
int n,
FloatVector *coor,
952 const Lattice *lattice,
int dcdSelectTag)
955 static Bool first[
maxDCD]={
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true};
956 static int fileid[
maxDCD];
958 static float *x, *y, *z;
967 char *dcdFilename =
simParams->dcdFilename;
968 int dcdSelectIndex=dcdSelectTag-1;
969 if(dcdSelectTag >0 && dcdSelectTag < 16)
974 for ( std::map<int,replicaDcdFile>::iterator it = replicaDcdFiles.begin();
975 it != replicaDcdFiles.end(); ++it ) {
976 replicaDcdFile &f = it->second;
978 iout <<
"CLOSING REPLICA DCD FILE " << it->first <<
" " << f.filename.c_str() <<
"\n" <<
endi;
983 for ( std::map<std::pair<int,uint16_t>,replicaDcdFile>::iterator it = replicaDcdSelectFiles.begin();
984 it != replicaDcdSelectFiles.end(); ++it ) {
985 replicaDcdFile &f = it->second;
987 iout <<
"CLOSING REPLICA DCD SELECT FILE " << it->first.first <<
" " << f.filename.c_str() <<
"\n" <<
endi;
994 if ( ! first[dcdSelectTag] ) {
995 iout <<
"CLOSING COORDINATE DCD FILE " << dcdFilename <<
"\n" <<
endi;
998 iout <<
"COORDINATE DCD FILE " << dcdFilename <<
" WAS NOT CREATED\n" <<
endi;
1001 first[dcdSelectTag] = 1;
1002 fileid[dcdSelectTag] = 0;
1006 if ( replicaDcdActive ) {
1009 float *msgx = (
float*) msg->
data;
1010 float *msgy = msgx + n;
1011 float *msgz = msgy + n;
1012 for (i=0; i<n; i++) { msgx[i] = coor[i].
x; }
1013 for (i=0; i<n; i++) { msgy[i] = coor[i].
y; }
1014 for (i=0; i<n; i++) { msgz[i] = coor[i].
z; }
1022 msg->
NPRIV = timestep;
1026 msg->
srcPart = CmiMyPartition();
1032 if (first[dcdSelectTag])
1037 if ( n > n_alloc ) {
1038 delete [] x; x =
new float[3*n];
1045 iout <<
"OPENING COORDINATE DCD FILE\n" <<
endi;
1051 sprintf(err_msg,
"DCD file %s already exists!!",
1056 else if (fileid[dcdSelectTag] < 0)
1060 sprintf(err_msg,
"Couldn't open DCD file %s",
1066 int NSAVC, NFILE, NPRIV, NSTEP;
1072 NSTEP = NPRIV - NSAVC;
1078 n, NFILE, NPRIV, NSAVC, NSTEP,
1083 NAMD_err(
"Writing of DCD header failed!!");
1086 first[dcdSelectTag] =
FALSE;
1098 iout <<
"WRITING COORDINATES TO DCD FILE " << dcdFilename <<
" AT STEP " 1099 << timestep <<
"\n" <<
endi;
1104 ret_code =
write_dcdstep(fileid[dcdSelectTag], n, x, y, z, unitcell);
1106 ret_code =
write_dcdstep(fileid[dcdSelectTag], n, x, y, z, NULL);
1110 NAMD_err(
"Writing of DCD step failed!!");
1132 void Output::output_final_coordinates(
Vector *coor,
int n,
int timestep)
1135 char output_name[140];
1139 strcpy(output_name,
namdMyNode->simParams->outputFilename);
1140 strcat(output_name,
".coor");
1148 sprintf(comment,
"FINAL COORDINATES WRITTEN BY NAMD AT TIMESTEP %d", timestep);
1150 #ifdef NODEGROUP_FORCE_REGISTER 1152 CProxy_PatchData cpdata(CkpvAccess(BOCclass_group).patchData);
1153 PatchData* pData = cpdata.ckLocalBranch();
1154 pData->pdbData->set_all_positions(coor);
1155 pData->pdbData->write(output_name, comment);
1160 namdMyNode->pdbData->set_all_positions(coor);
1161 namdMyNode->pdbData->write(output_name, comment);
1167 write_binary_file(output_name, n, coor);
1186 void Output::output_final_velocities(
int timestep,
int n,
Vector *vel)
1189 char output_name[140];
1193 strcpy(output_name,
namdMyNode->simParams->outputFilename);
1194 strcat(output_name,
".vel");
1202 sprintf(comment,
"FINAL VELOCITIES WRITTEN BY NAMD AT TIMESTEP %d", timestep);
1205 #ifdef NODEGROUP_FORCE_REGISTER 1207 CProxy_PatchData cpdata(CkpvAccess(BOCclass_group).patchData);
1208 PatchData* pData = cpdata.ckLocalBranch();
1209 pData->pdbData->set_all_positions(vel);
1210 pData->pdbData->write(output_name, comment);
1216 namdMyNode->pdbData->write(output_name, comment);
1223 write_binary_file(output_name, n, vel);
1244 void Output::output_veldcdfile(
int timestep,
int n,
Vector *vel)
1249 static float *x, *y, *z;
1259 iout <<
"CLOSING VELOCITY DCD FILE\n" <<
endi;
1262 iout <<
"VELOCITY DCD FILE WAS NOT CREATED\n" <<
endi;
1274 if ( n > n_alloc ) {
1275 delete [] x; x =
new float[3*n];
1282 iout <<
"OPENING VELOCITY DCD FILE\n" <<
endi;
1290 sprintf(err_msg,
"Velocity DCD file %s already exists!!",
1295 else if (fileid < 0)
1299 sprintf(err_msg,
"Couldn't open velocity DCD file %s",
1305 int NSAVC, NFILE, NPRIV, NSTEP;
1308 NSTEP = NPRIV - NSAVC;
1312 const int with_unitcell = 0;
1315 n, NFILE, NPRIV, NSAVC, NSTEP,
1321 NAMD_err(
"Writing of velocity DCD header failed!!");
1336 iout <<
"WRITING VELOCITIES TO DCD FILE AT STEP " 1337 << timestep <<
"\n" <<
endi;
1343 NAMD_err(
"Writing of velocity DCD step failed!!");
1363 void Output::output_forces(
int timestep,
int n,
Vector *frc)
1366 char output_name[140];
1370 strcpy(output_name,
namdMyNode->simParams->outputFilename);
1371 strcat(output_name,
".force");
1379 sprintf(comment,
"FORCES WRITTEN BY NAMD AT TIMESTEP %d", timestep);
1380 #ifdef NODEGROUP_FORCE_REGISTER 1382 CProxy_PatchData cpdata(CkpvAccess(BOCclass_group).patchData);
1383 PatchData* pData = cpdata.ckLocalBranch();
1384 pData->pdbData->set_all_positions(frc);
1385 pData->pdbData->write(output_name, comment);
1391 namdMyNode->pdbData->write(output_name, comment);
1397 write_binary_file(output_name, n, frc);
1418 void Output::output_forcedcdfile(
int timestep,
int n,
Vector *frc)
1423 static float *x, *y, *z;
1433 iout <<
"CLOSING FORCE DCD FILE\n" <<
endi;
1436 iout <<
"FORCE DCD FILE WAS NOT CREATED\n" <<
endi;
1446 if ( n > n_alloc ) {
1447 delete [] x; x =
new float[3*n];
1454 iout <<
"OPENING FORCE DCD FILE\n" <<
endi;
1462 sprintf(err_msg,
"Force DCD file %s already exists!!",
1467 else if (fileid < 0)
1471 sprintf(err_msg,
"Couldn't open force DCD file %s",
1477 int NSAVC, NFILE, NPRIV, NSTEP;
1480 NSTEP = NPRIV - NSAVC;
1484 const int with_unitcell = 0;
1487 n, NFILE, NPRIV, NSAVC, NSTEP,
1493 NAMD_err(
"Writing of force DCD header failed!!");
1508 iout <<
"WRITING FORCES TO DCD FILE AT STEP " 1509 << timestep <<
"\n" <<
endi;
1515 NAMD_err(
"Writing of force DCD step failed!!");
1535 void Output::write_binary_file(
char *fname,
int n,
Vector *vecs)
1544 sprintf(errmsg,
"Error on write to binary file %s", fname);
1569 void Output::scale_vels(
Vector *v,
int n,
Real fact)
1584 #ifdef MEM_OPT_VERSION 1585 void ParOutput::velocityMaster(
int timestep,
int n){
1589 if ( timestep >= 0 ) {
1593 ((timestep %
simParams->velDcdFrequency) == 0) )
1595 output_veldcdfile_master(timestep, n);
1600 ((timestep %
simParams->restartFrequency) == 0) )
1602 iout <<
"WRITING VELOCITIES TO RESTART FILE AT STEP " 1603 << timestep <<
"\n" <<
endi;
1604 output_restart_velocities_master(timestep, n);
1605 iout <<
"FINISHED WRITING RESTART VELOCITIES\n" <<
endi;
1616 iout <<
"WRITING VELOCITIES TO OUTPUT FILE AT STEP " 1617 << realstep <<
"\n" <<
endi;
1619 output_final_velocities_master(n);
1632 void ParOutput::velocitySlave(
int timestep,
int fID,
int tID,
Vector *vecs){
1635 if ( timestep >= 0 ) {
1639 ((timestep %
simParams->velDcdFrequency) == 0) )
1641 output_veldcdfile_slave(timestep, fID, tID, vecs);
1646 ((timestep %
simParams->restartFrequency) == 0) )
1649 output_restart_velocities_slave(timestep, fID, tID, vecs, offset);
1658 output_final_velocities_slave(fID, tID, vecs, offset);
1669 void ParOutput::output_veldcdfile_master(
int timestep,
int n){
1676 if ( ! veldcdFirst ) {
1677 iout <<
"CLOSING VELOCITY DCD FILE\n" <<
endi;
1680 iout <<
"VELOCITY DCD FILE WAS NOT CREATED\n" <<
endi;
1688 iout <<
"OPENING VELOCITY DCD FILE\n" <<
endi;
1690 #ifndef OUTPUT_SINGLE_FILE 1691 #error OUTPUT_SINGLE_FILE not defined! 1694 #if OUTPUT_SINGLE_FILE 1695 char *veldcdFilename =
simParams->velDcdFilename;
1697 char *veldcdFilename = buildFileName(
veldcdType);
1705 sprintf(err_msg,
"Velocity DCD file %s already exists!",veldcdFilename);
1708 else if (veldcdFileID < 0)
1711 sprintf(err_msg,
"Couldn't open velocity DCD file %s",veldcdFilename);
1715 #if !OUTPUT_SINGLE_FILE 1720 NAMD_write(veldcdFileID, (
char *) &tmpFlt,
sizeof(
float));
1725 int NSAVC, NFILE, NPRIV, NSTEP;
1728 NSTEP = NPRIV - NSAVC;
1732 const int with_unitcell = 0;
1735 n, NFILE, NPRIV, NSAVC, NSTEP,
1741 NAMD_err(
"Writing of velocity DCD header failed!!");
1744 #if !OUTPUT_SINGLE_FILE 1746 delete [] veldcdFilename;
1749 veldcdFirst =
FALSE;
1753 iout <<
"WRITING VELOCITIES TO DCD FILE AT STEP " 1754 << timestep <<
"\n" <<
endi;
1761 #if OUTPUT_SINGLE_FILE 1763 int totalAtoms =
namdMyNode->molecule->numAtoms;
1772 void ParOutput::output_veldcdfile_slave(
int timestep,
int fID,
int tID,
Vector *vecs){
1779 if ( ! veldcdFirst ) {
1782 #if OUTPUT_SINGLE_FILE 1790 int parN = tID-fID+1;
1795 #if OUTPUT_SINGLE_FILE 1796 char *veldcdFilename =
namdMyNode->simParams->velDcdFilename;
1798 char *veldcdFilename = buildFileName(
veldcdType);
1801 if(veldcdFileID < 0)
1804 sprintf(err_msg,
"Couldn't open velocity DCD file %s",veldcdFilename);
1807 #if OUTPUT_SINGLE_FILE 1812 veldcdX =
new float[parN];
1813 veldcdY =
new float[parN];
1814 veldcdZ =
new float[parN];
1821 #if !OUTPUT_SINGLE_FILE 1822 delete [] veldcdFilename;
1827 NAMD_write(veldcdFileID, (
char *) &tmpFlt,
sizeof(
float));
1828 NAMD_write(veldcdFileID, (
char *) &outputID,
sizeof(
int));
1829 NAMD_write(veldcdFileID, (
char *) &fID,
sizeof(
int));
1830 NAMD_write(veldcdFileID, (
char *) &tID,
sizeof(
int));
1833 veldcdFirst =
FALSE;
1836 #if OUTPUT_SINGLE_FILE 1840 CmiAssert(
sizeof(off_t)==8);
1841 int totalAtoms =
namdMyNode->molecule->numAtoms;
1843 for(
int i=0; i<parN; i++){
1844 veldcdX[i] = vecs[i].
x;
1845 veldcdY[i] = vecs[i].
y;
1846 veldcdZ[i] = vecs[i].
z;
1853 int atomsRemains = (totalAtoms-1)-(tID+1)+1;
1854 off_t offset = ((off_t)atomsRemains)*
sizeof(float)+1*
sizeof(
int);
1859 NAMD_write(veldcdFileID, (
char *)×tep,
sizeof(
int));
1865 void ParOutput::output_restart_velocities_master(
int timestep,
int n){
1866 #if OUTPUT_SINGLE_FILE 1867 char timestepstr[20];
1869 int baselen = strlen(
namdMyNode->simParams->restartFilename);
1870 char *restart_name =
new char[baselen+26];
1872 strcpy(restart_name,
namdMyNode->simParams->restartFilename);
1874 sprintf(timestepstr,
".%d",timestep);
1875 strcat(restart_name, timestepstr);
1877 strcat(restart_name,
".vel");
1879 char *restart_name = NULL;
1881 restart_name = buildFileName(
velType);
1883 restart_name = buildFileName(
velType,timestep);
1889 write_binary_file_master(restart_name, n);
1891 delete [] restart_name;
1894 void ParOutput::output_restart_velocities_slave(
int timestep,
int fID,
int tID,
Vector *vecs,
int64 offset){
1895 #if OUTPUT_SINGLE_FILE 1896 char timestepstr[20];
1898 int baselen = strlen(
namdMyNode->simParams->restartFilename);
1899 char *restart_name =
new char[baselen+26];
1901 strcpy(restart_name,
namdMyNode->simParams->restartFilename);
1903 sprintf(timestepstr,
".%d",timestep);
1904 strcat(restart_name, timestepstr);
1906 strcat(restart_name,
".vel");
1908 char *restart_name = NULL;
1910 restart_name = buildFileName(
velType);
1912 restart_name = buildFileName(
velType,timestep);
1918 write_binary_file_slave(restart_name, fID, tID, vecs, offset);
1920 delete [] restart_name;
1923 void ParOutput::output_final_velocities_master(
int n){
1924 #if OUTPUT_SINGLE_FILE 1925 char *output_name =
new char[strlen(
namdMyNode->simParams->outputFilename)+8];
1927 strcpy(output_name,
namdMyNode->simParams->outputFilename);
1928 strcat(output_name,
".vel");
1930 char *output_name = buildFileName(
velType);
1936 write_binary_file_master(output_name, n);
1939 void ParOutput::output_final_velocities_slave(
int fID,
int tID,
Vector *vecs,
int64 offset){
1940 #if OUTPUT_SINGLE_FILE 1941 char *output_name =
new char[strlen(
namdMyNode->simParams->outputFilename)+8];
1943 strcpy(output_name,
namdMyNode->simParams->outputFilename);
1944 strcat(output_name,
".vel");
1946 char *output_name = buildFileName(
velType);
1951 write_binary_file_slave(output_name, fID, tID, vecs, offset);
1953 delete [] output_name;
1956 void ParOutput::write_binary_file_master(
char *fname,
int n){
1963 sprintf(errmsg,
"Error on write to binary file %s", fname);
1965 #if !OUTPUT_SINGLE_FILE 1970 NAMD_write(fd, (
char *) &tmpFlt,
sizeof(
float), errmsg);
1971 tmpInt =
namdMyNode->simParams->numoutputprocs;
1981 void ParOutput::write_binary_file_slave(
char *fname,
int fID,
int tID,
Vector *vecs,
int64 offset){
1984 #if OUTPUT_SINGLE_FILE 1986 FILE *ofp = fopen(fname,
"rb+");
1988 sprintf(errmsg,
"Error on opening binary file %s", fname);
1994 if ( _fseeki64(ofp, offset, SEEK_SET) )
1996 if ( fseeko(ofp, offset, SEEK_SET) )
1999 sprintf(errmsg,
"Error on seeking binary file %s", fname);
2004 FILE *ofp = fopen(fname,
"wb+");
2006 sprintf(errmsg,
"Error on opening binary file %s", fname);
2013 fwrite(&tmpInt,
sizeof(
int32), 1, ofp);
2014 fwrite(&tmpFlt,
sizeof(
float), 1, ofp);
2015 fwrite(&outputID,
sizeof(
int), 1, ofp);
2016 fwrite(&fID,
sizeof(
int), 1, ofp);
2017 fwrite(&tID,
sizeof(
int), 1, ofp);
2020 int parN = tID-fID+1;
2021 if ( fwrite(vecs,
sizeof(
Vector), parN, ofp) != parN ) {
2022 sprintf(errmsg,
"Error on writing to binary file %s", fname);
2026 if ( fclose(ofp) ) {
2027 sprintf(errmsg,
"Error on closing binary file %s", fname);
2035 void ParOutput::forceMaster(
int timestep,
int n){
2038 if ( timestep >= 0 ) {
2042 ((timestep %
simParams->forceDcdFrequency) == 0) )
2044 output_forcedcdfile_master(timestep, n);
2052 int realstep =
simParams->firstTimestep;
2053 iout <<
"WRITING FORCES TO OUTPUT FILE AT STEP " 2054 << realstep <<
"\n" <<
endi;
2056 output_forces_master(n);
2063 void ParOutput::forceSlave(
int timestep,
int fID,
int tID,
Vector *vecs){
2066 if ( timestep >= 0 ) {
2070 ((timestep %
simParams->forceDcdFrequency) == 0) )
2072 output_forcedcdfile_slave(timestep, fID, tID, vecs);
2081 output_forces_slave(fID, tID, vecs, offset);
2087 void ParOutput::output_forcedcdfile_master(
int timestep,
int n){
2094 if ( ! forcedcdFirst ) {
2095 iout <<
"CLOSING FORCE DCD FILE\n" <<
endi;
2098 iout <<
"FORCE DCD FILE WAS NOT CREATED\n" <<
endi;
2106 iout <<
"OPENING FORCE DCD FILE\n" <<
endi;
2108 #if OUTPUT_SINGLE_FILE 2109 char *forcedcdFilename =
simParams->forceDcdFilename;
2119 sprintf(err_msg,
"Force DCD file %s already exists!",forcedcdFilename);
2122 else if (forcedcdFileID < 0)
2125 sprintf(err_msg,
"Couldn't open force DCD file %s",forcedcdFilename);
2129 #if !OUTPUT_SINGLE_FILE 2134 NAMD_write(forcedcdFileID, (
char *) &tmpFlt,
sizeof(
float));
2139 int NSAVC, NFILE, NPRIV, NSTEP;
2142 NSTEP = NPRIV - NSAVC;
2146 const int with_unitcell = 0;
2149 n, NFILE, NPRIV, NSAVC, NSTEP,
2155 NAMD_err(
"Writing of force DCD header failed!!");
2158 #if !OUTPUT_SINGLE_FILE 2160 delete [] forcedcdFilename;
2163 forcedcdFirst =
FALSE;
2167 iout <<
"WRITING FORCES TO DCD FILE AT STEP " 2168 << timestep <<
"\n" <<
endi;
2175 #if OUTPUT_SINGLE_FILE 2177 int totalAtoms =
namdMyNode->molecule->numAtoms;
2186 void ParOutput::output_forcedcdfile_slave(
int timestep,
int fID,
int tID,
Vector *vecs){
2193 if ( ! forcedcdFirst ) {
2196 #if OUTPUT_SINGLE_FILE 2197 delete [] forcedcdX;
2198 delete [] forcedcdY;
2199 delete [] forcedcdZ;
2204 int parN = tID-fID+1;
2209 #if OUTPUT_SINGLE_FILE 2210 char *forcedcdFilename =
namdMyNode->simParams->forceDcdFilename;
2215 if(forcedcdFileID < 0)
2218 sprintf(err_msg,
"Couldn't open force DCD file %s",forcedcdFilename);
2221 #if OUTPUT_SINGLE_FILE 2226 forcedcdX =
new float[parN];
2227 forcedcdY =
new float[parN];
2228 forcedcdZ =
new float[parN];
2235 #if !OUTPUT_SINGLE_FILE 2236 delete [] forcedcdFilename;
2241 NAMD_write(forcedcdFileID, (
char *) &tmpFlt,
sizeof(
float));
2242 NAMD_write(forcedcdFileID, (
char *) &outputID,
sizeof(
int));
2243 NAMD_write(forcedcdFileID, (
char *) &fID,
sizeof(
int));
2244 NAMD_write(forcedcdFileID, (
char *) &tID,
sizeof(
int));
2247 forcedcdFirst =
FALSE;
2250 #if OUTPUT_SINGLE_FILE 2254 CmiAssert(
sizeof(off_t)==8);
2255 int totalAtoms =
namdMyNode->molecule->numAtoms;
2257 for(
int i=0; i<parN; i++){
2258 forcedcdX[i] = vecs[i].
x;
2259 forcedcdY[i] = vecs[i].
y;
2260 forcedcdZ[i] = vecs[i].
z;
2266 int atomsRemains = (totalAtoms-1)-(tID+1)+1;
2267 off_t offset = ((off_t)atomsRemains)*
sizeof(float)+1*
sizeof(
int);
2271 NAMD_write(forcedcdFileID, (
char *)×tep,
sizeof(
int));
2277 void ParOutput::output_forces_master(
int n){
2278 #if OUTPUT_SINGLE_FILE 2279 char *output_name =
new char[strlen(
namdMyNode->simParams->outputFilename)+8];
2281 strcpy(output_name,
namdMyNode->simParams->outputFilename);
2282 strcat(output_name,
".force");
2284 char *output_name = buildFileName(
forceType);
2290 write_binary_file_master(output_name, n);
2293 void ParOutput::output_forces_slave(
int fID,
int tID,
Vector *vecs,
int64 offset){
2294 #if OUTPUT_SINGLE_FILE 2295 char *output_name =
new char[strlen(
namdMyNode->simParams->outputFilename)+8];
2297 strcpy(output_name,
namdMyNode->simParams->outputFilename);
2298 strcat(output_name,
".force");
2300 char *output_name = buildFileName(
forceType);
2305 write_binary_file_slave(output_name, fID, tID, vecs, offset);
2307 delete [] output_name;
2313 void ParOutput::coordinateMaster(
int timestep,
int n,
Lattice &lat){
2316 if ( timestep >= 0 ) {
2319 ((timestep %
simParams->dcdFrequency) == 0) )
2321 output_dcdfile_master(timestep, n,
2327 ((timestep %
simParams->restartFrequency) == 0) )
2329 iout <<
"WRITING COORDINATES TO RESTART FILE AT STEP " 2330 << timestep <<
"\n" <<
endi;
2331 output_restart_coordinates_master(timestep, n);
2332 iout <<
"FINISHED WRITING RESTART COORDINATES\n" <<
endi;
2363 iout <<
"WRITING COORDINATES TO OUTPUT FILE AT STEP " 2364 << realstep <<
"\n" <<
endi;
2366 output_final_coordinates_master(n);
2376 void ParOutput::coordinateSlave(
int timestep,
int fID,
int tID,
Vector *vecs,
FloatVector *fvecs){
2379 if ( timestep >= 0 ) {
2382 ((timestep %
simParams->dcdFrequency) == 0) )
2384 output_dcdfile_slave(timestep, fID, tID, fvecs);
2389 ((timestep %
simParams->restartFrequency) == 0) )
2392 output_restart_coordinates_slave(timestep, fID, tID, vecs, offset);
2421 output_final_coordinates_slave(fID, tID, vecs, offset);
2431 void ParOutput::output_dcdfile_master(
int timestep,
int n,
const Lattice *lattice){
2439 iout <<
"CLOSING COORDINATE DCD FILE\n" <<
endi;
2442 iout <<
"COORDINATE DCD FILE WAS NOT CREATED\n" <<
endi;
2450 iout <<
"OPENING COORDINATE DCD FILE\n" <<
endi;
2452 #if OUTPUT_SINGLE_FILE 2453 char *dcdFilename =
simParams->dcdFilename;
2455 char *dcdFilename = buildFileName(
dcdType);
2464 sprintf(err_msg,
"DCD file %s already exists!!",dcdFilename);
2467 else if (dcdFileID < 0)
2470 sprintf(err_msg,
"Couldn't open DCD file %s",dcdFilename);
2474 #if !OUTPUT_SINGLE_FILE 2479 NAMD_write(dcdFileID, (
char *) &tmpFlt,
sizeof(
float));
2484 int NSAVC, NFILE, NPRIV, NSTEP;
2487 NSTEP = NPRIV - NSAVC;
2493 n, NFILE, NPRIV, NSAVC, NSTEP,
2499 NAMD_err(
"Writing of DCD header failed!!");
2502 #if !OUTPUT_SINGLE_FILE 2504 delete [] dcdFilename;
2511 iout <<
"WRITING COORDINATES TO DCD FILE AT STEP " 2512 << timestep <<
"\n" <<
endi;
2527 #if OUTPUT_SINGLE_FILE 2529 int totalAtoms =
namdMyNode->molecule->numAtoms;
2536 void ParOutput::output_dcdfile_slave(
int timestep,
int fID,
int tID,
FloatVector *fvecs){
2546 #if OUTPUT_SINGLE_FILE 2554 int parN = tID-fID+1;
2559 #if OUTPUT_SINGLE_FILE 2560 char *dcdFilename =
simParams->dcdFilename;
2562 char *dcdFilename = buildFileName(
dcdType);
2568 sprintf(err_msg,
"Couldn't open DCD file %s", dcdFilename);
2572 #if OUTPUT_SINGLE_FILE 2573 dcdX =
new float[parN];
2574 dcdY =
new float[parN];
2575 dcdZ =
new float[parN];
2580 skipbytes +=
sizeof(int)*2 + 6*
sizeof(
double);
2585 #if !OUTPUT_SINGLE_FILE 2586 delete [] dcdFilename;
2592 NAMD_write(dcdFileID, (
char *) &tmpFlt,
sizeof(
float));
2593 NAMD_write(dcdFileID, (
char *) &outputID,
sizeof(
int));
2594 NAMD_write(dcdFileID, (
char *) &fID,
sizeof(
int));
2595 NAMD_write(dcdFileID, (
char *) &tID,
sizeof(
int));
2600 #if OUTPUT_SINGLE_FILE 2604 CmiAssert(
sizeof(off_t)==8);
2605 int totalAtoms =
namdMyNode->molecule->numAtoms;
2607 for(
int i=0; i<parN; i++){
2608 dcdX[i] = fvecs[i].
x;
2609 dcdY[i] = fvecs[i].
y;
2610 dcdZ[i] = fvecs[i].
z;
2625 int atomsRemains = (totalAtoms-1)-(tID+1)+1;
2626 off_t offset = ((off_t)atomsRemains)*
sizeof(float)+1*
sizeof(
int);
2629 offset +=
sizeof(int)*2 + 6*
sizeof(
double);
2634 NAMD_write(dcdFileID, (
char *)×tep,
sizeof(
int));
2640 void ParOutput::output_restart_coordinates_master(
int timestep,
int n){
2641 #if OUTPUT_SINGLE_FILE 2642 char timestepstr[20];
2644 int baselen = strlen(
namdMyNode->simParams->restartFilename);
2645 char *restart_name =
new char[baselen+26];
2647 strcpy(restart_name,
namdMyNode->simParams->restartFilename);
2649 sprintf(timestepstr,
".%d",timestep);
2650 strcat(restart_name, timestepstr);
2652 strcat(restart_name,
".coor");
2654 char *restart_name = NULL;
2656 restart_name = buildFileName(
coorType);
2658 restart_name = buildFileName(
coorType,timestep);
2664 write_binary_file_master(restart_name, n);
2666 delete [] restart_name;
2668 void ParOutput::output_restart_coordinates_slave(
int timestep,
int fID,
int tID,
Vector *vecs,
int64 offset){
2669 #if OUTPUT_SINGLE_FILE 2670 char timestepstr[20];
2672 int baselen = strlen(
namdMyNode->simParams->restartFilename);
2673 char *restart_name =
new char[baselen+26];
2675 strcpy(restart_name,
namdMyNode->simParams->restartFilename);
2677 sprintf(timestepstr,
".%d",timestep);
2678 strcat(restart_name, timestepstr);
2680 strcat(restart_name,
".coor");
2682 char *restart_name = NULL;
2684 restart_name = buildFileName(
coorType);
2686 restart_name = buildFileName(
coorType,timestep);
2692 write_binary_file_slave(restart_name, fID, tID, vecs, offset);
2694 delete [] restart_name;
2697 void ParOutput::output_final_coordinates_master(
int n){
2698 #if OUTPUT_SINGLE_FILE 2699 char *output_name =
new char[strlen(
namdMyNode->simParams->outputFilename)+8];
2702 strcpy(output_name,
namdMyNode->simParams->outputFilename);
2703 strcat(output_name,
".coor");
2705 char *output_name = buildFileName(
coorType);
2711 write_binary_file_master(output_name, n);
2713 delete [] output_name;
2715 void ParOutput::output_final_coordinates_slave(
int fID,
int tID,
Vector *vecs,
int64 offset){
2716 #if OUTPUT_SINGLE_FILE 2717 char *output_name =
new char[strlen(
namdMyNode->simParams->outputFilename)+8];
2720 strcpy(output_name,
namdMyNode->simParams->outputFilename);
2721 strcat(output_name,
".coor");
2723 char *output_name = buildFileName(
coorType);
2728 write_binary_file_slave(output_name, fID, tID, vecs, offset);
2730 delete [] output_name;
2735 #if !OUTPUT_SINGLE_FILE 2736 char *ParOutput::buildFileName(
OUTPUTFILETYPE type,
int timestep){
2737 char *filename = NULL;
2738 const char *typeName = NULL;
2744 typeName =
"forcedcd";
2747 typeName =
"veldcd";
2759 typeName =
"invalid";
2762 int baselen = strlen(
namdMyNode->simParams->outputFilename);
2763 filename =
new char[baselen+32];
2764 memset(filename, 0, baselen+32);
2767 strcpy(filename,
namdMyNode->simParams->outputFilename);
2770 if(access(filename, F_OK)!=0) {
2771 int ret =
MKDIR(filename);
2774 sprintf(errmsg,
"Error in creating top-level directory %s!", filename);
2780 strcat(filename, typeName);
2783 if(access(filename, F_OK)!=0) {
2784 int ret =
MKDIR(filename);
2787 sprintf(errmsg,
"Error in creating middle-level directory %s!", filename);
2796 if(outputID == -1) {
2798 if(timestep!=-9999) {
2800 sprintf(tmpstr,
"%smeta.%d",
PATHSEPSTR, timestep);
2806 sprintf(tmpstr,
"%s%d",
PATHSEPSTR, outputID);
2807 strcat(filename, tmpstr);
2809 if(access(filename, F_OK)!=0) {
2810 int ret =
MKDIR(filename);
2813 sprintf(errmsg,
"Error in creating last-level directory %s!", filename);
2818 if(timestep!=-9999) {
2820 sprintf(tmpstr,
"%s%s_%d.%d",
PATHSEPSTR,typeName,outputID,timestep);
2822 sprintf(tmpstr,
"%s%s_%d",
PATHSEPSTR,typeName,outputID);
2826 strcat(filename, tmpstr);
DCDParams dcdSelectionParams[16]
int open_dcd_write_par_slave(char *dcdname)
static int velocityNeeded(int)
NAMD_HOST_DEVICE Vector c() const
void NAMD_err(const char *err_msg)
int get_atom_index_from_dcd_selection(const int index, const int atomIndex)
NAMD_HOST_DEVICE int c_p() const
void sendReplicaDcdInit(int dstPart, ReplicaDcdInitMsg *msg, int msgsize)
void setReplicaDcdIndex(int index)
int update_dcdstep_par_header(int fd)
SimParameters * simParameters
std::ostream & endi(std::ostream &s)
std::ostream & iWARN(std::ostream &s)
int get_clusterSize(int anum) const
void coordinate(int, int, Vector *, FloatVector *, Lattice &)
void replicaDcdSelectInit(int index, const char *tag, const char *filename)
void gather_coordinates(int timestep, int N, FloatVector *coords)
#define OUTPUT_FILE_VERSION
static int forceNeeded(int)
Molecule stores the structural information for the system.
NAMD_HOST_DEVICE int b_p() const
int open_dcd_write(const char *dcdname)
void wrap_coor_int_dcd_selection(xVector *coor, Lattice &lattice, xDone *done, int index)
uint16_t find_or_create_dcd_selection_index(const char *keystr)
const int get_dcd_selection_size(const int index)
void wrap_coor(Vector *coor, Lattice &lattice, double *done)
void recvReplicaDcdInit(ReplicaDcdInitMsg *msg)
char outFilename[NAMD_FILENAME_BUFFER_SIZE]
int write_dcdstep_par_XYZUnits(int fd, int N)
int write_dcdstep_par_cell(int fd, double *cell)
#define OUTPUT_MAGIC_NUMBER
void sendReplicaDcdData(int dstPart, ReplicaDcdDataMsg *msg, int msgsize)
NAMD_HOST_DEVICE BigReal length(void) const
void replicaDcdInit(int index, const char *filename)
void NAMD_bug(const char *err_msg)
int get_dcd_selection_index_from_atom_id(const int index, const int atomIndex)
void velocity(int, int, Vector *)
void recvReplicaDcdData(ReplicaDcdDataMsg *msg)
int write_dcdstep(int fd, int N, float *X, float *Y, float *Z, double *cell)
void wrap_coor_dcd_selection(Vector *coor, Lattice &lattice, double *done, int index)
NAMD_HOST_DEVICE int a_p() const
void NAMD_die(const char *err_msg)
NAMD_HOST_DEVICE Vector b() const
int write_dcdheader(int fd, const char *filename, int N, int NFILE, int NPRIV, int NSAVC, int NSTEP, double DELTA, int with_unitcell)
static std::pair< int, int > coordinateNeeded(int)
void NAMD_backup_file(const char *filename, const char *extension)
void sendReplicaDcdAck(int dstPart, ReplicaDcdAckMsg *msg)
static const short maxDCD
NAMD_HOST_DEVICE Vector wrap_nearest_delta(Position pos1) const
int write_dcdstep_par_slave(int fd, int parL, int parU, int N, float *X, float *Y, float *Z)
int get_cluster(int anum) const
NAMD_HOST_DEVICE Vector a() const
void close_dcd_write(int fd)
NAMD_HOST_DEVICE Vector wrap_delta(const Position &pos1) const
void wrap_coor_int(xVector *coor, Lattice &lattice, xDone *done)
void force(int, int, Vector *)
static void lattice_to_unitcell(const Lattice *lattice, double *unitcell)