-
Notifications
You must be signed in to change notification settings - Fork 674
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
[WIP] Modify charge neutrality verification in DielectricConstant #4249
Conversation
Linter Bot Results:Hi @orionarcher! Thanks for making this PR. We linted your code and found the following: Some issues were found with the formatting of your code.
Please have a look at the Please note: The |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## develop #4249 +/- ##
===========================================
+ Coverage 93.40% 93.41% +0.01%
===========================================
Files 169 183 +14
Lines 22204 23310 +1106
Branches 4064 4064
===========================================
+ Hits 20740 21776 +1036
- Misses 948 1018 +70
Partials 516 516
☔ View full report in Codecov by Sentry. |
Seems reasonable to me, would need some tests ofc, but understand its WIP. |
Great thank you, wanted to get a second opinion before updating changelog and writing tests. |
@orionarcher if your system has free charges/ions you can not use this module because the equation does not hold if you have free charges. |
Got it. Thanks for the clarification @PicoCentauri. |
Yes, you are not the first one that run into these problems. It might be worth to explain this in the docstring. |
How challenging do you think it would be to implement a dielectric calculation that could handle free charges / ions? |
What you have to do is to calculate the frequency dependent dielectric spectrum and take the zero frequency limit to get the dielectric constant. I did the implementation once, but the code never made it into the main branch, because I branched off too far. 😅 It would be wonderful too have this in mda. Details on the theory are i.e. explained here. See equation (10) and section S6 in the SI. |
Thanks for sharing! I'll need to implement this myself in the next couple months. I'll ping you when/if I pick it back up. |
Sure! You can also always ask me on Discord! |
This PR allows DielectricConstant to check charge neutrality at a customizable granularity.
I work with electrolyte systems where
fragments
are molecules in the system. In the current scheme, DielectricConstant will fail on my systems because ions have non-zero charge. This adds a keyword to modify the level at which charge neutrality is enforced.I think changing the hard-coded option to "group" to simplify the API would also be a good fix, it's unclear to me why "fragments" is desirable.
Fixes #
Changes made in this Pull Request:
check_neutrality_of
kwarg to DielectricConstantPR Checklist
Developers certificate of origin
📚 Documentation preview 📚: https://mdanalysis--4249.org.readthedocs.build/en/4249/