Lemina
A molecular dynamics package for network, granular material and point particles with a range of interaction potential.
Loading...
Searching...
No Matches
EvalCom.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<stdlib.h>
24
#include<math.h>
25
#include"
global.h
"
26
27
void
EvalCom
(){
28
int
n;
29
ComX
= 0.0;
ComY
= 0.0;
ComXRatio
= 0.0;
ComYRatio
= 0.0;
30
TotalMass
= 0.0;
31
32
for
(n=1; n<=
nAtom
; n++){
33
if
(
molID
[n] == 2){
34
ComX
+=
atomMass
[n] *
rxUnwrap
[n];
35
ComY
+=
atomMass
[n] *
ryUnwrap
[n];
36
TotalMass
+=
atomMass
[n];
37
} }
38
39
ComX
=
ComX
/
TotalMass
;
40
ComY
=
ComY
/
TotalMass
;
41
42
if
(
timeNow
== 0.0){
43
ComX0
=
ComX
;
ComY0
=
ComY
;
44
}
45
ComXRatio
=
ComX
/
ComX0
;
ComYRatio
=
ComY
/
ComY0
;
46
}
47
48
49
EvalCom
void EvalCom()
Definition
EvalCom.c:27
global.h
nAtom
int nAtom
Definition
global.h:24
ComYRatio
double ComYRatio
Definition
global.h:47
atomMass
double * atomMass
ComY
double ComY
Definition
global.h:47
molID
int * molID
ComXRatio
double ComXRatio
Definition
global.h:47
ComX0
double ComX0
Definition
global.h:47
ComY0
double ComY0
Definition
global.h:47
ryUnwrap
double * ryUnwrap
Definition
global.h:51
timeNow
double timeNow
Definition
global.h:20
rxUnwrap
double * rxUnwrap
TotalMass
double TotalMass
Definition
global.h:32
ComX
double ComX
source
EvalCom.c
Generated by
1.13.2