From 9551db207ce444119b35b5881e71e26c38527d74 Mon Sep 17 00:00:00 2001 From: "Haoyu (Daniel)" Date: Wed, 12 Jun 2024 21:38:33 +0800 Subject: [PATCH] Need Confirm: set `translation` as tuple --- pymatgen/io/lobster/outputs.py | 8 ------ tests/io/lobster/test_inputs.py | 48 ++++++++++++++++----------------- 2 files changed, 24 insertions(+), 32 deletions(-) diff --git a/pymatgen/io/lobster/outputs.py b/pymatgen/io/lobster/outputs.py index e27a040b9e1..cc93d889328 100644 --- a/pymatgen/io/lobster/outputs.py +++ b/pymatgen/io/lobster/outputs.py @@ -429,14 +429,6 @@ def __init__( labels, atoms1, atoms2, lens, translations, nums, icohps = [], [], [], [], [], [], [] - # Initialize static variables - label = "" - atom1 = "" - atom2 = "" - length = None - num = None - translation: Vector3D | None = None - for bond in range(n_bonds): line_parts = data_without_orbitals[bond].split() diff --git a/tests/io/lobster/test_inputs.py b/tests/io/lobster/test_inputs.py index 574676952d6..ee29a8ba0d4 100644 --- a/tests/io/lobster/test_inputs.py +++ b/tests/io/lobster/test_inputs.py @@ -444,77 +444,77 @@ def test_values(self): "length": 2.88231, "number_of_bonds": 3, "icohp": {Spin.up: -2.18042}, - "translation": [0, 0, 0], + "translation": (0, 0, 0), "orbitals": None, }, "2": { "length": 3.10144, "number_of_bonds": 3, "icohp": {Spin.up: -1.14347}, - "translation": [0, 0, 0], + "translation": (0, 0, 0), "orbitals": None, }, "3": { "length": 2.88231, "number_of_bonds": 3, "icohp": {Spin.up: -2.18042}, - "translation": [0, 0, 0], + "translation": (0, 0, 0), "orbitals": None, }, "4": { "length": 3.10144, "number_of_bonds": 3, "icohp": {Spin.up: -1.14348}, - "translation": [0, 0, 0], + "translation": (0, 0, 0), "orbitals": None, }, "5": { "length": 3.05001, "number_of_bonds": 3, "icohp": {Spin.up: -1.30006}, - "translation": [0, 0, 0], + "translation": (0, 0, 0), "orbitals": None, }, "6": { "length": 2.91676, "number_of_bonds": 3, "icohp": {Spin.up: -1.96843}, - "translation": [0, 0, 0], + "translation": (0, 0, 0), "orbitals": None, }, "7": { "length": 3.05001, "number_of_bonds": 3, "icohp": {Spin.up: -1.30006}, - "translation": [0, 0, 0], + "translation": (0, 0, 0), "orbitals": None, }, "8": { "length": 2.91676, "number_of_bonds": 3, "icohp": {Spin.up: -1.96843}, - "translation": [0, 0, 0], + "translation": (0, 0, 0), "orbitals": None, }, "9": { "length": 3.37522, "number_of_bonds": 3, "icohp": {Spin.up: -0.47531}, - "translation": [0, 0, 0], + "translation": (0, 0, 0), "orbitals": None, }, "10": { "length": 3.07294, "number_of_bonds": 3, "icohp": {Spin.up: -2.38796}, - "translation": [0, 0, 0], + "translation": (0, 0, 0), "orbitals": None, }, "11": { "length": 3.37522, "number_of_bonds": 3, "icohp": {Spin.up: -0.47531}, - "translation": [0, 0, 0], + "translation": (0, 0, 0), "orbitals": None, }, } @@ -523,77 +523,77 @@ def test_values(self): "length": 2.88231, "number_of_bonds": 3, "icohp": {Spin.up: 0.14245}, - "translation": [0, 0, 0], + "translation": (0, 0, 0), "orbitals": None, }, "2": { "length": 3.10144, "number_of_bonds": 3, "icohp": {Spin.up: -0.04118}, - "translation": [0, 0, 0], + "translation": (0, 0, 0), "orbitals": None, }, "3": { "length": 2.88231, "number_of_bonds": 3, "icohp": {Spin.up: 0.14245}, - "translation": [0, 0, 0], + "translation": (0, 0, 0), "orbitals": None, }, "4": { "length": 3.10144, "number_of_bonds": 3, "icohp": {Spin.up: -0.04118}, - "translation": [0, 0, 0], + "translation": (0, 0, 0), "orbitals": None, }, "5": { "length": 3.05001, "number_of_bonds": 3, "icohp": {Spin.up: -0.03516}, - "translation": [0, 0, 0], + "translation": (0, 0, 0), "orbitals": None, }, "6": { "length": 2.91676, "number_of_bonds": 3, "icohp": {Spin.up: 0.10745}, - "translation": [0, 0, 0], + "translation": (0, 0, 0), "orbitals": None, }, "7": { "length": 3.05001, "number_of_bonds": 3, "icohp": {Spin.up: -0.03516}, - "translation": [0, 0, 0], + "translation": (0, 0, 0), "orbitals": None, }, "8": { "length": 2.91676, "number_of_bonds": 3, "icohp": {Spin.up: 0.10745}, - "translation": [0, 0, 0], + "translation": (0, 0, 0), "orbitals": None, }, "9": { "length": 3.37522, "number_of_bonds": 3, "icohp": {Spin.up: -0.12395}, - "translation": [0, 0, 0], + "translation": (0, 0, 0), "orbitals": None, }, "10": { "length": 3.07294, "number_of_bonds": 3, "icohp": {Spin.up: 0.24714}, - "translation": [0, 0, 0], + "translation": (0, 0, 0), "orbitals": None, }, "11": { "length": 3.37522, "number_of_bonds": 3, "icohp": {Spin.up: -0.12395}, - "translation": [0, 0, 0], + "translation": (0, 0, 0), "orbitals": None, }, } @@ -602,14 +602,14 @@ def test_values(self): "length": 2.83189, "number_of_bonds": 2, "icohp": {Spin.up: -0.10218, Spin.down: -0.19701}, - "translation": [0, 0, 0], + "translation": (0, 0, 0), "orbitals": None, }, "2": { "length": 2.45249, "number_of_bonds": 1, "icohp": {Spin.up: -0.28485, Spin.down: -0.58279}, - "translation": [0, 0, 0], + "translation": (0, 0, 0), "orbitals": None, }, }