-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuckingham.cpp
73 lines (59 loc) · 1.81 KB
/
buckingham.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
61
62
63
64
65
66
67
68
69
70
71
72
73
#include "buckingham.h"
buckingham::buckingham(buckingham &obj):potential(obj.getId1(),obj.getId2(),obj.getName1(),obj.getName2(),obj.getStyle(),obj.getFile())
{
A=obj.getA();
rho=obj.getRho();
C=obj.getC();
style=obj.style;
}
buckingham::buckingham(string n1, string n2, string st, string f, double a, double r, double c):potential(n1,n2,st,f),A(a),rho(r),C(c)
{
vecParameters.push_back(A);
vecParameters.push_back(rho);
vecParameters.push_back(C);
}
buckingham::buckingham(string n1, string n2, string st, string uni, string disuni, string f, double a, double r, double c):potential(n1,n2,st,uni,disuni,f)
{
A=getEnergyFactor()*a;
C=getEnergyFactor()*c;
rho=getDistanceFactor()*r;
if (rho>1&& A > 0)
{
cout<< "Going from buckingham full style to normal style i.e Ae-rho -C !!"<<endl;
double cA=A;
double cC=C/getEnergyFactor();
double cRho=rho;
A=((6*cA)/(cC-6))*exp(cC);
rho=cRho/cC;
C=(cC*cA*pow(cRho,6))/(cC-6);
}
vecParameters.push_back(A);
vecParameters.push_back(rho);
vecParameters.push_back(C);
}
void buckingham::print(ofstream & out)
{
if (out.is_open())
{
out<<setw(12)<<left<<prefix<<setw(4)<<getId1()<<setw(5)
<<getId2()<<setw(30)
<<getStyle()<<setw(20)
<<getA()<<setw(20)
<<getRho()<<setw(10)
<<getC()<<setw(5)<<right<<"#"
<<getName1()<<" "<<getName2()<<" "<< getFile()<< endl;
}else
{
cout<<"Could not write to file\n";
}
}
void buckingham::printTerminal()
{
cout<<getId1()<<" "
<<getId2()<<" "
<<getStyle()<<" "
<<getA()<<" "
<<getRho()<<" "
<<getC()<<" "<<"#"
<<getName1()<<" "<<getName2()<< endl;
}