Lemina
A molecular dynamics package for network, granular material and point particles with a range of interaction potential.
Loading...
Searching...
No Matches
DumpState.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
DumpState
() {
26
char
DUMP[256];
27
FILE *fpDUMP;
28
sprintf(DUMP,
"%s.STATE"
,
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,
"ITEM: TIMESTEP\n"
);
36
fprintf(fpDUMP,
"%lf\n"
,
timeNow
);
37
fprintf(fpDUMP,
"ITEM: NUMBER OF ATOMS\n"
);
38
fprintf(fpDUMP,
"%d\n"
,
nAtom
);
39
fprintf(fpDUMP,
"ITEM: BOX BOUNDS pp pp pp\n"
);
40
fprintf(fpDUMP,
"%lf %lf xlo xhi\n"
, -
regionH
[1],
regionH
[1]);
41
fprintf(fpDUMP,
"%lf %lf ylo yhi\n"
, -
regionH
[2],
regionH
[2]);
42
fprintf(fpDUMP,
"%lf %lf zlo zhi\n"
, -0.1, 0.1);
43
fprintf(fpDUMP,
"ITEM: ATOMS id mol type radius x y vx vy fx fy\n"
);
44
int
n;
45
for
(n = 1; n <=
nAtom
; n++) {
46
fprintf(fpDUMP,
"%d\t %d\t %d\t %0.2lf\t %0.16lf\t %0.16lf\t %0.16lf\t %0.16lf\t %0.16lf\t %0.16lf\n"
,
47
atomID
[n],
molID
[n],
atomType
[n],
atomRadius
[n],
rx
[n],
ry
[n],
vx
[n],
vy
[n],
ax
[n],
ay
[n]);
48
}
49
fclose(fpDUMP);
50
}
51
DumpState
void DumpState()
Definition
DumpState.c:25
global.h
nAtom
int nAtom
Definition
global.h:24
molID
int * molID
ay
double * ay
Definition
global.h:17
vx
double * vx
Definition
global.h:17
rx
double * rx
ax
double * ax
Definition
global.h:17
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
regionH
double regionH[2+1]
Definition
global.h:20
atomID
int * atomID
ry
double * ry
Definition
global.h:17
source
DumpState.c
Generated by
1.13.2