Lemina
A molecular dynamics package for network, granular material and point particles with a range of interaction potential.
Loading...
Searching...
No Matches
Halt.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 <stdbool.h>
25
#include "
global.h
"
26
27
bool
HaltConditionCheck
(
double
value) {
28
29
if
(value <=
HaltCondition
&& value != 0) {
30
printf(
"Halt condition met at step = %d with Vrms = %.16f\n"
,
stepCount
, value);
31
fprintf(
fpresult
,
"Halt condition met at step = %d with Vrms = %.16f\n"
,
stepCount
, value);
32
fprintf(
fpresult
,
"Final thermodynamic values:\n"
);
33
fprintf(
fpresult
,
"%0.4lf\t%0.16lf\t%0.16lf\t%0.16lf\t%0.16lf\t%0.16lf\t%0.16lf\t%0.16lf\t%0.16lf\n"
,
34
timeNow
,
vSum
,
potEnergy
,
kinEnergy
,
totEnergy
,
uSumPairPerAtom
,
BondEnergyPerAtom
,
pressure
,
virSum
);
35
return
true
;
// Signal that the halt condition is met
36
}
37
return
false
;
// Halt condition not met
38
}
39
HaltConditionCheck
bool HaltConditionCheck(double value)
Definition
Halt.c:27
global.h
totEnergy
double totEnergy
Definition
global.h:20
uSumPairPerAtom
double uSumPairPerAtom
Definition
global.h:88
kinEnergy
double kinEnergy
Definition
global.h:20
vSum
double vSum
Definition
global.h:21
fpresult
FILE * fpresult
HaltCondition
double HaltCondition
BondEnergyPerAtom
double BondEnergyPerAtom
Definition
global.h:40
timeNow
double timeNow
Definition
global.h:20
potEnergy
double potEnergy
Definition
global.h:20
virSum
double virSum
Definition
global.h:21
stepCount
int stepCount
Definition
global.h:24
pressure
double pressure
Definition
global.h:21
source
Halt.c
Generated by
1.13.2