From 14a6c562e7ccdd4d294e9f6aca4161a3ba73546d Mon Sep 17 00:00:00 2001 From: Janosh Riebesell Date: Tue, 10 Oct 2023 10:18:35 -0700 Subject: [PATCH] Fix `ruff` `N806` (#3394) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix typo * snake_case names * release.yml add 📦 Dependencies and 🏷️ Type Hints --- .github/release.yml | 4 + pymatgen/analysis/chempot_diagram.py | 12 +- pymatgen/analysis/molecule_matcher.py | 16 +- pymatgen/core/periodic_table.py | 7 +- pymatgen/electronic_structure/cohp.py | 26 +-- tests/electronic_structure/test_dos.py | 268 ++++++++++++------------- tests/io/lobster/test_inputs.py | 116 +++++------ tests/io/qchem/test_sets.py | 194 +++++++++--------- tests/io/qchem/test_utils.py | 8 +- 9 files changed, 325 insertions(+), 326 deletions(-) diff --git a/.github/release.yml b/.github/release.yml index 4e8b9054c44..5bc3ec2d50c 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -24,5 +24,9 @@ changelog: labels: [security] - title: 🏥 Package Health labels: [pkg] + - title: 📦 Dependencies + labels: [dependencies, outdated] + - title: 🏷️ Type Hints + labels: [types] - title: 🤷‍♂️ Other Changes labels: ["*"] diff --git a/pymatgen/analysis/chempot_diagram.py b/pymatgen/analysis/chempot_diagram.py index 20df8637f54..d6214857dfd 100644 --- a/pymatgen/analysis/chempot_diagram.py +++ b/pymatgen/analysis/chempot_diagram.py @@ -281,14 +281,14 @@ def _get_2d_plot(self, elements: list[Element], label_stable: bool | None, eleme pts_2d[:, idx] = np.where(np.isclose(col, self.default_min_limit), new_lim, col) entry = self.entry_dict[formula] - ann_formula = formula + anno_formula = formula if hasattr(entry, "original_entry"): - ann_formula = entry.original_entry.composition.reduced_formula + anno_formula = entry.original_entry.composition.reduced_formula center = pts_2d.mean(axis=0) normal = get_2d_orthonormal_vector(pts_2d) ann_loc = center + 0.25 * normal # offset annotation location by arb. amount - annotation = self._get_annotation(ann_loc, ann_formula) + annotation = self._get_annotation(ann_loc, anno_formula) annotations.append(annotation) draw_domains[formula] = pts_2d @@ -353,11 +353,11 @@ def _get_3d_plot( simplexes, ann_loc = self._get_3d_domain_simplexes_and_ann_loc(pts_3d) - ann_formula = formula + anno_formula = formula if hasattr(entry, "original_entry"): - ann_formula = entry.original_entry.composition.reduced_formula + anno_formula = entry.original_entry.composition.reduced_formula - annotation = self._get_annotation(ann_loc, ann_formula) + annotation = self._get_annotation(ann_loc, anno_formula) annotations.append(annotation) domain_simplexes[formula] = simplexes diff --git a/pymatgen/analysis/molecule_matcher.py b/pymatgen/analysis/molecule_matcher.py index 64846cb3871..c87ff783d42 100644 --- a/pymatgen/analysis/molecule_matcher.py +++ b/pymatgen/analysis/molecule_matcher.py @@ -64,7 +64,7 @@ def uniform_labels(self, mol1, mol2): of the two molecules. The value of each element is the original atom index in mol1 or mol2 of the current atom in uniform atom order. - (None, None) if unform atom is not available. + (None, None) if uniform atom is not available. """ @abc.abstractmethod @@ -81,10 +81,10 @@ def get_molecule_hash(self, mol): """ @classmethod - def from_dict(cls, d): + def from_dict(cls, dct): """ Args: - d (dict): Dict representation. + dct (dict): Dict representation. Returns: AbstractMolAtomMapper @@ -95,12 +95,12 @@ def from_dict(cls, d): f"pymatgen.analysis.{trans_modules}", globals(), locals(), - [d["@class"]], + [dct["@class"]], level, ) - if hasattr(mod, d["@class"]): - class_proxy = getattr(mod, d["@class"]) - return class_proxy.from_dict(d) + if hasattr(mod, dct["@class"]): + class_proxy = getattr(mod, dct["@class"]) + return class_proxy.from_dict(dct) raise ValueError("Invalid Comparator dict") @@ -124,7 +124,7 @@ def uniform_labels(self, mol1, mol2): of the two molecules. The value of each element is the original atom index in mol1 or mol2 of the current atom in uniform atom order. - (None, None) if unform atom is not available. + (None, None) if uniform atom is not available. """ ob_mol1 = BabelMolAdaptor(mol1).openbabel_mol ob_mol2 = BabelMolAdaptor(mol2).openbabel_mol diff --git a/pymatgen/core/periodic_table.py b/pymatgen/core/periodic_table.py index df687a767a9..2757a902957 100644 --- a/pymatgen/core/periodic_table.py +++ b/pymatgen/core/periodic_table.py @@ -631,12 +631,7 @@ def is_noble_gas(self) -> bool: @property def is_transition_metal(self) -> bool: """True if element is a transition metal.""" - ns = list(range(21, 31)) - ns.extend(list(range(39, 49))) - ns.append(57) - ns.extend(list(range(72, 81))) - ns.append(89) - ns.extend(list(range(104, 113))) + ns = (*range(21, 31), *range(39, 49), 57, *range(72, 81), 89, *range(104, 113)) return self.Z in ns @property diff --git a/pymatgen/electronic_structure/cohp.py b/pymatgen/electronic_structure/cohp.py index 76e66f3af92..44a23eae83e 100644 --- a/pymatgen/electronic_structure/cohp.py +++ b/pymatgen/electronic_structure/cohp.py @@ -63,28 +63,28 @@ def __init__(self, efermi, energies, cohp, are_coops=False, are_cobis=False, ico def __repr__(self): """Returns a string that can be easily plotted (e.g. using gnuplot).""" if self.are_coops: - cohpstring = "COOP" + cohp_str = "COOP" elif self.are_cobis: - cohpstring = "COBI" + cohp_str = "COBI" else: - cohpstring = "COHP" - header = ["Energy", cohpstring + "Up"] + cohp_str = "COHP" + header = ["Energy", cohp_str + "Up"] data = [self.energies, self.cohp[Spin.up]] if Spin.down in self.cohp: - header.append(cohpstring + "Down") + header.append(cohp_str + "Down") data.append(self.cohp[Spin.down]) if self.icohp: - header.append("I" + cohpstring + "Up") + header.append("I" + cohp_str + "Up") data.append(self.icohp[Spin.up]) if Spin.down in self.cohp: - header.append("I" + cohpstring + "Down") + header.append("I" + cohp_str + "Down") data.append(self.icohp[Spin.down]) - formatheader = "#" + " ".join("{:15s}" for __ in header) - formatdata = " ".join("{:.5f}" for __ in header) - stringarray = [formatheader.format(*header)] - for i, __ in enumerate(self.energies): - stringarray.append(formatdata.format(*(d[i] for d in data))) - return "\n".join(stringarray) + format_header = "#" + " ".join("{:15s}" for __ in header) + format_data = " ".join("{:.5f}" for __ in header) + str_arr = [format_header.format(*header)] + for idx in range(len(self.energies)): + str_arr.append(format_data.format(*(d[idx] for d in data))) + return "\n".join(str_arr) def as_dict(self): """JSON-serializable dict representation of COHP.""" diff --git a/tests/electronic_structure/test_dos.py b/tests/electronic_structure/test_dos.py index 793b1b3a744..2a34c50c4fe 100644 --- a/tests/electronic_structure/test_dos.py +++ b/tests/electronic_structure/test_dos.py @@ -355,14 +355,14 @@ def test_get_site_orbital_dos(self): energies_spin = [-11.25000, -7.50000, -3.75000, 0.00000, 3.75000, 7.50000] fermi = 0.0 - PDOS_F_2s_up = [0.00000, 0.00159, 0.00000, 0.00011, 0.00000, 0.00069] - PDOS_F_2s_down = [0.00000, 0.00159, 0.00000, 0.00011, 0.00000, 0.00069] - PDOS_F_2py_up = [0.00000, 0.00160, 0.00000, 0.25801, 0.00000, 0.00029] - PDOS_F_2py_down = [0.00000, 0.00161, 0.00000, 0.25819, 0.00000, 0.00029] - PDOS_F_2pz_up = [0.00000, 0.00161, 0.00000, 0.25823, 0.00000, 0.00029] - PDOS_F_2pz_down = [0.00000, 0.00160, 0.00000, 0.25795, 0.00000, 0.00029] - PDOS_F_2px_up = [0.00000, 0.00160, 0.00000, 0.25805, 0.00000, 0.00029] - PDOS_F_2px_down = [0.00000, 0.00161, 0.00000, 0.25814, 0.00000, 0.00029] + pdos_f_2s_up = [0.00000, 0.00159, 0.00000, 0.00011, 0.00000, 0.00069] + pdos_f_2s_down = [0.00000, 0.00159, 0.00000, 0.00011, 0.00000, 0.00069] + pdos_f_2py_up = [0.00000, 0.00160, 0.00000, 0.25801, 0.00000, 0.00029] + pdos_f_2py_down = [0.00000, 0.00161, 0.00000, 0.25819, 0.00000, 0.00029] + pdos_f_2pz_up = [0.00000, 0.00161, 0.00000, 0.25823, 0.00000, 0.00029] + pdos_f_2pz_down = [0.00000, 0.00160, 0.00000, 0.25795, 0.00000, 0.00029] + pdos_f_2px_up = [0.00000, 0.00160, 0.00000, 0.25805, 0.00000, 0.00029] + pdos_f_2px_down = [0.00000, 0.00161, 0.00000, 0.25814, 0.00000, 0.00029] assert ( self.LobsterCompleteDOS_spin.get_site_orbital_dos(site=self.structure[0], orbital="2s").energies.tolist() == energies_spin @@ -374,13 +374,13 @@ def test_get_site_orbital_dos(self): self.LobsterCompleteDOS_spin.get_site_orbital_dos(site=self.structure[0], orbital="2s") .densities[Spin.up] .tolist() - == PDOS_F_2s_up + == pdos_f_2s_up ) assert ( self.LobsterCompleteDOS_spin.get_site_orbital_dos(site=self.structure[0], orbital="2s") .densities[Spin.down] .tolist() - == PDOS_F_2s_down + == pdos_f_2s_down ) assert ( self.LobsterCompleteDOS_spin.get_site_orbital_dos(site=self.structure[0], orbital="2p_z").energies.tolist() @@ -394,13 +394,13 @@ def test_get_site_orbital_dos(self): self.LobsterCompleteDOS_spin.get_site_orbital_dos(site=self.structure[0], orbital="2p_y") .densities[Spin.up] .tolist() - == PDOS_F_2py_up + == pdos_f_2py_up ) assert ( self.LobsterCompleteDOS_spin.get_site_orbital_dos(site=self.structure[0], orbital="2p_y") .densities[Spin.down] .tolist() - == PDOS_F_2py_down + == pdos_f_2py_down ) assert ( self.LobsterCompleteDOS_spin.get_site_orbital_dos(site=self.structure[0], orbital="2p_y").energies.tolist() @@ -414,13 +414,13 @@ def test_get_site_orbital_dos(self): self.LobsterCompleteDOS_spin.get_site_orbital_dos(site=self.structure[0], orbital="2p_z") .densities[Spin.up] .tolist() - == PDOS_F_2pz_up + == pdos_f_2pz_up ) assert ( self.LobsterCompleteDOS_spin.get_site_orbital_dos(site=self.structure[0], orbital="2p_z") .densities[Spin.down] .tolist() - == PDOS_F_2pz_down + == pdos_f_2pz_down ) assert self.LobsterCompleteDOS_spin.get_site_orbital_dos( site=self.structure[0], orbital="2p_z" @@ -434,13 +434,13 @@ def test_get_site_orbital_dos(self): self.LobsterCompleteDOS_spin.get_site_orbital_dos(site=self.structure[0], orbital="2p_x") .densities[Spin.up] .tolist() - == PDOS_F_2px_up + == pdos_f_2px_up ) assert ( self.LobsterCompleteDOS_spin.get_site_orbital_dos(site=self.structure[0], orbital="2p_x") .densities[Spin.down] .tolist() - == PDOS_F_2px_down + == pdos_f_2px_down ) assert self.LobsterCompleteDOS_spin.get_site_orbital_dos( site=self.structure[0], orbital="2p_x" @@ -448,10 +448,10 @@ def test_get_site_orbital_dos(self): # without spin polarization energies_nonspin = [-11.25000, -7.50000, -3.75000, 0.00000, 3.75000, 7.50000] - PDOS_F_2s = [0.00000, 0.00320, 0.00000, 0.00017, 0.00000, 0.00060] - PDOS_F_2py = [0.00000, 0.00322, 0.00000, 0.51635, 0.00000, 0.00037] - PDOS_F_2pz = [0.00000, 0.00322, 0.00000, 0.51636, 0.00000, 0.00037] - PDOS_F_2px = [0.00000, 0.00322, 0.00000, 0.51634, 0.00000, 0.00037] + pdos_f_2s = [0.00000, 0.00320, 0.00000, 0.00017, 0.00000, 0.00060] + pdos_f_2py = [0.00000, 0.00322, 0.00000, 0.51635, 0.00000, 0.00037] + pdos_f_2pz = [0.00000, 0.00322, 0.00000, 0.51636, 0.00000, 0.00037] + pdos_f_2px = [0.00000, 0.00322, 0.00000, 0.51634, 0.00000, 0.00037] assert ( self.LobsterCompleteDOS_nonspin.get_site_orbital_dos(site=self.structure[0], orbital="2s").energies.tolist() @@ -464,7 +464,7 @@ def test_get_site_orbital_dos(self): self.LobsterCompleteDOS_nonspin.get_site_orbital_dos(site=self.structure[0], orbital="2s") .densities[Spin.up] .tolist() - == PDOS_F_2s + == pdos_f_2s ) assert ( @@ -480,7 +480,7 @@ def test_get_site_orbital_dos(self): self.LobsterCompleteDOS_nonspin.get_site_orbital_dos(site=self.structure[0], orbital="2p_y") .densities[Spin.up] .tolist() - == PDOS_F_2py + == pdos_f_2py ) assert ( @@ -496,7 +496,7 @@ def test_get_site_orbital_dos(self): self.LobsterCompleteDOS_nonspin.get_site_orbital_dos(site=self.structure[0], orbital="2p_z") .densities[Spin.up] .tolist() - == PDOS_F_2pz + == pdos_f_2pz ) assert ( @@ -512,29 +512,29 @@ def test_get_site_orbital_dos(self): self.LobsterCompleteDOS_nonspin.get_site_orbital_dos(site=self.structure[0], orbital="2p_x") .densities[Spin.up] .tolist() - == PDOS_F_2px + == pdos_f_2px ) def test_get_site_t2g_eg_resolved_dos(self): # with spin polarization energies = [-11.25000, -7.50000, -3.75000, 0.00000, 3.75000, 7.50000] efermi = 0.0 - PDOS_Mn_3dxy_up = [0.00000, 0.00001, 0.10301, 0.16070, 0.00070, 0.00060] - PDOS_Mn_3dxy_down = [0.00000, 0.00000, 0.00380, 0.00996, 0.03012, 0.21890] - PDOS_Mn_3dyz_up = [0.00000, 0.00001, 0.10301, 0.16070, 0.00070, 0.00060] - PDOS_Mn_3dyz_down = [0.00000, 0.00000, 0.00380, 0.00996, 0.03012, 0.21890] - PDOS_Mn_3dz2_up = [0.00000, 0.00001, 0.09608, 0.16941, 0.00028, 0.00028] - PDOS_Mn_3dz2_down = [0.00000, 0.00000, 0.00433, 0.00539, 0.06000, 0.19427] - PDOS_Mn_3dxz_up = [0.00000, 0.00001, 0.09746, 0.16767, 0.00036, 0.00034] - PDOS_Mn_3dxz_down = [0.00000, 0.00000, 0.00422, 0.00630, 0.05402, 0.19919] - PDOS_Mn_3dx2_up = [0.00000, 0.00001, 0.09330, 0.17289, 0.00011, 0.00015] - PDOS_Mn_3dx2_down = [0.00000, 0.00000, 0.00454, 0.00356, 0.07195, 0.18442] - - PDOS_Mn_eg_up = (np.array(PDOS_Mn_3dx2_up) + np.array(PDOS_Mn_3dz2_up)).tolist() - PDOS_Mn_eg_down = (np.array(PDOS_Mn_3dx2_down) + np.array(PDOS_Mn_3dz2_down)).tolist() - PDOS_Mn_t2g_up = (np.array(PDOS_Mn_3dxy_up) + np.array(PDOS_Mn_3dxz_up) + np.array(PDOS_Mn_3dyz_up)).tolist() - PDOS_Mn_t2g_down = ( - np.array(PDOS_Mn_3dxy_down) + np.array(PDOS_Mn_3dxz_down) + np.array(PDOS_Mn_3dyz_down) + pdos_mn_3dxy_up = [0.00000, 0.00001, 0.10301, 0.16070, 0.00070, 0.00060] + pdos_mn_3dxy_down = [0.00000, 0.00000, 0.00380, 0.00996, 0.03012, 0.21890] + pdos_mn_3dyz_up = [0.00000, 0.00001, 0.10301, 0.16070, 0.00070, 0.00060] + pdos_mn_3dyz_down = [0.00000, 0.00000, 0.00380, 0.00996, 0.03012, 0.21890] + pdos_mn_3dz2_up = [0.00000, 0.00001, 0.09608, 0.16941, 0.00028, 0.00028] + pdos_mn_3dz2_down = [0.00000, 0.00000, 0.00433, 0.00539, 0.06000, 0.19427] + pdos_mn_3dxz_up = [0.00000, 0.00001, 0.09746, 0.16767, 0.00036, 0.00034] + pdos_mn_3dxz_down = [0.00000, 0.00000, 0.00422, 0.00630, 0.05402, 0.19919] + pdos_mn_3dx2_up = [0.00000, 0.00001, 0.09330, 0.17289, 0.00011, 0.00015] + pdos_mn_3dx2_down = [0.00000, 0.00000, 0.00454, 0.00356, 0.07195, 0.18442] + + pdos_mn_eg_up = (np.array(pdos_mn_3dx2_up) + np.array(pdos_mn_3dz2_up)).tolist() + pdos_mn_eg_down = (np.array(pdos_mn_3dx2_down) + np.array(pdos_mn_3dz2_down)).tolist() + pdos_mn_t2g_up = (np.array(pdos_mn_3dxy_up) + np.array(pdos_mn_3dxz_up) + np.array(pdos_mn_3dyz_up)).tolist() + pdos_mn_t2g_down = ( + np.array(pdos_mn_3dxy_down) + np.array(pdos_mn_3dxz_down) + np.array(pdos_mn_3dyz_down) ).tolist() for iel, el in enumerate( @@ -542,25 +542,25 @@ def test_get_site_t2g_eg_resolved_dos(self): .densities[Spin.up] .tolist() ): - assert el == approx(PDOS_Mn_eg_up[iel]) + assert el == approx(pdos_mn_eg_up[iel]) for iel, el in enumerate( self.LobsterCompleteDOS_MnO.get_site_t2g_eg_resolved_dos(self.structure_MnO[1])["e_g"] .densities[Spin.down] .tolist() ): - assert el == approx(PDOS_Mn_eg_down[iel]) + assert el == approx(pdos_mn_eg_down[iel]) for iel, el in enumerate( self.LobsterCompleteDOS_MnO.get_site_t2g_eg_resolved_dos(self.structure_MnO[1])["t2g"] .densities[Spin.up] .tolist() ): - assert el == approx(PDOS_Mn_t2g_up[iel]) + assert el == approx(pdos_mn_t2g_up[iel]) for iel, el in enumerate( self.LobsterCompleteDOS_MnO.get_site_t2g_eg_resolved_dos(self.structure_MnO[1])["t2g"] .densities[Spin.down] .tolist() ): - assert el == approx(PDOS_Mn_t2g_down[iel]) + assert el == approx(pdos_mn_t2g_down[iel]) assert ( energies == self.LobsterCompleteDOS_MnO.get_site_t2g_eg_resolved_dos(self.structure_MnO[1])["e_g"].energies.tolist() @@ -574,27 +574,27 @@ def test_get_site_t2g_eg_resolved_dos(self): # without spin polarization energies_nonspin = [-11.25000, -7.50000, -3.75000, 0.00000, 3.75000, 7.50000] - PDOS_Mn_3dxy = [0.00000, 0.00000, 0.02032, 0.16094, 0.33659, 0.01291] - PDOS_Mn_3dyz = [0.00000, 0.00000, 0.02032, 0.16126, 0.33628, 0.01290] - PDOS_Mn_3dz2 = [0.00000, 0.00000, 0.02591, 0.31460, 0.18658, 0.00509] - PDOS_Mn_3dxz = [0.00000, 0.00000, 0.02484, 0.28501, 0.21541, 0.00663] - PDOS_Mn_3dx2 = [0.00000, 0.00000, 0.02817, 0.37594, 0.12669, 0.00194] + pdos_mn_3dxy = [0.00000, 0.00000, 0.02032, 0.16094, 0.33659, 0.01291] + pdos_mn_3dyz = [0.00000, 0.00000, 0.02032, 0.16126, 0.33628, 0.01290] + pdos_mn_3dz2 = [0.00000, 0.00000, 0.02591, 0.31460, 0.18658, 0.00509] + pdos_mn_3dxz = [0.00000, 0.00000, 0.02484, 0.28501, 0.21541, 0.00663] + pdos_mn_3dx2 = [0.00000, 0.00000, 0.02817, 0.37594, 0.12669, 0.00194] - PDOS_Mn_eg = (np.array(PDOS_Mn_3dx2) + np.array(PDOS_Mn_3dz2)).tolist() - PDOS_Mn_t2g = (np.array(PDOS_Mn_3dxy) + np.array(PDOS_Mn_3dxz) + np.array(PDOS_Mn_3dyz)).tolist() + pdos_mn_eg = (np.array(pdos_mn_3dx2) + np.array(pdos_mn_3dz2)).tolist() + pdos_mn_t2g = (np.array(pdos_mn_3dxy) + np.array(pdos_mn_3dxz) + np.array(pdos_mn_3dyz)).tolist() for iel, el in enumerate( self.LobsterCompleteDOS_MnO_nonspin.get_site_t2g_eg_resolved_dos(self.structure_MnO[1])["e_g"] .densities[Spin.up] .tolist() ): - assert el == approx(PDOS_Mn_eg[iel]) + assert el == approx(pdos_mn_eg[iel]) for iel, el in enumerate( self.LobsterCompleteDOS_MnO_nonspin.get_site_t2g_eg_resolved_dos(self.structure_MnO[1])["t2g"] .densities[Spin.up] .tolist() ): - assert el == approx(PDOS_Mn_t2g[iel]) + assert el == approx(pdos_mn_t2g[iel]) assert ( energies_nonspin == self.LobsterCompleteDOS_MnO_nonspin.get_site_t2g_eg_resolved_dos(self.structure_MnO[1])[ @@ -621,43 +621,43 @@ def test_get_spd_dos(self): energies_spin = [-11.25000, -7.50000, -3.75000, 0.00000, 3.75000, 7.50000] fermi = 0.0 - PDOS_F_2s_up = [0.00000, 0.00159, 0.00000, 0.00011, 0.00000, 0.00069] - PDOS_F_2s_down = [0.00000, 0.00159, 0.00000, 0.00011, 0.00000, 0.00069] - PDOS_F_2py_up = [0.00000, 0.00160, 0.00000, 0.25801, 0.00000, 0.00029] - PDOS_F_2py_down = [0.00000, 0.00161, 0.00000, 0.25819, 0.00000, 0.00029] - PDOS_F_2pz_up = [0.00000, 0.00161, 0.00000, 0.25823, 0.00000, 0.00029] - PDOS_F_2pz_down = [0.00000, 0.00160, 0.00000, 0.25795, 0.00000, 0.00029] - PDOS_F_2px_up = [0.00000, 0.00160, 0.00000, 0.25805, 0.00000, 0.00029] - PDOS_F_2px_down = [0.00000, 0.00161, 0.00000, 0.25814, 0.00000, 0.00029] - - PDOS_K_3s_up = [0.00000, 0.00000, 0.00000, 0.00008, 0.00000, 0.00007] - PDOS_K_3s_down = [0.00000, 0.00000, 0.00000, 0.00008, 0.00000, 0.00007] - PDOS_K_4s_up = [0.00000, 0.00018, 0.00000, 0.02035, 0.00000, 0.02411] - PDOS_K_4s_down = [0.00000, 0.00018, 0.00000, 0.02036, 0.00000, 0.02420] - PDOS_K_3py_up = [0.00000, 0.26447, 0.00000, 0.00172, 0.00000, 0.00000] - PDOS_K_3py_down = [0.00000, 0.26446, 0.00000, 0.00172, 0.00000, 0.00000] - PDOS_K_3pz_up = [0.00000, 0.26446, 0.00000, 0.00172, 0.00000, 0.00000] - PDOS_K_3pz_down = [0.00000, 0.26447, 0.00000, 0.00172, 0.00000, 0.00000] - PDOS_K_3px_up = [0.00000, 0.26447, 0.00000, 0.00172, 0.00000, 0.00000] - PDOS_K_3px_down = [0.00000, 0.26446, 0.00000, 0.00172, 0.00000, 0.00000] - - PDOS_s_up = (np.array(PDOS_F_2s_up) + np.array(PDOS_K_3s_up) + np.array(PDOS_K_4s_up)).tolist() - PDOS_s_down = (np.array(PDOS_F_2s_down) + np.array(PDOS_K_3s_down) + np.array(PDOS_K_4s_down)).tolist() - PDOS_p_up = ( - np.array(PDOS_F_2py_up) - + np.array(PDOS_F_2pz_up) - + np.array(PDOS_F_2px_up) - + np.array(PDOS_K_3py_up) - + np.array(PDOS_K_3pz_up) - + np.array(PDOS_K_3px_up) + pdos_f_2s_up = [0.00000, 0.00159, 0.00000, 0.00011, 0.00000, 0.00069] + pdos_f_2s_down = [0.00000, 0.00159, 0.00000, 0.00011, 0.00000, 0.00069] + pdos_f_2py_up = [0.00000, 0.00160, 0.00000, 0.25801, 0.00000, 0.00029] + pdos_f_2py_down = [0.00000, 0.00161, 0.00000, 0.25819, 0.00000, 0.00029] + pdos_f_2pz_up = [0.00000, 0.00161, 0.00000, 0.25823, 0.00000, 0.00029] + pdos_f_2pz_down = [0.00000, 0.00160, 0.00000, 0.25795, 0.00000, 0.00029] + pdos_f_2px_up = [0.00000, 0.00160, 0.00000, 0.25805, 0.00000, 0.00029] + pdos_f_2px_down = [0.00000, 0.00161, 0.00000, 0.25814, 0.00000, 0.00029] + + pdos_k_3s_up = [0.00000, 0.00000, 0.00000, 0.00008, 0.00000, 0.00007] + pdos_k_3s_down = [0.00000, 0.00000, 0.00000, 0.00008, 0.00000, 0.00007] + pdos_k_4s_up = [0.00000, 0.00018, 0.00000, 0.02035, 0.00000, 0.02411] + pdos_k_4s_down = [0.00000, 0.00018, 0.00000, 0.02036, 0.00000, 0.02420] + pdos_k_3py_up = [0.00000, 0.26447, 0.00000, 0.00172, 0.00000, 0.00000] + pdos_k_3py_down = [0.00000, 0.26446, 0.00000, 0.00172, 0.00000, 0.00000] + pdos_k_3pz_up = [0.00000, 0.26446, 0.00000, 0.00172, 0.00000, 0.00000] + pdos_k_3pz_down = [0.00000, 0.26447, 0.00000, 0.00172, 0.00000, 0.00000] + pdos_k_3px_up = [0.00000, 0.26447, 0.00000, 0.00172, 0.00000, 0.00000] + pdos_k_3px_down = [0.00000, 0.26446, 0.00000, 0.00172, 0.00000, 0.00000] + + pdos_s_up = (np.array(pdos_f_2s_up) + np.array(pdos_k_3s_up) + np.array(pdos_k_4s_up)).tolist() + pdos_s_down = (np.array(pdos_f_2s_down) + np.array(pdos_k_3s_down) + np.array(pdos_k_4s_down)).tolist() + pdos_p_up = ( + np.array(pdos_f_2py_up) + + np.array(pdos_f_2pz_up) + + np.array(pdos_f_2px_up) + + np.array(pdos_k_3py_up) + + np.array(pdos_k_3pz_up) + + np.array(pdos_k_3px_up) ).tolist() - PDOS_p_down = ( - np.array(PDOS_F_2py_down) - + np.array(PDOS_F_2pz_down) - + np.array(PDOS_F_2px_down) - + np.array(PDOS_K_3py_down) - + np.array(PDOS_K_3pz_down) - + np.array(PDOS_K_3px_down) + pdos_p_down = ( + np.array(pdos_f_2py_down) + + np.array(pdos_f_2pz_down) + + np.array(pdos_f_2px_down) + + np.array(pdos_k_3py_down) + + np.array(pdos_k_3pz_down) + + np.array(pdos_k_3px_down) ).tolist() assert self.LobsterCompleteDOS_spin.get_spd_dos()[OrbitalType(0)].energies.tolist() == energies_spin assert self.LobsterCompleteDOS_spin.get_spd_dos()[OrbitalType(0)].efermi == fermi @@ -665,68 +665,68 @@ def test_get_spd_dos(self): for ilistel, listel in enumerate( self.LobsterCompleteDOS_spin.get_spd_dos()[OrbitalType(0)].densities[Spin.up].tolist() ): - assert listel == approx(PDOS_s_up[ilistel]) + assert listel == approx(pdos_s_up[ilistel]) for ilistel, listel in enumerate( self.LobsterCompleteDOS_spin.get_spd_dos()[OrbitalType(0)].densities[Spin.down].tolist() ): - assert listel == approx(PDOS_s_down[ilistel]) + assert listel == approx(pdos_s_down[ilistel]) for ilistel, listel in enumerate( self.LobsterCompleteDOS_spin.get_spd_dos()[OrbitalType(1)].densities[Spin.up].tolist() ): - assert listel == approx(PDOS_p_up[ilistel]) + assert listel == approx(pdos_p_up[ilistel]) for ilistel, listel in enumerate( self.LobsterCompleteDOS_spin.get_spd_dos()[OrbitalType(1)].densities[Spin.down].tolist() ): - assert listel == approx(PDOS_p_down[ilistel]) + assert listel == approx(pdos_p_down[ilistel]) # without spin polarization energies_nonspin = [-11.25000, -7.50000, -3.75000, 0.00000, 3.75000, 7.50000] - PDOS_F_2s = [0.00000, 0.00320, 0.00000, 0.00017, 0.00000, 0.00060] - PDOS_F_2py = [0.00000, 0.00322, 0.00000, 0.51635, 0.00000, 0.00037] - PDOS_F_2pz = [0.00000, 0.00322, 0.00000, 0.51636, 0.00000, 0.00037] - PDOS_F_2px = [0.00000, 0.00322, 0.00000, 0.51634, 0.00000, 0.00037] - - PDOS_K_3s = [0.00000, 0.00000, 0.00000, 0.00005, 0.00000, 0.00004] - - PDOS_K_4s = [0.00000, 0.00040, 0.00000, 0.04039, 0.00000, 0.02241] - - PDOS_K_3py = [0.00000, 0.52891, 0.00000, 0.00345, 0.00000, 0.00000] - PDOS_K_3pz = [0.00000, 0.52891, 0.00000, 0.00345, 0.00000, 0.00000] - PDOS_K_3px = [0.00000, 0.52891, 0.00000, 0.00345, 0.00000, 0.00000] - - PDOS_s = (np.array(PDOS_F_2s) + np.array(PDOS_K_3s) + np.array(PDOS_K_4s)).tolist() - PDOS_p = ( - np.array(PDOS_F_2py) - + np.array(PDOS_F_2pz) - + np.array(PDOS_F_2px) - + np.array(PDOS_K_3py) - + np.array(PDOS_K_3pz) - + np.array(PDOS_K_3px) + pdos_f_2s = [0.00000, 0.00320, 0.00000, 0.00017, 0.00000, 0.00060] + pdos_f_2py = [0.00000, 0.00322, 0.00000, 0.51635, 0.00000, 0.00037] + pdos_f_2pz = [0.00000, 0.00322, 0.00000, 0.51636, 0.00000, 0.00037] + pdos_f_2px = [0.00000, 0.00322, 0.00000, 0.51634, 0.00000, 0.00037] + + pdos_k_3s = [0.00000, 0.00000, 0.00000, 0.00005, 0.00000, 0.00004] + + pdos_k_4s = [0.00000, 0.00040, 0.00000, 0.04039, 0.00000, 0.02241] + + pdos_k_3py = [0.00000, 0.52891, 0.00000, 0.00345, 0.00000, 0.00000] + pdos_k_3pz = [0.00000, 0.52891, 0.00000, 0.00345, 0.00000, 0.00000] + pdos_k_3px = [0.00000, 0.52891, 0.00000, 0.00345, 0.00000, 0.00000] + + pdos_s = (np.array(pdos_f_2s) + np.array(pdos_k_3s) + np.array(pdos_k_4s)).tolist() + pdos_p = ( + np.array(pdos_f_2py) + + np.array(pdos_f_2pz) + + np.array(pdos_f_2px) + + np.array(pdos_k_3py) + + np.array(pdos_k_3pz) + + np.array(pdos_k_3px) ).tolist() assert self.LobsterCompleteDOS_nonspin.get_spd_dos()[OrbitalType(0)].energies.tolist() == energies_nonspin for ilistel, listel in enumerate( self.LobsterCompleteDOS_nonspin.get_spd_dos()[OrbitalType(0)].densities[Spin.up].tolist() ): - assert listel == approx(PDOS_s[ilistel]) + assert listel == approx(pdos_s[ilistel]) for ilistel, listel in enumerate( self.LobsterCompleteDOS_nonspin.get_spd_dos()[OrbitalType(1)].densities[Spin.up].tolist() ): - assert listel == approx(PDOS_p[ilistel]) + assert listel == approx(pdos_p[ilistel]) def test_get_element_spd_dos(self): # with spin polarization energies_spin = [-11.25000, -7.50000, -3.75000, 0.00000, 3.75000, 7.50000] fermi = 0.0 - PDOS_F_2s_up = [0.00000, 0.00159, 0.00000, 0.00011, 0.00000, 0.00069] - PDOS_F_2s_down = [0.00000, 0.00159, 0.00000, 0.00011, 0.00000, 0.00069] - PDOS_F_2py_up = [0.00000, 0.00160, 0.00000, 0.25801, 0.00000, 0.00029] - PDOS_F_2py_down = [0.00000, 0.00161, 0.00000, 0.25819, 0.00000, 0.00029] - PDOS_F_2pz_up = [0.00000, 0.00161, 0.00000, 0.25823, 0.00000, 0.00029] - PDOS_F_2pz_down = [0.00000, 0.00160, 0.00000, 0.25795, 0.00000, 0.00029] - PDOS_F_2px_up = [0.00000, 0.00160, 0.00000, 0.25805, 0.00000, 0.00029] - PDOS_F_2px_down = [0.00000, 0.00161, 0.00000, 0.25814, 0.00000, 0.00029] + pdos_f_2s_up = [0.00000, 0.00159, 0.00000, 0.00011, 0.00000, 0.00069] + pdos_f_2s_down = [0.00000, 0.00159, 0.00000, 0.00011, 0.00000, 0.00069] + pdos_f_2py_up = [0.00000, 0.00160, 0.00000, 0.25801, 0.00000, 0.00029] + pdos_f_2py_down = [0.00000, 0.00161, 0.00000, 0.25819, 0.00000, 0.00029] + pdos_f_2pz_up = [0.00000, 0.00161, 0.00000, 0.25823, 0.00000, 0.00029] + pdos_f_2pz_down = [0.00000, 0.00160, 0.00000, 0.25795, 0.00000, 0.00029] + pdos_f_2px_up = [0.00000, 0.00160, 0.00000, 0.25805, 0.00000, 0.00029] + pdos_f_2px_down = [0.00000, 0.00161, 0.00000, 0.25814, 0.00000, 0.00029] assert ( self.LobsterCompleteDOS_spin.get_element_spd_dos(el=Element("F"))[OrbitalType(0)].energies.tolist() @@ -737,13 +737,13 @@ def test_get_element_spd_dos(self): self.LobsterCompleteDOS_spin.get_element_spd_dos(el=Element("F"))[OrbitalType(0)] .densities[Spin.up] .tolist() - == PDOS_F_2s_up + == pdos_f_2s_up ) assert ( self.LobsterCompleteDOS_spin.get_element_spd_dos(el=Element("F"))[OrbitalType(0)] .densities[Spin.down] .tolist() - == PDOS_F_2s_down + == pdos_f_2s_down ) for ilistel, listel in enumerate( @@ -752,7 +752,7 @@ def test_get_element_spd_dos(self): .tolist() ): assert listel == approx( - (np.array(PDOS_F_2px_up) + np.array(PDOS_F_2py_up) + np.array(PDOS_F_2pz_up)).tolist()[ilistel] + (np.array(pdos_f_2px_up) + np.array(pdos_f_2py_up) + np.array(pdos_f_2pz_up)).tolist()[ilistel] ) for ilistel, listel in enumerate( @@ -761,7 +761,7 @@ def test_get_element_spd_dos(self): .tolist() ): assert listel == approx( - (np.array(PDOS_F_2px_down) + np.array(PDOS_F_2py_down) + np.array(PDOS_F_2pz_down)).tolist()[ilistel] + (np.array(pdos_f_2px_down) + np.array(pdos_f_2py_down) + np.array(pdos_f_2pz_down)).tolist()[ilistel] ) assert self.LobsterCompleteDOS_spin.get_element_spd_dos(el=Element("F"))[OrbitalType(0)].efermi == approx(fermi) @@ -769,10 +769,10 @@ def test_get_element_spd_dos(self): # without spin polarization energies_nonspin = [-11.25000, -7.50000, -3.75000, 0.00000, 3.75000, 7.50000] efermi = 0.0 - PDOS_F_2s = [0.00000, 0.00320, 0.00000, 0.00017, 0.00000, 0.00060] - PDOS_F_2py = [0.00000, 0.00322, 0.00000, 0.51635, 0.00000, 0.00037] - PDOS_F_2pz = [0.00000, 0.00322, 0.00000, 0.51636, 0.00000, 0.00037] - PDOS_F_2px = [0.00000, 0.00322, 0.00000, 0.51634, 0.00000, 0.00037] + pdos_f_2s = [0.00000, 0.00320, 0.00000, 0.00017, 0.00000, 0.00060] + pdos_f_2py = [0.00000, 0.00322, 0.00000, 0.51635, 0.00000, 0.00037] + pdos_f_2pz = [0.00000, 0.00322, 0.00000, 0.51636, 0.00000, 0.00037] + pdos_f_2px = [0.00000, 0.00322, 0.00000, 0.51634, 0.00000, 0.00037] assert ( self.LobsterCompleteDOS_nonspin.get_element_spd_dos(el=Element("F"))[OrbitalType(0)].energies.tolist() @@ -783,7 +783,7 @@ def test_get_element_spd_dos(self): self.LobsterCompleteDOS_nonspin.get_element_spd_dos(el=Element("F"))[OrbitalType(0)] .densities[Spin.up] .tolist() - == PDOS_F_2s + == pdos_f_2s ) for ilistel, listel in enumerate( @@ -792,7 +792,7 @@ def test_get_element_spd_dos(self): .tolist() ): assert listel == approx( - (np.array(PDOS_F_2px) + np.array(PDOS_F_2py) + np.array(PDOS_F_2pz)).tolist()[ilistel] + (np.array(pdos_f_2px) + np.array(pdos_f_2py) + np.array(pdos_f_2pz)).tolist()[ilistel] ) assert self.LobsterCompleteDOS_nonspin.get_element_spd_dos(el=Element("F"))[OrbitalType(0)].efermi == approx( diff --git a/tests/io/lobster/test_inputs.py b/tests/io/lobster/test_inputs.py index 10889d27df2..818fcc1d36a 100644 --- a/tests/io/lobster/test_inputs.py +++ b/tests/io/lobster/test_inputs.py @@ -739,14 +739,14 @@ def test_complete_dos(self): tdos_down = [0.00000, 0.79999, 0.00000, 0.79999, 0.00000, 0.02586] fermi = 0.0 - PDOS_F_2s_up = [0.00000, 0.00159, 0.00000, 0.00011, 0.00000, 0.00069] - PDOS_F_2s_down = [0.00000, 0.00159, 0.00000, 0.00011, 0.00000, 0.00069] - PDOS_F_2py_up = [0.00000, 0.00160, 0.00000, 0.25801, 0.00000, 0.00029] - PDOS_F_2py_down = [0.00000, 0.00161, 0.00000, 0.25819, 0.00000, 0.00029] - PDOS_F_2pz_up = [0.00000, 0.00161, 0.00000, 0.25823, 0.00000, 0.00029] - PDOS_F_2pz_down = [0.00000, 0.00160, 0.00000, 0.25795, 0.00000, 0.00029] - PDOS_F_2px_up = [0.00000, 0.00160, 0.00000, 0.25805, 0.00000, 0.00029] - PDOS_F_2px_down = [0.00000, 0.00161, 0.00000, 0.25814, 0.00000, 0.00029] + pdos_f_2s_up = [0.00000, 0.00159, 0.00000, 0.00011, 0.00000, 0.00069] + pdos_f_2s_down = [0.00000, 0.00159, 0.00000, 0.00011, 0.00000, 0.00069] + pdos_f_2py_up = [0.00000, 0.00160, 0.00000, 0.25801, 0.00000, 0.00029] + pdos_f_2py_down = [0.00000, 0.00161, 0.00000, 0.25819, 0.00000, 0.00029] + pdos_f_2pz_up = [0.00000, 0.00161, 0.00000, 0.25823, 0.00000, 0.00029] + pdos_f_2pz_down = [0.00000, 0.00160, 0.00000, 0.25795, 0.00000, 0.00029] + pdos_f_2px_up = [0.00000, 0.00160, 0.00000, 0.25805, 0.00000, 0.00029] + pdos_f_2px_down = [0.00000, 0.00161, 0.00000, 0.25814, 0.00000, 0.00029] assert energies_spin == self.DOSCAR_spin_pol.completedos.energies.tolist() assert tdos_up == self.DOSCAR_spin_pol.completedos.densities[Spin.up].tolist() @@ -761,21 +761,21 @@ def test_complete_dos(self): self.DOSCAR_spin_pol2.completedos.structure.frac_coords, self.structure.frac_coords, ) - assert self.DOSCAR_spin_pol.completedos.pdos[self.structure[0]]["2s"][Spin.up].tolist() == PDOS_F_2s_up - assert self.DOSCAR_spin_pol.completedos.pdos[self.structure[0]]["2s"][Spin.down].tolist() == PDOS_F_2s_down - assert self.DOSCAR_spin_pol.completedos.pdos[self.structure[0]]["2p_y"][Spin.up].tolist() == PDOS_F_2py_up - assert self.DOSCAR_spin_pol.completedos.pdos[self.structure[0]]["2p_y"][Spin.down].tolist() == PDOS_F_2py_down - assert self.DOSCAR_spin_pol.completedos.pdos[self.structure[0]]["2p_z"][Spin.up].tolist() == PDOS_F_2pz_up - assert self.DOSCAR_spin_pol.completedos.pdos[self.structure[0]]["2p_z"][Spin.down].tolist() == PDOS_F_2pz_down - assert self.DOSCAR_spin_pol.completedos.pdos[self.structure[0]]["2p_x"][Spin.up].tolist() == PDOS_F_2px_up - assert self.DOSCAR_spin_pol.completedos.pdos[self.structure[0]]["2p_x"][Spin.down].tolist() == PDOS_F_2px_down + assert self.DOSCAR_spin_pol.completedos.pdos[self.structure[0]]["2s"][Spin.up].tolist() == pdos_f_2s_up + assert self.DOSCAR_spin_pol.completedos.pdos[self.structure[0]]["2s"][Spin.down].tolist() == pdos_f_2s_down + assert self.DOSCAR_spin_pol.completedos.pdos[self.structure[0]]["2p_y"][Spin.up].tolist() == pdos_f_2py_up + assert self.DOSCAR_spin_pol.completedos.pdos[self.structure[0]]["2p_y"][Spin.down].tolist() == pdos_f_2py_down + assert self.DOSCAR_spin_pol.completedos.pdos[self.structure[0]]["2p_z"][Spin.up].tolist() == pdos_f_2pz_up + assert self.DOSCAR_spin_pol.completedos.pdos[self.structure[0]]["2p_z"][Spin.down].tolist() == pdos_f_2pz_down + assert self.DOSCAR_spin_pol.completedos.pdos[self.structure[0]]["2p_x"][Spin.up].tolist() == pdos_f_2px_up + assert self.DOSCAR_spin_pol.completedos.pdos[self.structure[0]]["2p_x"][Spin.down].tolist() == pdos_f_2px_down energies_nonspin = [-11.25000, -7.50000, -3.75000, 0.00000, 3.75000, 7.50000] tdos_nonspin = [0.00000, 1.60000, 0.00000, 1.60000, 0.00000, 0.02418] - PDOS_F_2s = [0.00000, 0.00320, 0.00000, 0.00017, 0.00000, 0.00060] - PDOS_F_2py = [0.00000, 0.00322, 0.00000, 0.51635, 0.00000, 0.00037] - PDOS_F_2pz = [0.00000, 0.00322, 0.00000, 0.51636, 0.00000, 0.00037] - PDOS_F_2px = [0.00000, 0.00322, 0.00000, 0.51634, 0.00000, 0.00037] + pdos_f_2s = [0.00000, 0.00320, 0.00000, 0.00017, 0.00000, 0.00060] + pdos_f_2py = [0.00000, 0.00322, 0.00000, 0.51635, 0.00000, 0.00037] + pdos_f_2pz = [0.00000, 0.00322, 0.00000, 0.51636, 0.00000, 0.00037] + pdos_f_2px = [0.00000, 0.00322, 0.00000, 0.51634, 0.00000, 0.00037] assert energies_nonspin == self.DOSCAR_nonspin_pol.completedos.energies.tolist() @@ -785,42 +785,42 @@ def test_complete_dos(self): assert self.DOSCAR_nonspin_pol.completedos.structure == self.structure - assert self.DOSCAR_nonspin_pol.completedos.pdos[self.structure[0]]["2s"][Spin.up].tolist() == PDOS_F_2s - assert self.DOSCAR_nonspin_pol.completedos.pdos[self.structure[0]]["2p_y"][Spin.up].tolist() == PDOS_F_2py - assert self.DOSCAR_nonspin_pol.completedos.pdos[self.structure[0]]["2p_z"][Spin.up].tolist() == PDOS_F_2pz - assert self.DOSCAR_nonspin_pol.completedos.pdos[self.structure[0]]["2p_x"][Spin.up].tolist() == PDOS_F_2px + assert self.DOSCAR_nonspin_pol.completedos.pdos[self.structure[0]]["2s"][Spin.up].tolist() == pdos_f_2s + assert self.DOSCAR_nonspin_pol.completedos.pdos[self.structure[0]]["2p_y"][Spin.up].tolist() == pdos_f_2py + assert self.DOSCAR_nonspin_pol.completedos.pdos[self.structure[0]]["2p_z"][Spin.up].tolist() == pdos_f_2pz + assert self.DOSCAR_nonspin_pol.completedos.pdos[self.structure[0]]["2p_x"][Spin.up].tolist() == pdos_f_2px def test_pdos(self): # first for spin polarized version - PDOS_F_2s_up = [0.00000, 0.00159, 0.00000, 0.00011, 0.00000, 0.00069] - PDOS_F_2s_down = [0.00000, 0.00159, 0.00000, 0.00011, 0.00000, 0.00069] - PDOS_F_2py_up = [0.00000, 0.00160, 0.00000, 0.25801, 0.00000, 0.00029] - PDOS_F_2py_down = [0.00000, 0.00161, 0.00000, 0.25819, 0.00000, 0.00029] - PDOS_F_2pz_up = [0.00000, 0.00161, 0.00000, 0.25823, 0.00000, 0.00029] - PDOS_F_2pz_down = [0.00000, 0.00160, 0.00000, 0.25795, 0.00000, 0.00029] - PDOS_F_2px_up = [0.00000, 0.00160, 0.00000, 0.25805, 0.00000, 0.00029] - PDOS_F_2px_down = [0.00000, 0.00161, 0.00000, 0.25814, 0.00000, 0.00029] - - assert self.DOSCAR_spin_pol.pdos[0]["2s"][Spin.up].tolist() == PDOS_F_2s_up - assert self.DOSCAR_spin_pol.pdos[0]["2s"][Spin.down].tolist() == PDOS_F_2s_down - assert self.DOSCAR_spin_pol.pdos[0]["2p_y"][Spin.up].tolist() == PDOS_F_2py_up - assert self.DOSCAR_spin_pol.pdos[0]["2p_y"][Spin.down].tolist() == PDOS_F_2py_down - assert self.DOSCAR_spin_pol.pdos[0]["2p_z"][Spin.up].tolist() == PDOS_F_2pz_up - assert self.DOSCAR_spin_pol.pdos[0]["2p_z"][Spin.down].tolist() == PDOS_F_2pz_down - assert self.DOSCAR_spin_pol.pdos[0]["2p_x"][Spin.up].tolist() == PDOS_F_2px_up - assert self.DOSCAR_spin_pol.pdos[0]["2p_x"][Spin.down].tolist() == PDOS_F_2px_down + pdos_f_2s_up = [0.00000, 0.00159, 0.00000, 0.00011, 0.00000, 0.00069] + pdos_f_2s_down = [0.00000, 0.00159, 0.00000, 0.00011, 0.00000, 0.00069] + pdos_f_2py_up = [0.00000, 0.00160, 0.00000, 0.25801, 0.00000, 0.00029] + pdos_f_2py_down = [0.00000, 0.00161, 0.00000, 0.25819, 0.00000, 0.00029] + pdos_f_2pz_up = [0.00000, 0.00161, 0.00000, 0.25823, 0.00000, 0.00029] + pdos_f_2pz_down = [0.00000, 0.00160, 0.00000, 0.25795, 0.00000, 0.00029] + pdos_f_2px_up = [0.00000, 0.00160, 0.00000, 0.25805, 0.00000, 0.00029] + pdos_f_2px_down = [0.00000, 0.00161, 0.00000, 0.25814, 0.00000, 0.00029] + + assert self.DOSCAR_spin_pol.pdos[0]["2s"][Spin.up].tolist() == pdos_f_2s_up + assert self.DOSCAR_spin_pol.pdos[0]["2s"][Spin.down].tolist() == pdos_f_2s_down + assert self.DOSCAR_spin_pol.pdos[0]["2p_y"][Spin.up].tolist() == pdos_f_2py_up + assert self.DOSCAR_spin_pol.pdos[0]["2p_y"][Spin.down].tolist() == pdos_f_2py_down + assert self.DOSCAR_spin_pol.pdos[0]["2p_z"][Spin.up].tolist() == pdos_f_2pz_up + assert self.DOSCAR_spin_pol.pdos[0]["2p_z"][Spin.down].tolist() == pdos_f_2pz_down + assert self.DOSCAR_spin_pol.pdos[0]["2p_x"][Spin.up].tolist() == pdos_f_2px_up + assert self.DOSCAR_spin_pol.pdos[0]["2p_x"][Spin.down].tolist() == pdos_f_2px_down # non spin - PDOS_F_2s = [0.00000, 0.00320, 0.00000, 0.00017, 0.00000, 0.00060] - PDOS_F_2py = [0.00000, 0.00322, 0.00000, 0.51635, 0.00000, 0.00037] - PDOS_F_2pz = [0.00000, 0.00322, 0.00000, 0.51636, 0.00000, 0.00037] - PDOS_F_2px = [0.00000, 0.00322, 0.00000, 0.51634, 0.00000, 0.00037] + pdos_f_2s = [0.00000, 0.00320, 0.00000, 0.00017, 0.00000, 0.00060] + pdos_f_2py = [0.00000, 0.00322, 0.00000, 0.51635, 0.00000, 0.00037] + pdos_f_2pz = [0.00000, 0.00322, 0.00000, 0.51636, 0.00000, 0.00037] + pdos_f_2px = [0.00000, 0.00322, 0.00000, 0.51634, 0.00000, 0.00037] - assert self.DOSCAR_nonspin_pol.pdos[0]["2s"][Spin.up].tolist() == PDOS_F_2s - assert self.DOSCAR_nonspin_pol.pdos[0]["2p_y"][Spin.up].tolist() == PDOS_F_2py - assert self.DOSCAR_nonspin_pol.pdos[0]["2p_z"][Spin.up].tolist() == PDOS_F_2pz - assert self.DOSCAR_nonspin_pol.pdos[0]["2p_x"][Spin.up].tolist() == PDOS_F_2px + assert self.DOSCAR_nonspin_pol.pdos[0]["2s"][Spin.up].tolist() == pdos_f_2s + assert self.DOSCAR_nonspin_pol.pdos[0]["2p_y"][Spin.up].tolist() == pdos_f_2py + assert self.DOSCAR_nonspin_pol.pdos[0]["2p_z"][Spin.up].tolist() == pdos_f_2pz + assert self.DOSCAR_nonspin_pol.pdos[0]["2p_x"][Spin.up].tolist() == pdos_f_2px def test_tdos(self): # first for spin polarized version @@ -1797,25 +1797,25 @@ def test_get_basis(self): # get basis functions lobsterin1 = Lobsterin({}) potcar = Potcar.from_file(f"{TEST_FILES_DIR}/POTCAR.Fe3O4") - Potcar_names = [name["symbol"] for name in potcar.spec] + potcar_names = [name["symbol"] for name in potcar.spec] assert lobsterin1.get_basis( Structure.from_file(f"{TEST_FILES_DIR}/Fe3O4.cif"), - potcar_symbols=Potcar_names, + potcar_symbols=potcar_names, ) == ["Fe 3d 4p 4s ", "O 2p 2s "] potcar = Potcar.from_file(f"{TEST_FILES_DIR}/cohp/POTCAR.GaAs") - Potcar_names = [name["symbol"] for name in potcar.spec] + potcar_names = [name["symbol"] for name in potcar.spec] assert lobsterin1.get_basis( Structure.from_file(f"{TEST_FILES_DIR}/cohp/POSCAR.GaAs"), - potcar_symbols=Potcar_names, + potcar_symbols=potcar_names, ) == ["Ga 3d 4p 4s ", "As 4p 4s "] def test_get_all_possible_basis_functions(self): potcar = Potcar.from_file(f"{TEST_FILES_DIR}/POTCAR.Fe3O4") - Potcar_names = [name["symbol"] for name in potcar.spec] + potcar_names = [name["symbol"] for name in potcar.spec] result = Lobsterin.get_all_possible_basis_functions( Structure.from_file(f"{TEST_FILES_DIR}/Fe3O4.cif"), - potcar_symbols=Potcar_names, + potcar_symbols=potcar_names, ) assert result[0] == {"Fe": "3d 4s", "O": "2p 2s"} assert result[1] == {"Fe": "3d 4s 4p", "O": "2p 2s"} @@ -2023,9 +2023,9 @@ def is_kpoint_in_list(self, kpoint, kpointlist, weight, weightlist) -> bool: def test_msonable_implementation(self): # tests as dict and from dict methods - newLobsterin = Lobsterin.from_dict(self.Lobsterinfromfile.as_dict()) - assert newLobsterin == self.Lobsterinfromfile - newLobsterin.to_json() + new_lobsterin = Lobsterin.from_dict(self.Lobsterinfromfile.as_dict()) + assert new_lobsterin == self.Lobsterinfromfile + new_lobsterin.to_json() class TestBandoverlaps(unittest.TestCase): diff --git a/tests/io/qchem/test_sets.py b/tests/io/qchem/test_sets.py index a7de3c7d3d9..0b3a17b7985 100644 --- a/tests/io/qchem/test_sets.py +++ b/tests/io/qchem/test_sets.py @@ -23,13 +23,13 @@ __email__ = "samblau1@gmail.com" -test_dir = f"{TEST_FILES_DIR}/molecules" +TEST_DIR = f"{TEST_FILES_DIR}/molecules/new_qchem_files" class TestQChemDictSet(PymatgenTest): def test_init(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule - test_DictSet = QChemDictSet( + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule + test_dict_set = QChemDictSet( molecule=test_molecule, job_type="opt", basis_set="6-31G*", @@ -50,16 +50,16 @@ def test_init(self): "sym_ignore": "true", "resp_charges": "true", } - assert test_DictSet.rem == ref_dict - assert test_DictSet.pcm == {} - assert test_DictSet.solvent == {} - assert test_DictSet.smx == {} - assert test_DictSet.molecule == test_molecule + assert test_dict_set.rem == ref_dict + assert test_dict_set.pcm == {} + assert test_dict_set.solvent == {} + assert test_dict_set.smx == {} + assert test_dict_set.molecule == test_molecule def test_full_init(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule - test_DictSet = QChemDictSet( + test_dict_set = QChemDictSet( molecule=test_molecule, job_type="opt", basis_set="6-31g*", @@ -85,7 +85,7 @@ def test_full_init(self): "sym_ignore": "true", "resp_charges": "true", } - assert test_DictSet.rem == ref_dict + assert test_dict_set.rem == ref_dict ref_dict = { "heavypoints": "194", "hpoints": "194", @@ -93,11 +93,11 @@ def test_full_init(self): "theory": "cpcm", "vdwscale": "1.1", } - assert test_DictSet.pcm == ref_dict - assert test_DictSet.solvent == {"dielectric": "10.0"} - assert test_DictSet.molecule == test_molecule + assert test_dict_set.pcm == ref_dict + assert test_dict_set.solvent == {"dielectric": "10.0"} + assert test_dict_set.molecule == test_molecule - test_DictSet = QChemDictSet( + test_dict_set = QChemDictSet( molecule=test_molecule, job_type="opt", basis_set="6-31g*", @@ -124,11 +124,11 @@ def test_full_init(self): "sym_ignore": "true", "resp_charges": "true", } - assert test_DictSet.rem == ref_dict - assert test_DictSet.smx == {"solvent": "water"} + assert test_dict_set.rem == ref_dict + assert test_dict_set.smx == {"solvent": "water"} def test_overwrite_input(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule overwrite_inputs = { "rem": { "method": "b3lyp", @@ -157,7 +157,7 @@ def test_overwrite_input(self): assert act_rem == test_opt_set.rem def test_double_solvation(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule raised_error = False dict_set = None try: @@ -178,7 +178,7 @@ def test_double_solvation(self): assert dict_set is None def test_pcm_write(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule dict_set = QChemDictSet( molecule=test_molecule, job_type="opt", @@ -220,7 +220,7 @@ def test_pcm_write(self): def test_isosvp_write(self): """Also tests overwrite_inputs with a RHOISO value.""" - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule dict_set = QChemDictSet( molecule=test_molecule, job_type="opt", @@ -261,7 +261,7 @@ def test_isosvp_write(self): os.remove("mol.qin") def test_smd_write(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule dict_set = QChemDictSet( molecule=test_molecule, job_type="opt", @@ -297,7 +297,7 @@ def test_smd_write(self): def test_cmirs_write(self): """Also tests overwrite_inputs with a RHOISO value.""" - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule dict_set = QChemDictSet( molecule=test_molecule, job_type="opt", @@ -348,7 +348,7 @@ def test_cmirs_write(self): os.remove("mol.qin") def test_custom_smd_write(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule dict_set = QChemDictSet( molecule=test_molecule, job_type="opt", @@ -389,7 +389,7 @@ def test_custom_smd_write(self): def test_solvation_warnings(self): """Tests warnings / errors resulting from nonsensical overwrite_inputs.""" - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule with pytest.raises(RuntimeError, match="CMIRS is only parameterized"): QChemDictSet( molecule=test_molecule, @@ -449,8 +449,8 @@ def test_solvation_warnings(self): class TestSinglePointSet(PymatgenTest): def test_init(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule - test_SPSet = SinglePointSet(molecule=test_molecule) + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule + test_sp_set = SinglePointSet(molecule=test_molecule) ref_dict = { "job_type": "sp", "gen_scfman": "true", @@ -465,14 +465,14 @@ def test_init(self): "sym_ignore": "true", "resp_charges": "true", } - assert test_SPSet.rem == ref_dict - assert test_SPSet.pcm == {} - assert test_SPSet.solvent == {} - assert test_SPSet.molecule == test_molecule + assert test_sp_set.rem == ref_dict + assert test_sp_set.pcm == {} + assert test_sp_set.solvent == {} + assert test_sp_set.molecule == test_molecule def test_scf_extra_print(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule - test_SPSet = SinglePointSet(molecule=test_molecule, extra_scf_print=True) + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule + test_sp_set = SinglePointSet(molecule=test_molecule, extra_scf_print=True) ref_dict = { "job_type": "sp", "gen_scfman": "true", @@ -489,14 +489,14 @@ def test_scf_extra_print(self): "scf_convergence": "8", "scf_final_print": "3", } - assert test_SPSet.rem == ref_dict - assert test_SPSet.pcm == {} - assert test_SPSet.solvent == {} - assert test_SPSet.molecule == test_molecule + assert test_sp_set.rem == ref_dict + assert test_sp_set.pcm == {} + assert test_sp_set.solvent == {} + assert test_sp_set.molecule == test_molecule def test_pcm_init(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule - test_SPSet = SinglePointSet(molecule=test_molecule, pcm_dielectric=10.0) + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule + test_sp_set = SinglePointSet(molecule=test_molecule, pcm_dielectric=10.0) ref_dict = { "job_type": "sp", "gen_scfman": "true", @@ -512,7 +512,7 @@ def test_pcm_init(self): "sym_ignore": "true", "resp_charges": "true", } - assert test_SPSet.rem == ref_dict + assert test_sp_set.rem == ref_dict ref_dict = { "heavypoints": "194", "hpoints": "194", @@ -520,13 +520,13 @@ def test_pcm_init(self): "theory": "cpcm", "vdwscale": "1.1", } - assert test_SPSet.pcm == ref_dict - assert test_SPSet.solvent == {"dielectric": "10.0"} - assert test_SPSet.molecule == test_molecule + assert test_sp_set.pcm == ref_dict + assert test_sp_set.solvent == {"dielectric": "10.0"} + assert test_sp_set.molecule == test_molecule def test_isosvp_init(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule - test_SPSet = SinglePointSet(molecule=test_molecule, isosvp_dielectric=10.0) + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule + test_sp_set = SinglePointSet(molecule=test_molecule, isosvp_dielectric=10.0) ref_dict = { "job_type": "sp", "gen_scfman": "false", @@ -542,14 +542,14 @@ def test_isosvp_init(self): "sym_ignore": "true", "resp_charges": "true", } - assert test_SPSet.rem == ref_dict + assert test_sp_set.rem == ref_dict ref_dict = {"dielst": "10.0", "rhoiso": "0.001", "nptleb": "1202", "itrngr": "2", "irotgr": "2"} - assert test_SPSet.svp == ref_dict - assert test_SPSet.molecule == test_molecule + assert test_sp_set.svp == ref_dict + assert test_sp_set.molecule == test_molecule def test_smd_init(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule - test_SPSet = SinglePointSet(molecule=test_molecule, smd_solvent="water") + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule + test_sp_set = SinglePointSet(molecule=test_molecule, smd_solvent="water") ref_dict = { "job_type": "sp", "gen_scfman": "true", @@ -566,13 +566,13 @@ def test_smd_init(self): "sym_ignore": "true", "resp_charges": "true", } - assert test_SPSet.rem == ref_dict - assert test_SPSet.smx == {"solvent": "water"} - assert test_SPSet.molecule == test_molecule + assert test_sp_set.rem == ref_dict + assert test_sp_set.smx == {"solvent": "water"} + assert test_sp_set.molecule == test_molecule def test_cmirs_init(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule - test_SPSet = SinglePointSet( + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule + test_sp_set = SinglePointSet( molecule=test_molecule, cmirs_solvent="benzene", overwrite_inputs={"svp": {"RHOISO": 0.0005}} ) ref_dict = { @@ -590,7 +590,7 @@ def test_cmirs_init(self): "sym_ignore": "true", "resp_charges": "true", } - assert test_SPSet.rem == ref_dict + assert test_sp_set.rem == ref_dict ref_dict = { "dielst": "2.28", "rhoiso": "0.0005", @@ -600,7 +600,7 @@ def test_cmirs_init(self): "ipnrf": "1", "idefesr": "1", } - assert test_SPSet.svp == ref_dict + assert test_sp_set.svp == ref_dict ref_dict = { "a": "-0.00572", "b": "0.01116", @@ -611,12 +611,12 @@ def test_cmirs_init(self): "gaulag_n": "40", "delta": "7", } - assert test_SPSet.pcm_nonels == ref_dict - assert test_SPSet.molecule == test_molecule + assert test_sp_set.pcm_nonels == ref_dict + assert test_sp_set.molecule == test_molecule def test_plots_init(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule - test_SPSet = SinglePointSet(molecule=test_molecule, smd_solvent="water", plot_cubes=True) + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule + test_sp_set = SinglePointSet(molecule=test_molecule, smd_solvent="water", plot_cubes=True) ref_dict = { "job_type": "sp", "gen_scfman": "true", @@ -635,15 +635,15 @@ def test_plots_init(self): "plots": "true", "make_cube_files": "true", } - assert test_SPSet.rem == ref_dict - assert test_SPSet.plots == {"grid_spacing": "0.05", "total_density": "0"} - assert test_SPSet.smx == {"solvent": "water"} - assert test_SPSet.molecule == test_molecule + assert test_sp_set.rem == ref_dict + assert test_sp_set.plots == {"grid_spacing": "0.05", "total_density": "0"} + assert test_sp_set.smx == {"solvent": "water"} + assert test_sp_set.molecule == test_molecule class TestOptSet(PymatgenTest): def test_init(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule test_opt_set = OptSet(molecule=test_molecule) ref_dict = { "job_type": "opt", @@ -667,7 +667,7 @@ def test_init(self): assert test_opt_set.molecule == test_molecule def test_pcm_init(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule test_opt_set = OptSet(molecule=test_molecule, pcm_dielectric=10.0) ref_dict = { "job_type": "opt", @@ -698,7 +698,7 @@ def test_pcm_init(self): assert test_opt_set.molecule == test_molecule def test_smd_init(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule test_opt_set = OptSet(molecule=test_molecule, smd_solvent="water") ref_dict = { "job_type": "opt", @@ -722,14 +722,14 @@ def test_smd_init(self): assert test_opt_set.molecule == test_molecule def test_overwrite_opt_input(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule overwrite_inputs = {"opt": {"FIXED": ["1 XYZ", "2 XY"]}} test_opt_set = OptSet(molecule=test_molecule, overwrite_inputs=overwrite_inputs) act_opt = {"fixed": ["1 XYZ", "2 XY"]} assert act_opt == test_opt_set.opt def test_nbo_init(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule test_opt_set = OptSet(molecule=test_molecule, nbo_params={}) ref_dict = { "job_type": "opt", @@ -752,7 +752,7 @@ def test_nbo_init(self): assert test_opt_set.molecule == test_molecule def test_v5_vs_v6(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule v5_opt_set = OptSet(molecule=test_molecule, qchem_version=5, basis_set="def2-tzvpd", geom_opt={}) ref_dict = { "job_type": "opt", @@ -818,7 +818,7 @@ def test_v5_vs_v6(self): class TestTransitionStateSet(PymatgenTest): def test_init(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule test_ts_set = TransitionStateSet(molecule=test_molecule) ref_dict = { "job_type": "ts", @@ -842,7 +842,7 @@ def test_init(self): assert test_ts_set.molecule == test_molecule def test_pcm_init(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule test_ts_set = TransitionStateSet(molecule=test_molecule, pcm_dielectric=10.0) ref_dict = { "job_type": "ts", @@ -867,7 +867,7 @@ def test_pcm_init(self): assert test_ts_set.molecule == test_molecule def test_smd_init(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule test_ts_set = TransitionStateSet(molecule=test_molecule, smd_solvent="water") ref_dict = { "job_type": "ts", @@ -893,7 +893,7 @@ def test_smd_init(self): class TestForceSet(PymatgenTest): def test_init(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule test_forceset = ForceSet(molecule=test_molecule) ref_dict = { "job_type": "force", @@ -915,7 +915,7 @@ def test_init(self): assert test_forceset.molecule == test_molecule def test_pcm_init(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule test_forceset = ForceSet(molecule=test_molecule, pcm_dielectric=10.0) ref_dict = { "job_type": "force", @@ -939,7 +939,7 @@ def test_pcm_init(self): assert test_forceset.molecule == test_molecule def test_smd_init(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule test_forceset = ForceSet(molecule=test_molecule, smd_solvent="water") ref_dict = { "job_type": "force", @@ -964,7 +964,7 @@ def test_smd_init(self): class TestPESScanSet(PymatgenTest): def test_init(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pes_scan.qin").molecule + test_molecule = QCInput.from_file(f"{TEST_DIR}/pes_scan.qin").molecule test_pes_scan = PESScanSet(molecule=test_molecule, scan_variables={"stre": ["3 6 1.5 1.9 0.01"]}) ref_dict = { @@ -990,7 +990,7 @@ def test_init(self): assert test_pes_scan.molecule == test_molecule def test_pcm_init(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pes_scan.qin").molecule + test_molecule = QCInput.from_file(f"{TEST_DIR}/pes_scan.qin").molecule test_pes_scan = PESScanSet( molecule=test_molecule, pcm_dielectric=10.0, scan_variables={"stre": ["3 6 1.5 1.9 0.01"]} ) @@ -1018,7 +1018,7 @@ def test_pcm_init(self): assert test_pes_scan.molecule == test_molecule def test_smd_init(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pes_scan.qin").molecule + test_molecule = QCInput.from_file(f"{TEST_DIR}/pes_scan.qin").molecule test_pes_scan = PESScanSet( molecule=test_molecule, smd_solvent="water", scan_variables={"stre": ["3 6 1.5 1.9 0.01"]} ) @@ -1047,8 +1047,8 @@ def test_smd_init(self): class TestFreqSet(PymatgenTest): def test_init(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule - test_FreqSet = FreqSet(molecule=test_molecule) + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule + test_freq_set = FreqSet(molecule=test_molecule) ref_dict = { "job_type": "freq", "gen_scfman": "true", @@ -1063,14 +1063,14 @@ def test_init(self): "sym_ignore": "true", "resp_charges": "true", } - assert test_FreqSet.rem == ref_dict - assert test_FreqSet.pcm == {} - assert test_FreqSet.solvent == {} - assert test_FreqSet.molecule == test_molecule + assert test_freq_set.rem == ref_dict + assert test_freq_set.pcm == {} + assert test_freq_set.solvent == {} + assert test_freq_set.molecule == test_molecule def test_pcm_init(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule - test_FreqSet = FreqSet(molecule=test_molecule, pcm_dielectric=10.0) + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule + test_freq_set = FreqSet(molecule=test_molecule, pcm_dielectric=10.0) ref_dict = { "job_type": "freq", "gen_scfman": "true", @@ -1086,7 +1086,7 @@ def test_pcm_init(self): "sym_ignore": "true", "resp_charges": "true", } - assert test_FreqSet.rem == ref_dict + assert test_freq_set.rem == ref_dict ref_dict = { "heavypoints": "194", "hpoints": "194", @@ -1094,13 +1094,13 @@ def test_pcm_init(self): "theory": "cpcm", "vdwscale": "1.1", } - assert test_FreqSet.pcm == ref_dict - assert test_FreqSet.solvent == {"dielectric": "10.0"} - assert test_FreqSet.molecule == test_molecule + assert test_freq_set.pcm == ref_dict + assert test_freq_set.solvent == {"dielectric": "10.0"} + assert test_freq_set.molecule == test_molecule def test_smd_init(self): - test_molecule = QCInput.from_file(f"{test_dir}/new_qchem_files/pcm.qin").molecule - test_FreqSet = FreqSet(molecule=test_molecule, smd_solvent="water") + test_molecule = QCInput.from_file(f"{TEST_DIR}/pcm.qin").molecule + test_freq_set = FreqSet(molecule=test_molecule, smd_solvent="water") ref_dict = { "job_type": "freq", "gen_scfman": "true", @@ -1117,6 +1117,6 @@ def test_smd_init(self): "sym_ignore": "true", "resp_charges": "true", } - assert test_FreqSet.rem == ref_dict - assert test_FreqSet.smx == {"solvent": "water"} - assert test_FreqSet.molecule == test_molecule + assert test_freq_set.rem == ref_dict + assert test_freq_set.smx == {"solvent": "water"} + assert test_freq_set.molecule == test_molecule diff --git a/tests/io/qchem/test_utils.py b/tests/io/qchem/test_utils.py index 8faeeeb81a3..49de884988f 100644 --- a/tests/io/qchem/test_utils.py +++ b/tests/io/qchem/test_utils.py @@ -40,11 +40,11 @@ def test_process_parsed_hess(self): data_132 = [struct.unpack("d", binary[ii * 8 : (ii + 1) * 8])[0] for ii in range(int(len(binary) / 8))] with zopen(f"{test_dir}/parse_hess/HESS", mode="rt", encoding="ISO-8859-1") as f: - data_HESS = f.readlines() + data_hess = f.readlines() - processed_data_HESS = process_parsed_hess(data_HESS) + processed_data_hess = process_parsed_hess(data_hess) - assert len(data_132) == len(processed_data_HESS) + assert len(data_132) == len(processed_data_hess) for ii, val in enumerate(data_132): - diff = abs(val - processed_data_HESS[ii]) + diff = abs(val - processed_data_hess[ii]) assert diff < 1e-15