diff --git a/abipy/core/fields.py b/abipy/core/fields.py index ef71c4e08..232eca7d8 100644 --- a/abipy/core/fields.py +++ b/abipy/core/fields.py @@ -6,7 +6,6 @@ import os import numpy as np import pandas as pd -import pymatgen.core.units as pmgu import typing from collections import OrderedDict @@ -15,7 +14,7 @@ from monty.string import is_string, marquee from monty.termcolor import cprint from monty.inspect import all_subclasses -from pymatgen.core.units import bohr_to_angstrom +from pymatgen.core.units import bohr_to_angstrom, Ha_to_eV from abipy.core.structure import Structure from abipy.core.mesh3d import Mesh3D from abipy.core.func1d import Function1D @@ -1180,9 +1179,9 @@ def read_denpot(self, varname, field_cls): # Structure uses Angstrom. Abinit uses Bohr. if issubclass(field_cls, _DensityField): - fact = 1 / pmgu.bohr_to_angstrom ** 3 + fact = 1 / bohr_to_angstrom ** 3 if issubclass(field_cls, _PotentialField): - fact = pmgu.Ha_to_eV / pmgu.bohr_to_angstrom ** 3 + fact = Ha_to_eV datar *= fact diff --git a/abipy/core/tests/test_fields.py b/abipy/core/tests/test_fields.py index 382c83dfb..3cde89f91 100644 --- a/abipy/core/tests/test_fields.py +++ b/abipy/core/tests/test_fields.py @@ -259,7 +259,7 @@ def test_potentials(self): assert not vxc.is_density_like assert vxc.is_potential_like #assert vxc.datar.dtype == np.float - fact = pmgu.Ha_to_eV / pmgu.bohr_to_angstrom ** 3 + fact = pmgu.Ha_to_eV self.assert_almost_equal(vxc.datar[0, 0, 0, 0], -2.40411892342838 * fact) self.assert_almost_equal(vxc.datar[0, 0, 0, 1], -2.31753083824603 * fact)