-
Notifications
You must be signed in to change notification settings - Fork 0
/
nrg.cpp
60 lines (41 loc) · 1002 Bytes
/
nrg.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Convert Energy units
// Convert from and to Hartrees
#include "nrg.h"
double hart_to_nE(double oldnrg, std::string newEunit) {
double newnrg { };
if (newEunit == "eV") {
newnrg = oldnrg * 27.211386;
}
if (newEunit == "wn") {
newnrg = oldnrg * 219474.63;
}
if (newEunit == "kcal") {
newnrg = oldnrg * 627.5095;
}
if (newEunit == "kJ") {
newnrg = oldnrg * 2625.5;
}
if (newEunit == "J") {
newnrg = oldnrg * 4.359e-18;
}
return newnrg;
}
double oE_to_hart(double oldnrg, std::string oldEunit) {
double newnrg { };
if (oldEunit == "eV") {
newnrg = oldnrg / 27.211386;
}
if (oldEunit == "wn") {
newnrg = oldnrg / 219474.63;
}
if (oldEunit == "kcal") {
newnrg = oldnrg / 627.5095;
}
if (oldEunit == "kJ") {
newnrg = oldnrg / 2625.5;
}
if (oldEunit == "J") {
newnrg = oldnrg / 4.359e-18;
}
return newnrg;
}