19 {
20 if (numSteps <= 0) {
21 throw std::invalid_argument("MonteCarlo: steps must be positive");
22 }
23 if (!(temperature > 0.0)) {
24 throw std::invalid_argument("MonteCarlo: temperature must be positive");
25 }
26 if (!(stepSize > 0.0)) {
27 throw std::invalid_argument("MonteCarlo: step_size must be positive");
28 }
29
31 QUILL_LOG_WARNING(
log,
"Failed to write movie.con header frame");
32 }
33
34 const double kB =
params.constants().kB;
35 int accepts = 0;
36 for (int steps = 0; steps < numSteps; ++steps) {
38 const double ecurrent =
matter->getPotentialEnergy();
40 QUILL_LOG_WARNING(
log,
"Failed to append movie.con frame");
41 }
42
44 for (int i = 0; i < trial.rows(); ++i) {
46 continue;
47 }
48 for (int j = 0; j < 3; ++j) {
50 }
51 }
52 matter->setPositions(trial);
53 const double etrial =
matter->getPotentialEnergy();
54 const double de = etrial - ecurrent;
55 bool accept = de <= 0.0;
56 if (!accept) {
57 const double arg = -de / (kB * temperature);
59 }
60 if (accept) {
61 ++accepts;
62 } else {
63 matter->setPositions(current);
64 }
65 }
66 QUILL_LOG_INFO(
log,
"accepts: {}", accepts);
67}
Eigen::Matrix< double, Eigen::Dynamic, 3, eOnStorageOrder > AtomMatrix
constexpr bool io_ok(IoStatus s) noexcept
double gaussRandom(double avg, double std)