Created
July 14, 2015 19:08
-
-
Save rmcgibbo/a8e7095e4cae21bf3adb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/fahbench/Simulation.cpp b/fahbench/Simulation.cpp | |
index 0c8e1b9..94ab01f 100644 | |
--- a/fahbench/Simulation.cpp | |
+++ b/fahbench/Simulation.cpp | |
@@ -139,7 +139,9 @@ float Simulation::benchmark(Context & context, Updater & update) const { | |
} | |
if (nan_check_freq > 0 && i % nan_check_freq == 0) | |
StateTests::checkForNans(context.getState(State::Positions | State::Velocities | State::Forces)); | |
+ printf("Step...\n"); | |
context.getIntegrator().step(1); | |
+ printf("Done!\n"); | |
} | |
// last getState makes sure everything in the queue has been flushed. | |
State finalState = context.getState(State::Positions | State::Velocities | State::Forces | State::Energy); | |
diff --git a/fahbench/StateTests.cpp b/fahbench/StateTests.cpp | |
index 5101fb8..e08ab0c 100644 | |
--- a/fahbench/StateTests.cpp | |
+++ b/fahbench/StateTests.cpp | |
@@ -28,10 +28,15 @@ void StateTests::checkForNans(const State & state) { | |
const vector<Vec3> & velocities = state.getVelocities(); | |
const vector<Vec3> & forces = state.getForces(); | |
- for (unsigned i = 0; i < positions.size(); i++) | |
- for (int j = 0; j < 3; j++) | |
- if (isnan(positions[i][j])) | |
- throw std::runtime_error(boost::str(boost::format("NaNs detected in positions: (%1%, %2%)") % i % j)); | |
+ for (unsigned i = 0; i < positions.size(); i++) { | |
+ for (int j = 0; j < 3; j++) { | |
+ if (isnan(positions[i][j])) { | |
+ printf("NaNs detected!\n"); | |
+ std::string err = boost::str(boost::format("NaNs detected in positions: (%1%, %2%)") % i % j); | |
+ throw std::runtime_error(err); | |
+ } | |
+ } | |
+ } | |
for (unsigned i = 0; i < velocities.size(); i++) | |
for (int j = 0; j < 3; j++) | |
diff --git a/fahbench/cmd/CommandLineUpdater.cpp b/fahbench/cmd/CommandLineUpdater.cpp | |
index 87fac07..6eee506 100644 | |
--- a/fahbench/cmd/CommandLineUpdater.cpp | |
+++ b/fahbench/cmd/CommandLineUpdater.cpp | |
@@ -1,4 +1,5 @@ | |
#include <iostream> | |
+#include <cstdio> | |
#include "CommandLineUpdater.h" | |
void CommandLineUpdater::progress(int i, int numSteps, double ns_per_day) { | |
diff --git a/fahbench/cmd/cmd-main.cpp b/fahbench/cmd/cmd-main.cpp | |
index e9ef3d8..8a50bd5 100644 | |
--- a/fahbench/cmd/cmd-main.cpp | |
+++ b/fahbench/cmd/cmd-main.cpp | |
@@ -188,7 +188,12 @@ int main(int argc, char ** argv) { | |
CommandLineUpdater updater; | |
try { | |
- SimulationResult result = simulation.run(updater); | |
+ SimulationResult result; | |
+ try { | |
+ result = simulation.run(updater); | |
+ } catch (...) { | |
+ printf("ERROR!\n"); | |
+ } | |
updater.message(boost::format( | |
"Final score: %1$8.4f\n" | |
"Scaled score: %2$8.4f (%3% atoms)\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment