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

Go to the source code of this file.

Functions

void PrintForceSum ()
 

Function Documentation

◆ PrintForceSum()

void PrintForceSum ( )

Definition at line 28 of file PrintForceSum.c.

28 {
29 int n;
30 double forceSumxAtomType1, forceSumxAtomType2, forceSumxAtomType3, forceSumxAtomType4, forceSumxAtomType5;
31 double forceSumyAtomType1, forceSumyAtomType2, forceSumyAtomType3, forceSumyAtomType4, forceSumyAtomType5;
32
33 forceSumxAtomType1 = 0.0; forceSumyAtomType1 = 0.0;
34 forceSumxAtomType2 = 0.0; forceSumyAtomType2 = 0.0;
35 forceSumxAtomType3 = 0.0; forceSumyAtomType3 = 0.0;
36 forceSumxAtomType4 = 0.0; forceSumyAtomType4 = 0.0;
37 forceSumxAtomType5 = 0.0; forceSumyAtomType5 = 0.0;
38
39
40 for(n = 1; n <= nAtom; n++){
41 if(atomType[n] == 1){
42 forceSumxAtomType1 += fx[n];
43 forceSumyAtomType1 += fy[n];
44 } else if(atomType[n] == 2){
45 forceSumxAtomType2 += fx[n];
46 forceSumyAtomType2 += fy[n];
47 } else if(atomType[n] == 3){
48 forceSumxAtomType3 += fx[n];
49 forceSumyAtomType3 += fy[n];
50 } else if(atomType[n] == 4){
51 forceSumxAtomType4 += fx[n];
52 forceSumyAtomType4 += fy[n];
53 } else if(atomType[n] == 5){
54 forceSumxAtomType5 += fx[n];
55 forceSumyAtomType5 += fy[n];
56 }
57 }
58
59 fprintf(fpforce, "%0.4lf\t%0.16lf\t%0.16lf\t%0.16lf\t%0.16lf\t%0.16f\t%0.16lf\t%0.16lf\t%0.16lf\t%0.16lf\t%0.16lf\t%0.16f\t%0.16f\n", timeNow,
60 forceSumxAtomType1, forceSumyAtomType1,
61 forceSumxAtomType2, forceSumyAtomType2,
62 forceSumxAtomType3, forceSumyAtomType3,
63 forceSumxAtomType4, forceSumyAtomType4,
64 forceSumxAtomType5, forceSumyAtomType5,
66 fflush(fpforce);
67 }
int nAtom
Definition global.h:24
FILE * fpforce
double * fy
Definition global.h:17
double timeNow
Definition global.h:20
double forceSumyExtern
Definition global.h:53
int * atomType
double forceSumxExtern
Definition global.h:53
double * fx
Definition global.h:17

References atomType, forceSumxExtern, forceSumyExtern, fpforce, fx, fy, nAtom, and timeNow.

Referenced by main().

+ Here is the caller graph for this function: