Skip to content

Commit

Permalink
Merge pull request #536 from GOMC-WSU/bad-config
Browse files Browse the repository at this point in the history
Terminate GOMC (with an error message) if the initial configuration has infinite energy
  • Loading branch information
jpotoff authored Jan 27, 2025
2 parents cef510c + ec61655 commit c7a79c5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Simulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ Simulation::~Simulation() {
void Simulation::RunSimulation(void) {
GOMC_EVENT_START(1, GomcProfileEvent::MC_RUN);
double startEnergy = system->potential.totalEnergy.total;
if (!std::isfinite(startEnergy)) {
std::cout
<< "Initial system has non-finite energy. This is usually caused"
" by two or more atoms in the initial configuration having "
"identical coordinates. Please correct your input file and rerun.\n";

exit(EXIT_FAILURE);
}
if (totalSteps == 0) {
for (int i = 0; i < (int)frameSteps.size(); i++) {
if (i == 0) {
Expand Down

0 comments on commit c7a79c5

Please sign in to comment.