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

writing out pairs section of top file #714

Merged
merged 9 commits into from
Apr 24, 2023

Conversation

daico007
Copy link
Member

I just realized the top.py is not writing out the [ pairs ] sections in the .top file, which result in the loss of 1-4 interactions (vdw and electrostatics). This PR adds worker method to write out that section.

@chrisiacovella chrisiacovella self-requested a review April 17, 2023 20:06
@chrisiacovella
Copy link
Contributor

So it looks like you just need to update the testing comparison files to be the ones that now include pairs (and some minor changes to formatting re: tabs). I did some hand validation of benzene and it looks correct.

On a similar note, this only works with gen-pairs = yes . We should probably have a separate PR later that allows these to be explicitly written out (i.e., with parameters as well). If we are using something like CHARMM, there are cases where we will use different parameters explicitly for certain 1-4 parameters. I assume this would require adding in a new data structure in topology.

@daico007
Copy link
Member Author

I will update the tests at some point this week! Also agree with you on gen-pairs, that it needed to be handled in a different PR. We actually already have a special structure for special pair potential (https://github.com/mosdef-hub/gmso/blob/main/gmso/core/pairpotential_type.py), but it still needed to be tested more and implemented in these writers.

@codecov
Copy link

codecov bot commented Apr 19, 2023

Codecov Report

Patch coverage: 95.55% and project coverage change: +0.02 🎉

Comparison is base (fcab136) 92.24% compared to head (e20cebb) 92.27%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #714      +/-   ##
==========================================
+ Coverage   92.24%   92.27%   +0.02%     
==========================================
  Files          65       65              
  Lines        5856     5890      +34     
==========================================
+ Hits         5402     5435      +33     
- Misses        454      455       +1     
Impacted Files Coverage Δ
gmso/formats/top.py 88.42% <92.59%> (+0.70%) ⬆️
gmso/utils/connectivity.py 97.70% <100.00%> (+0.47%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@daico007
Copy link
Member Author

Test files have been updated and all the tests is passing now.

@chrisiacovella
Copy link
Contributor

This looks good! We should probably have another discussion about what is the best way to check the output files so that we can have consistency across the writer tests. This could potentially also be related to the stress testing suite we mentioned, where we have some scripts for the engines that actually try to run what was generated.

@chrisiacovella
Copy link
Contributor

It looks like the generate_pairs function doesn't have a direct test (only indirect via what is written to file). It would probably be good to add that before we merge.

@daico007
Copy link
Member Author

I have some additional tests for this PR (not pushed yet), basically writing out and comparing the new files against some reference files.

More sorting in the identify_connection step.
Add more rigorous unit testing (exact file comparison).
gmso/formats/top.py Fixed Show fixed Hide fixed
@@ -5,7 +5,8 @@

import gmso
from gmso.exceptions import EngineIncompatibilityError
from gmso.formats.top import write_top
from gmso.external.convert_mbuild import from_mbuild
from gmso.formats.top import _generate_pairs_list, write_top

Check notice

Code scanning / CodeQL

Unused import

Import of 'write_top' is not used.
@daico007
Copy link
Member Author

@chrisiacovella, I added more unit tests (include the _generate_pairs) and all of them seems to pass now.

Copy link
Contributor

@chrisiacovella chrisiacovella left a comment

Choose a reason for hiding this comment

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

This looks good!

@daico007 daico007 merged commit c735cc3 into mosdef-hub:main Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants