-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rho_Free.cpp
80 lines (68 loc) · 1.86 KB
/
Rho_Free.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
74
75
76
77
78
79
80
/*
* RhoFree.cpp
*
* Created on: May 9, 2012
* Author: dstuck
*/
#include "Rho_Free.h"
Rho_Free::Rho_Free() {
// TODO Auto-generated constructor stub
}
Rho_Free::~Rho_Free() {
// TODO Auto-generated destructor stub
}
double Rho_Free::GetRho(vector<Particle> slice1,vector<Particle> slice2, double eps) {
double delta;
double rho = 0;
for(int j=0; j<(int)slice1.size(); j++) {
delta = 0;
for(int k=0; k<(int)slice1[j].pos.size(); k++) {
delta += (slice1[j].pos[k]-slice2[j].pos[k])*(slice1[j].pos[k]-slice2[j].pos[k]);
}
rho += slice1[j].mass/2.0/eps/eps*(delta);
}
// cout << "delta: " << delta << endl;
return rho;
}
double Rho_Free::ModifyPotential(vector<Particle> part) {
return 0;
}
double Rho_Free::Estimate(vector<Particle> slice1,vector<Particle> slice2, double eps, int P) {
double delta;
double kin;
double est = 0;
for(int j=0; j<(int)slice1.size(); j++) {
delta = 0;
kin = 0;
for(int k=0; k<(int)slice1[j].pos.size(); k++) {
delta += -(slice1[j].pos[k]-slice2[j].pos[k])*(slice1[j].pos[k]-slice2[j].pos[k]);
kin += 1.0/2.0/eps;
}
est += (slice1[j].mass/2.0/eps/eps*(delta)+kin)/(double)P;
}
return est;
}
vector<double> Rho_Free::GetSpringLength(vector<Particle> part, double eps) {
cout << "Shouldn't be calling GetSpringLength" << endl;
vector<double> r0;
for(int j=0; j<(int)part.size(); j++) {
r0.push_back(sqrt(eps/part[j].mass));
}
return r0;
}
vector<double> Rho_Free::GetLevyMean(Particle partI, Particle partF, double delta, double eps, int unused) {
vector<double> mean;
for(int k = 0; k<(int)partI.pos.size(); k++) {
mean.push_back( (partI.pos[k]*delta + partF.pos[k]) / (delta+1.0) );
}
return mean;
}
double Rho_Free::GetLevySigma(double delta, double eps, int unused) {
double sigma;
sigma = sqrt(eps/(1.0+1.0/delta));
return sigma;
}
string Rho_Free::GetType() {
string name = "Free";
return name;
}