Skip to content

Commit

Permalink
Terminate GOMC (with an error message) if the initial configuration h…
Browse files Browse the repository at this point in the history
…as infinite energy, such as two atoms with identical coordinates
  • Loading branch information
LSchwiebert committed Jan 20, 2025
1 parent 303f1f7 commit ec61655
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 ec61655

Please sign in to comment.