-
Notifications
You must be signed in to change notification settings - Fork 677
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
Docs warning for charge in DielectricConstant #4263
Conversation
fbf1c5a
to
f266906
Compare
Linter Bot Results:Hi @PicoCentauri! Thanks for making this PR. We linted your code and found the following: There are currently no issues detected! 🎉 |
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## develop #4263 +/- ##
===========================================
+ Coverage 93.39% 93.41% +0.01%
===========================================
Files 170 183 +13
Lines 22224 23309 +1085
Branches 4065 4064 -1
===========================================
+ Hits 20757 21775 +1018
- Misses 951 1018 +67
Partials 516 516
☔ View full report in Codecov by Sentry. |
@@ -65,6 +65,10 @@ class DielectricConstant(AnalysisBase): | |||
the usual case if electrostatics are handled with a Ewald summation | |||
technique. See [Neumann1983]_ for details on the derivation. | |||
|
|||
.. warning:: | |||
Applying this class requires that no free charges, such as ions or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a stupid question, if this is relying on an Ewald style summation, how well does it handle a system with a net charge?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, totally valid question. The answer will be a bit longer. sorry.
Ewald can handle systems with a net charge. You introduce a homogenous background charge that neutralizes the system, which will lead to an additional force an all atoms. This is unproblematic for homogenous systems but lead to severe artifacts in inhomogenous systems like membranes etc.
The equation we use here is derived for an Ewald boundary condition, meaning that the dielectric constant of sorrounding medium is a metal (

Now, why are charges a problem? The issue is that in the derivation you demand that Maxwell's equation for electric field
where
Does this answer your question?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think you could transfer this very insightful piece of writing to an issue for future reference. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we sure. If people find it there.
f266906
to
a3d0bc6
Compare
@@ -65,6 +65,10 @@ class DielectricConstant(AnalysisBase): | |||
the usual case if electrostatics are handled with a Ewald summation | |||
technique. See [Neumann1983]_ for details on the derivation. | |||
|
|||
.. warning:: | |||
Applying this class requires that no free charges, such as ions or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think you could transfer this very insightful piece of writing to an issue for future reference. :)
@@ -65,6 +65,10 @@ class DielectricConstant(AnalysisBase): | |||
the usual case if electrostatics are handled with a Ewald summation | |||
technique. See [Neumann1983]_ for details on the derivation. | |||
|
|||
.. warning:: | |||
Applying this class requires that no free charges, such as ions or | |||
charged fragments, are present in the simulation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PicoCentauri perhaps I am misunderstanding but you can have no charged anything or is it that you need overall neutrality. Apologoies if silly q.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nono it is fine. This is really a bit tricky. There are even publications where people do this wrong.
As we do it in the assertion in the class' prepare function you need charge neutral molecules. In a classical MD world they can have of course have partial charges. In fact, they have to because otherwise the system's total dipole moment would be zero and with it the dielectric constant.
What you can not have are ions such as Na+ Cl- or other charged fragments i.e negative carboxylic acid groups COO- or positive amine groups H3N+.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im happy with the warning as is, once we resolve conflicts I think we can merge and address better documentation in #4262.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Apologies I jumped in here and fixed the changelog conflicts. (no need to wait for CI again, this is a docs change anyways)
Fixes #4262
Add a warning box to the documentation that only charge neutral systems can be handled by the current implementation.
See also #4249 for details on why this is important.
PR Checklist
Developers certificate of origin
📚 Documentation preview 📚: https://mdanalysis--4263.org.readthedocs.build/en/4263/