Dielectric constant

16 views
Skip to first unread message

DULAL MONDAL

unread,
Oct 31, 2023, 9:49:52 AM10/31/23
to mdnalysis-...@googlegroups.com
Dear Experts,

I am trying to calculate the dielectric constant. I am trying the following tutorial.


My code is like below.

import MDAnalysis as mda
from MDAnalysis.analysis.dielectric import DielectricConstant
import numpy as np
import matplotlib.pyplot as plt
from MDAnalysis.analysis import density

u= mda.Universe("HCAII.prmtop","1st_md.pdb")

diel = DielectricConstant(u.atoms)
diel.run()

But it gives the following error.


NotImplementedError                       Traceback (most recent call last)
/tmp/ipykernel_12249/2334277914.py in <module>
      1 diel = DielectricConstant(u.atoms)
----> 2 diel.run()
      3

~/anaconda3/lib/python3.9/site-packages/MDAnalysis/analysis/base.py in run(self, start, stop, step, verbose)
    292         self._setup_frames(self._trajectory, start, stop, step)
    293         logger.info("Starting preparation")
--> 294         self._prepare()
    295         for i, ts in enumerate(ProgressBar(
    296                 self._trajectory[self.start:self.stop:self.step],

~/anaconda3/lib/python3.9/site-packages/MDAnalysis/analysis/dielectric.py in _prepare(self)
    131         if not np.allclose(self.atomgroup.total_charge(compound='fragments'),
    132                            0.0, atol=1E-5):
--> 133             raise NotImplementedError("Analysis for non-neutral systems or"
    134                                       " systems with free charges are not"
    135                                       " available.")

NotImplementedError: Analysis for non-neutral systems or systems with free charges are not available.

Thanking You
Dulal Mondal


Oliver Beckstein

unread,
Oct 31, 2023, 10:42:37 AM10/31/23
to mdnalysis-discussion
Hi Dulal,

I suggest you have a look at MAICoS for more advanced calculations, see
https://maicos.readthedocs.io/en/main/examples/dielectric-profiles.html . The docs (like https://maicos.readthedocs.io/en/main/references/modules/dielectricplanar.html) also have detailed reference lists on the calculations and you might want to read up on dielectric constants and charged systems.

(MAICoS also uses MDAnalysis but is a specialized kit for Molecular Analysis for Interfacial and Confined Systems.)

Oliver
--
Oliver Beckstein (he/his/him)

email: orbe...@mdanalysis.org
twitter: @orbeckst
GitHub: @orbeckst

MDAnalysis – a NumFOCUS fiscally sponsored project
https://www.mdanalysis.org/



Reply all
Reply to author
Forward
0 new messages