Skip to content

Commit

Permalink
Remove duplicate dihedrals with the same periodicity and issue a warning
Browse files Browse the repository at this point in the history
  • Loading branch information
LSchwiebert committed Aug 7, 2024
1 parent 124ff98 commit 6b2a8ea
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/FFSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,17 @@ void Dihedral::Read(Reader &param, std::string const &firstVar) {
}
void Dihedral::Add(std::string const &merged, const double coeff,
const uint index, const double def) {
// Check for (and skip) duplicate periodicities for the same dihedral
bool duplicate = false;
for (auto it = n[merged].begin(); it != n[merged].end(); ++it) {
duplicate |= *it == index;
}

if (duplicate) {
std::cout << "Warning: Skipping duplicate periodicity of " << index
<< " for dihedral " << merged << "!\n";
return;
}
++countTerms;
Kchi[merged].push_back(EnConvIfCHARMM(coeff));
n[merged].push_back(index);
Expand Down

0 comments on commit 6b2a8ea

Please sign in to comment.