Definition at line 59 of file ReadRestartBinary.c.
59 {
60
61 FILE *fp = fopen(filename, "rb");
62 if (!fp) {
63 fprintf(stderr, "Error opening binary restart file %s for reading\n", filename);
64 exit(EXIT_FAILURE);
65 }
68
69 if(strncmp(hdr.
magic,
"LAMINA", 6) != 0) {
70 fprintf(stderr,
"Invalid file format: magic = %.8s [from %s()]\n", hdr.
magic, __func__);
71 fclose(fp);
72 exit(EXIT_FAILURE);
73 }
74
75
103
109
111
112 printf("Running from restart file:\n");
113 printf(
"Running: %s, version: %0.3lf\n", hdr.
magic, hdr.
version);
114 printf(
"timeNow: %lf\n",
timeNow);
116
117
119 molID = (
int *)malloc((
nAtom + 1) *
sizeof(
int));
122 rx = (
double *)malloc((
nAtom + 1) *
sizeof(
double));
123 ry = (
double *)malloc((
nAtom + 1) *
sizeof(
double));
124 vx = (
double *)malloc((
nAtom + 1) *
sizeof(
double));
125 vy = (
double *)malloc((
nAtom + 1) *
sizeof(
double));
126 ax = (
double *)malloc((
nAtom + 1) *
sizeof(
double));
127 ay = (
double *)malloc((
nAtom + 1) *
sizeof(
double));
128 fx = (
double *)malloc((
nAtom + 1) *
sizeof(
double));
129 fy = (
double *)malloc((
nAtom + 1) *
sizeof(
double));
134
137 atom1 = (
int *)malloc((
nBond + 1) *
sizeof(
int));
138 atom2 = (
int *)malloc((
nBond + 1) *
sizeof(
int));
139 kb = (
double *)malloc((
nBond + 1) *
sizeof(
double));
140 ro = (
double *)malloc((
nBond + 1) *
sizeof(
double));
149
155
156
161 fread(&
rx[1],
sizeof(
double),
nAtom, fp);
162 fread(&
ry[1],
sizeof(
double),
nAtom, fp);
163 fread(&
vx[1],
sizeof(
double),
nAtom, fp);
164 fread(&
vy[1],
sizeof(
double),
nAtom, fp);
165 fread(&
ax[1],
sizeof(
double),
nAtom, fp);
166 fread(&
ay[1],
sizeof(
double),
nAtom, fp);
167 fread(&
fx[1],
sizeof(
double),
nAtom, fp);
168 fread(&
fy[1],
sizeof(
double),
nAtom, fp);
173
178 fread(&
kb[1],
sizeof(
double),
nBond, fp);
179 fread(&
ro[1],
sizeof(
double),
nBond, fp);
188
194
195
196
198 for (
int i = 0; i <=
nAtom; i++) {
200 for (
int j = 0; j <=
nAtom; j++) {
202 } }
203 for (
int n = 1; n <=
nBond; n++) {
208}
209
210 fprintf(
fpresult,
"------------------------------------\n");
211 fprintf(
fpresult,
"-------PARAMETERS-----------\n");
212 fprintf(
fpresult,
"------------------------------------\n");
242 fprintf(
fpresult,
"------------------------------------\n");
243 fprintf(
fpresult,
"#TimeNow TotalMomentum PotEngyPerAtom KinEngyPerAtom TotEngyPerAtom PairEnergyPerAtom BondEnergyPerAtom Press VirialSum\n");
244 fprintf(
fpvrms,
"#timeNow\tVrms \n");
245 fprintf(
fpcom,
"#timeNow\tComX\tComY\n");
246 fprintf(
fpforce,
"#timeNow\tforceSumxAtomType1\tforceSumyAtomType1\tforceSumxAtomType2\tforceSumyAtomType2\tforceSumxAtomType3\tforceSumyAtomType3\tforceSumxAtomType4\tforceSumyAtomType4\tforceSumxAtomType5\tforceSumyAtomType5\tforceSumxExtern\tforceSumyExtern\n");
247 fclose(fp);
248 }
References atom1, atom2, atomID, atomIDInterface, atomMass, atomRadius, atomType, ax, ay, bigDiameter, RestartHeader::bigDiameter, BondEnergy, BondID, BondLength, BondType, cellList, cells, DampFlag, deltaT, DeltaX, DeltaY, density, discDragx, discDragy, forceSumxExtern, RestartHeader::forceSumxExtern, forceSumyExtern, RestartHeader::forceSumyExtern, fpcom, fpforce, fpresult, fpvrms, fx, fxByfy, fy, FyBylx, gamman, HaltCondition, ImageX, ImageY, InterfaceWidth, RestartHeader::InterfaceWidth, isBonded, kappa, kb, RestartHeader::magic, mass, molID, nAtom, RestartHeader::nAtom, nAtomBlock, RestartHeader::nAtomBlock, nAtomInterface, RestartHeader::nAtomInterface, nAtomType, RestartHeader::nAtomType, nBond, RestartHeader::nBond, nBondType, RestartHeader::nBondType, nDiscInterface, RestartHeader::nDiscInterface, nodeDragx, nodeDragy, nPairActive, RestartHeader::nPairActive, nPairTotal, RestartHeader::nPairTotal, Pairatom1, Pairatom2, PairID, PairXij, PairYij, rCut, region, regionH, RestartHeader::regionX, RestartHeader::regionY, ro, rx, rxUnwrap, ry, ryUnwrap, solver, RestartHeader::stepCount, stepCount, stepEquil, stepLimit, strain, strainRate, RestartHeader::timeNow, timeNow, RestartHeader::TotalBondEnergy, TotalBondEnergy, RestartHeader::uSumPair, uSumPair, RestartHeader::version, RestartHeader::virSumBond, virSumBond, RestartHeader::virSumBondxx, virSumBondxx, RestartHeader::virSumBondxy, virSumBondxy, RestartHeader::virSumBondyy, virSumBondyy, RestartHeader::virSumPair, virSumPair, RestartHeader::virSumPairxx, virSumPairxx, RestartHeader::virSumPairxy, virSumPairxy, RestartHeader::virSumPairyy, virSumPairyy, vx, vy, xBoundary, and yBoundary.
Referenced by Init().