Lemina
A molecular dynamics package for network, granular material and point particles with a range of interaction potential.
 
Loading...
Searching...
No Matches
DumpRestart.c
Go to the documentation of this file.
1/*
2 * This file is part of Lamina.
3 *
4 * Lamina is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * Lamina is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with Lamina. If not, see <https://www.gnu.org/licenses/>.
16
17 Copyright (C) 2025 Harish Charan, University of Durham, UK
18
19 */
20
21
22#include <stdio.h>
23#include "global.h"
24
26 char DUMP[256];
27 FILE *fpDUMP;
28 sprintf(DUMP, "%s.Restart", prefix);
29 fpDUMP = fopen(DUMP, "w");
30 if(fpDUMP == NULL) {
31 fprintf(stderr, "Error opening file %s for writing\n", DUMP);
32 return;
33 }
34
35 fprintf(fpDUMP, "timeNow %lf\n", timeNow);
36 fprintf(fpDUMP, "nAtom %d\n", nAtom);
37 fprintf(fpDUMP, "nBond %d\n", nBond);
38 fprintf(fpDUMP, "nAtomType %d\n", nAtomType);
39 fprintf(fpDUMP, "nBondType %d\n", nBondType);
40 fprintf(fpDUMP, "region[1] %0.16lf\n", region[1]);
41 fprintf(fpDUMP, "region[2] %0.16lf\n", region[2]);
42
43 int n;
44 fprintf(fpDUMP, "Atoms\n");
45 for(n = 1; n <= nAtom; n ++)
46 fprintf(fpDUMP, "%d %d %d %0.2lf %0.16lf %0.16lf %0.16lf %0.16lf\n", atomID[n], molID[n], atomType[n], atomRadius[n], rx[n], ry[n], vx[n], vy[n]);
47
48
49 fprintf(fpDUMP, "Bonds\n");
50 for(n=1; n<=nBond; n++)
51 fprintf(fpDUMP, "%d %d %d %d %0.2lf %0.16lf\n", BondID[n], BondType[n], atom1[n], atom2[n], kb[n], ro[n]);
52
53 fclose(fpDUMP);
54}
55
void DumpRestart()
Definition DumpRestart.c:25
int nAtom
Definition global.h:24
int * BondID
int * atom2
Definition global.h:36
int * BondType
Definition global.h:37
int nBondType
Definition global.h:35
int nAtomType
double region[2+1]
int * molID
double * vx
Definition global.h:17
double * ro
Definition global.h:38
int * atom1
double * rx
int nBond
double * kb
double * atomRadius
double timeNow
Definition global.h:20
char * prefix
Definition main.c:13
int * atomType
double * vy
Definition global.h:17
int * atomID
double * ry
Definition global.h:17