Lemina
A molecular dynamics package for network, granular material and point particles with a range of interaction potential.
Loading...
Searching...
No Matches
AccumProps.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
#include<stdio.h>
22
#include<math.h>
23
#include"
global.h
"
24
25
void
AccumProps
(
int
icode){
26
if
(icode == 0){
27
sPotEnergy
=
ssPotEnergy
= 0.;
28
sKinEnergy
=
ssKinEnergy
= 0.;
29
sPressure
=
ssPressure
= 0.;
30
sTotEnergy
=
ssTotEnergy
= 0.;
31
svirSum
= 0.;
32
}
else
if
(icode == 1){
33
sPotEnergy
+=
potEnergy
;
34
ssPotEnergy
+=
Sqr
(
potEnergy
);
35
sKinEnergy
+=
kinEnergy
;
36
ssKinEnergy
+=
Sqr
(
kinEnergy
);
37
sTotEnergy
+=
totEnergy
;
38
ssTotEnergy
+=
Sqr
(
totEnergy
);
39
sPressure
+=
pressure
;
40
ssPressure
+=
Sqr
(
pressure
);
41
svirSum
+=
virSum
;
42
}
else
if
(icode == 2){
43
sPotEnergy
/=
stepAvg
;
44
ssPotEnergy
/= sqrt(
ssPotEnergy
/
stepAvg
-
Sqr
(
sPotEnergy
));
45
sTotEnergy
/=
stepAvg
;
46
ssTotEnergy
= sqrt(
ssTotEnergy
/
stepAvg
-
Sqr
(
sTotEnergy
));
47
sKinEnergy
/=
stepAvg
;
48
ssKinEnergy
= sqrt(
ssKinEnergy
/
stepAvg
-
Sqr
(
sKinEnergy
));
49
sPressure
/=
stepAvg
;
50
ssPressure
= sqrt(
ssPressure
/
stepAvg
-
Sqr
(
sPressure
));
51
svirSum
/=
stepAvg
;
52
} }
AccumProps
void AccumProps(int icode)
Definition
AccumProps.c:25
global.h
totEnergy
double totEnergy
Definition
global.h:20
ssPotEnergy
double ssPotEnergy
Definition
global.h:22
kinEnergy
double kinEnergy
Definition
global.h:20
ssPressure
double ssPressure
Definition
global.h:22
sTotEnergy
double sTotEnergy
Definition
global.h:22
ssKinEnergy
double ssKinEnergy
Definition
global.h:22
Sqr
#define Sqr(x)
Definition
global.h:14
stepAvg
int stepAvg
Definition
global.h:24
svirSum
double svirSum
Definition
global.h:21
potEnergy
double potEnergy
Definition
global.h:20
virSum
double virSum
Definition
global.h:21
sPotEnergy
double sPotEnergy
Definition
global.h:21
sKinEnergy
double sKinEnergy
Definition
global.h:21
pressure
double pressure
Definition
global.h:21
sPressure
double sPressure
Definition
global.h:22
ssTotEnergy
double ssTotEnergy
Definition
global.h:22
source
AccumProps.c
Generated by
1.13.2