Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect and remove duplicate dihedrals with the same periodicity #530

Merged
merged 7 commits into from
Nov 27, 2024

Conversation

LSchwiebert
Copy link
Collaborator

Resolves issue #529 by issuing a warning when dihedrals with matching periodicities are found. The duplicates are removed and a warning is generated. The warning looks like this:

Warning: Skipping duplicate periodicity of 3 for dihedral HCCTCTHC!

@LSchwiebert
Copy link
Collaborator Author

Updated patch to generate an error and exit, instead of a warning, if the duplicate dihedrals have different parameter values.

Copy link
Collaborator

@bc118 bc118 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested code and functioned as intended.

src/FFSetup.cpp Outdated
}

if (duplicate) {
std::cout << "Warning: Skipping duplicate periodicity of " << index
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This patch works as intended per my testing.

I looked at what NAMD does. It appears they take the last one input. We may want to be consistent with them for py-mcmd.

My last comment, is more of a question, and this would go for non-bonded and all bonded parameters.

Do we want to more than NAMD and check if the parameters are the same or different (this would be more than NAMD):

  • if the same, skip it
  • if different, throw an error or overwrite with the last one.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested is and it Looks like it is working as intended.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the patch so that it throws an error if the parameters differ by more than 0.001. I have to imagine that would be a mistake. Since it only proceeds if they match, then which one we save doesn't matter.

So, we do the same thing as NAMD if the parameters match except we also issue a warning, and we terminate with an error if the parameters differ.

@bc118
Copy link
Collaborator

bc118 commented Aug 24, 2024

Reviewed and it looks good. My only suggested change is some wording. Change the below "Using first entry." to "found duplicate entry" or similar, as it errors out if the entries are different, other than the n-value, which the n-value has to be allowed to be different in this periodic form because it is listed as n entries.

Reading DIHEDRALS parameters.
Warning: Ignoring duplicate periodicity of 3 for dihedral HCCTCTHC in GOMC_pdb_psf_ff_files_dihedrals_zeroed.inp. Using first entry.

@LSchwiebert
Copy link
Collaborator Author

Thanks for the feedback. I have revised the error messages per your suggestions.

Copy link
Collaborator

@jpotoff jpotoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@LSchwiebert LSchwiebert merged commit a505e46 into development Nov 27, 2024
2 of 3 checks passed
@LSchwiebert LSchwiebert deleted the duplicate-dihedral branch November 27, 2024 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GOMC should detect Forcefield files with duplicate dihedral definitions with the same periodicity
3 participants