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
25
void
DumpRestart
() {
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
DumpRestart
void DumpRestart()
Definition
DumpRestart.c:25
global.h
nAtom
int nAtom
Definition
global.h:24
BondID
int * BondID
atom2
int * atom2
Definition
global.h:36
BondType
int * BondType
Definition
global.h:37
nBondType
int nBondType
Definition
global.h:35
nAtomType
int nAtomType
region
double region[2+1]
molID
int * molID
vx
double * vx
Definition
global.h:17
ro
double * ro
Definition
global.h:38
atom1
int * atom1
rx
double * rx
nBond
int nBond
kb
double * kb
atomRadius
double * atomRadius
timeNow
double timeNow
Definition
global.h:20
prefix
char * prefix
Definition
main.c:13
atomType
int * atomType
vy
double * vy
Definition
global.h:17
atomID
int * atomID
ry
double * ry
Definition
global.h:17
source
DumpRestart.c
Generated by
1.13.2