diff --git a/src/py4vasp/calculation/_density.py b/src/py4vasp/calculation/_density.py index 19fb5c46..37dd926f 100644 --- a/src/py4vasp/calculation/_density.py +++ b/src/py4vasp/calculation/_density.py @@ -84,7 +84,7 @@ def __str__(self): _raise_error_if_no_data(self._raw_data.charge) grid = self._raw_data.charge.shape[1:] topology = calculation.topology.from_data(self._raw_data.structure.topology) - if self._selection == "tau": + if self._selection == "kinetic_energy": name = "Kinetic energy" elif self.is_nonpolarized(): name = "Nonpolarized" @@ -114,7 +114,7 @@ def selections(self): the 0-th component. To nest density and component, please use parentheses, e.g. ``charge(1, 2)`` or - ``3(tau)``. + ``3(kinetic_energy)``. For convenience, py4vasp accepts the following aliases @@ -122,7 +122,7 @@ def selections(self): *charge*, *n*, *charge_density*, and *electronic_charge_density* kinetic energy density - *tau*, *kinetic_energy*, and *kinetic_energy_density* + *kinetic_energy*, *kinetic_energy*, and *kinetic_energy_density* 0th component {component0} @@ -367,7 +367,7 @@ def to_contour( Take a slice of the kinetic energy density along the first lattice vector and rotate it such that the normal of the plane aligns with the x axis. - >>> calc.density.to_contour("tau", a=0.3, normal="x") + >>> calc.density.to_contour("kinetic_energy", a=0.3, normal="x") """ cut, fraction = self._get_cut(a, b, c) plane = slicing.plane(self._structure.lattice_vectors(), cut, normal) @@ -427,7 +427,7 @@ def to_quiver(self, *, a=None, b=None, c=None, supercell=None, normal=None): first lattice vector and rotate it such that the normal of the plane aligns with the x axis. - >>> calc.density.to_quiver("tau", a=0.3, normal="x") + >>> calc.density.to_quiver("kinetic_energy", a=0.3, normal="x") """ cut, fraction = self._get_cut(a, b, c) plane = slicing.plane(self._structure.lattice_vectors(), cut, normal) @@ -468,9 +468,8 @@ def is_noncollinear(self): @property def _selection(self): selection_map = { - "tau": "tau", - "kinetic_energy": "tau", - "kinetic_energy_density": "tau", + "kinetic_energy": "kinetic_energy", + "kinetic_energy_density": "kinetic_energy", } return selection_map.get(super()._selection) diff --git a/tests/calculation/test_density.py b/tests/calculation/test_density.py index e2586f06..d05d7391 100644 --- a/tests/calculation/test_density.py +++ b/tests/calculation/test_density.py @@ -10,7 +10,7 @@ from py4vasp._third_party.view import Isosurface -@pytest.fixture(params=[None, "tau"]) +@pytest.fixture(params=[None, "kinetic_energy"]) def density_source(request): return request.param @@ -76,7 +76,7 @@ def get_expected_dict(charge, source): def get_expected_string(selection, source): structure, *density = selection.split() - if source == "tau": + if source == "kinetic_energy": density = "Kinetic energy" elif not density: density = "Nonpolarized" @@ -172,7 +172,7 @@ def test_collinear_plot(selection, collinear_density, Assert): isosurfaces=isosurfaces, ) if selection in ("magnetization", "mag", "m"): - # magnetization not allowed for tau + # magnetization not allowed for kinetic_energy return check_view(collinear_density, expected, Assert, selection=selection, isolevel=0.1) @@ -208,7 +208,7 @@ def test_plotting_noncollinear_density(selections, noncollinear_density, Assert) else: expected_labels = (f"{source}({selection})" for selection in selections) expected_density = noncollinear_density.ref.output[source][1:] - if "(" in selections[0]: # magnetization not allowed for tau + if "(" in selections[0]: # magnetization not allowed for kinetic_energy return isosurfaces = [ Isosurface(isolevel=0.2, color=_config.VASP_BLUE, opacity=0.3), @@ -296,7 +296,7 @@ def test_collinear_to_contour(selection, collinear_density, Assert): expected_label = f"{source}({selection})" expected_data = collinear_density.ref.output[source][1, :, :, 7] if selection in ("magnetization", "mag", "m"): - # magnetization not allowed for tau + # magnetization not allowed for kinetic_energy return expected_lattice = collinear_density.ref.structure.lattice_vectors()[:2, :2] graph = collinear_density.to_contour(selection, c=-0.5) @@ -333,7 +333,7 @@ def test_noncollinear_to_contour(noncollinear_density, selections, Assert): else: expected_labels = (f"{source}({selection})" for selection in selections) expected_data = noncollinear_density.ref.output[source][1:, :, 5, :] - if "(" in selections[0]: # magnetization not allowed for tau + if "(" in selections[0]: # magnetization not allowed for kinetic_energy return graph = noncollinear_density.to_contour(" ".join(selections), b=0.4) expected_lattice = noncollinear_density.ref.structure.lattice_vectors()[::2, ::2]