-
Notifications
You must be signed in to change notification settings - Fork 0
/
rotorconditionedfineaction.cc
43 lines (41 loc) · 1.7 KB
/
rotorconditionedfineaction.cc
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
#include "rotorconditionedfineaction.hh"
/** @file rotorconditionedfineaction.cc
* @brief Implementation of rotorconditionedfineaction.hh
*/
/* Fill in fine points */
void RotorConditionedFineAction::fill_fine_points(
std::shared_ptr<SampleState> x_path) const {
unsigned int M_lat = action->get_lattice()->getM_lat();
// interior points
for (unsigned int j = 0; j < M_lat / 2 - 1; ++j) {
double x_m = x_path->data[2 * j];
double x_p = x_path->data[2 * (j + 1)];
double x0 = action->getWminimum(x_m, x_p);
double sigma = 2. * action->getWcurvature(x_m, x_p);
x_path->data[2 * j + 1] = mod_2pi(x0 + exp_sin2_dist.draw(engine, sigma));
}
// Final point which requires wrap around
double x_m = x_path->data[M_lat - 2];
double x_p = x_path->data[0];
double x0 = action->getWminimum(x_m, x_p);
double sigma = 2. * action->getWcurvature(x_m, x_p);
x_path->data[M_lat - 1] = mod_2pi(x0 + exp_sin2_dist.draw(engine, sigma));
}
/* Evaluate conditioned action at fine points */
double RotorConditionedFineAction::evaluate(
const std::shared_ptr<SampleState> x_path) const {
unsigned int M_lat = action->get_lattice()->getM_lat();
double x_m = x_path->data[M_lat - 2];
double x_p = x_path->data[0];
double dx = x_path->data[M_lat - 1] - action->getWminimum(x_m, x_p);
double sigma = 2.0 * action->getWcurvature(x_m, x_p);
double S = -log(exp_sin2_dist.evaluate(dx, sigma));
for (unsigned int j = 0; j < M_lat / 2 - 1; ++j) {
x_m = x_path->data[2 * j];
x_p = x_path->data[2 * j + 2];
double dx = x_path->data[2 * j + 1] - action->getWminimum(x_m, x_p);
double sigma = 2.0 * action->getWcurvature(x_m, x_p);
S += -log(exp_sin2_dist.evaluate(dx, sigma));
}
return S;
}