Lemina
A molecular dynamics package for network, granular material and point particles with a range of interaction potential.
 
Loading...
Searching...
No Matches
DumpState.c File Reference
#include <stdio.h>
#include "global.h"
+ Include dependency graph for DumpState.c:

Go to the source code of this file.

Functions

void DumpState ()
 

Function Documentation

◆ DumpState()

void DumpState ( )

Definition at line 25 of file DumpState.c.

25 {
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}
int nAtom
Definition global.h:24
int * molID
double * ay
Definition global.h:17
double * vx
Definition global.h:17
double * rx
double * ax
Definition global.h:17
double * atomRadius
double timeNow
Definition global.h:20
char * prefix
Definition main.c:13
int * atomType
double * vy
Definition global.h:17
double regionH[2+1]
Definition global.h:20
int * atomID
double * ry
Definition global.h:17

References atomID, atomRadius, atomType, ax, ay, molID, nAtom, prefix, regionH, rx, ry, timeNow, vx, and vy.

Referenced by main().

+ Here is the caller graph for this function: