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

QUAD_EFG includes units for efg mode of MPNMRSet #2508

Closed
jacksund opened this issue Apr 27, 2022 · 0 comments · Fixed by #2509
Closed

QUAD_EFG includes units for efg mode of MPNMRSet #2508

jacksund opened this issue Apr 27, 2022 · 0 comments · Fixed by #2509

Comments

@jacksund
Copy link
Contributor

Describe the bug
The MPNMRSet (with mode="efg") writes units to file for the QUAD_EFG setting. This occurs because it is using FloatWithUnit class under the hood.

To Reproduce

from pymatgen.core import Structure
from pymatgen.io.vasp.sets import MPNMRSet

# Random structure to test with
s = Structure(
    lattice=[
        [3.485437, 0.0, 2.012318],
        [1.161812, 3.286101, 2.012318],
        [0.0, 0.0, 4.024635],
    ],
    species=["Na", "Cl"],
    coords=[[0.0, 0.0, 0.0], [0.5, 0.5, 0.5]],
)

MPNMRSet(s, mode="efg").incar.write_file("INCAR")

This produces the following INCAR:

ALGO = FAST
EDIFF = -1e-10
ENCUT = 520
IBRION = -1
ISIF = 3
ISMEAR = -5
ISPIN = 2
ISYM = 0
LAECHG = True
LASPH = True
LCHARG = False
LEFG = True
LORBIT = 11
LREAL = Auto
LVHAR = True
LWAVE = False
MAGMOM = 2*0.6
NELM = 100
NELMIN = 10
NSW = 0
PREC = ACCURATE
QUAD_EFG = 104.1 mbarn -81.65 mbarn   # <------------ Note the bug here
SIGMA = 0.01

Expected behavior

The INCAR should instead have the following result for QUAD_EFG:

QUAD_EFG = 104.1 -81.65

Desktop:

  • OS: Linux
  • Version 2022.4.19

Additional context
This is a quick, one-line fix. We need to just convert from FloatWithUnit to Float here:

quad_efg = [Species(p).get_nmr_quadrupole_moment(isotopes.get(p, None)) for p in self.poscar.site_symbols]

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 a pull request may close this issue.

1 participant