Skip to content

Commit 9457d30

Browse files
committed
removed unused variables and cleaned up imports
1 parent a56bc74 commit 9457d30

13 files changed

+12
-103
lines changed

test/test_wavecar.py

-75
This file was deleted.

vsh/scripts/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import argparse
2-
from typing import Union
32

43

54
def is_number(s):

vsh/scripts/analysis.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from ase.calculators.vasp import Vasp
44
from ase.spacegroup import get_spacegroup
55
from ase import Atoms
6-
from ase.io import read, write
6+
from ase.io import read
77
from scipy.spatial.distance import cdist
88
import numpy as np
99

@@ -18,7 +18,7 @@ def validate_atoms(atoms: Atoms) -> bool:
1818

1919
def is_diatomic(atoms: Atoms) -> bool:
2020
"""Checks if an atoms object is diatomic"""
21-
if validate_atoms(atoms) == False:
21+
if validate_atoms(atoms) is False:
2222
raise ValueError("Invalid atoms object")
2323
if len(atoms) == 2:
2424
return True
@@ -28,7 +28,7 @@ def is_diatomic(atoms: Atoms) -> bool:
2828

2929
def get_adjacency_matrix(atoms: Atoms) -> np.ndarray:
3030
"""Gets the adjacency matrix of a structure"""
31-
if validate_atoms(atoms) == False:
31+
if validate_atoms(atoms) is False:
3232
raise ValueError("Invalid atoms object")
3333
# get the positions of the atoms object
3434
positions = atoms.get_positions()
@@ -93,7 +93,7 @@ def conflicting_atoms(atoms: Atoms, min_dist: float) -> dict:
9393
indices, bond_lengths = analyze_adjacency_matrix(neighbor_list, min_dist)
9494
element_list: tuple[np.ndarray] = atoms.get_chemical_symbols()
9595

96-
if indices == None or len(indices) == 0:
96+
if indices is None or len(indices) == 0:
9797
return None
9898

9999
print(indices)
@@ -107,7 +107,7 @@ def conflicting_atoms(atoms: Atoms, min_dist: float) -> dict:
107107

108108
def print_conflicts(conflicts: dict):
109109
"""Prints the conflicting atoms"""
110-
if conflicts == None:
110+
if conflicts is None:
111111
print("No conflicting atoms")
112112
else:
113113
print("Atom pair Bond length")
@@ -119,7 +119,6 @@ def print_conflicts(conflicts: dict):
119119

120120
def check_convergence(file: str = "./vasprun.xml") -> list[bool]:
121121
"""Looks for vasprun.xml file and checks if converged"""
122-
import os
123122

124123
# import Vasprun from pymatgen
125124
from pymatgen.io.vasp.outputs import Vasprun
@@ -211,7 +210,6 @@ def get_converged(args):
211210

212211
def get_equivalent_positions(pmg_structure):
213212
"""Get the equivalent positions of a structure"""
214-
from pymatgen.core.structure import Structure
215213
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
216214

217215
spacegroup = SpacegroupAnalyzer(pmg_structure)

vsh/scripts/band.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22

3-
from ase.io import read, write
3+
from ase.io import read
44
import pyprocar
55

66
orbital_dict = {
@@ -110,7 +110,6 @@ def plot_procar(args):
110110

111111
def filter_procar(args):
112112
"""Filters procar file based on user input"""
113-
from pymatgen.io.vasp.outputs import Procar
114113

115114
pyprocar.filter(args.input, args.output, bands=[584, 652])
116115

vsh/scripts/cohp.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import matplotlib.pyplot as plt
55
import pandas as pd
66
import networkx as nx
7-
from mpl_toolkits import axes_grid1
87

98

109
plt.style.use("seaborn-v0_8-colorblind")
@@ -154,7 +153,7 @@ def plot_icohp_graph(args):
154153
edges = G.edges()
155154
weights = [G[u][v]["ICOHP"] for u, v in edges]
156155
nx.draw(G, pos, edge_color=weights, width=2, edge_cmap=plt.cm.plasma)
157-
pathcollection = nx.draw_networkx_nodes(
156+
nx.draw_networkx_nodes(
158157
G, pos, node_size=600, node_color="black"
159158
)
160159
nx.draw_networkx_labels(

vsh/scripts/kpoints.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from ase.io import read, write
1+
from ase.io import read
22
import numpy as np
33

44
two_d_kpath_template = """Two dimensional Kpath

vsh/scripts/manage.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44
from PIL import Image
55
import os
66

7+
from pymatgen.io.vasp import Poscar, Incar, Kpoints
78

89
def validate_input(args):
910
"""Validates that INCAR, POSCAR, KPOINTS, and POTCAR files are present and formatted correctly"""
10-
from pymatgen.io.vasp import Incar, Poscar, Kpoints, Potcar
11-
import os
12-
1311
# check that each file exists
1412
directory = args.input
1513
incar_file = os.path.join(directory, "INCAR")
@@ -173,7 +171,6 @@ def write_data_pickle(args):
173171

174172
def unpack_pickle(args):
175173
"""Unpacks POSCAR, INCAR, CONTCAR, and KPOINTS from a pickle file"""
176-
from pymatgen.io.vasp import Poscar, Incar, Kpoints
177174
import pandas as pd
178175

179176
try:
@@ -228,7 +225,7 @@ def unpack_pickle(args):
228225

229226
def reconstitute_vasprun(file: str):
230227
"""Unpacks POSCAR, INCAR, CONTCAR, and KPOINTS from a vasprun.xml file"""
231-
from pymatgen.io.vasp import Vasprun, Poscar, Incar, Kpoints
228+
from pymatgen.io.vasp import Vasprun
232229

233230
# Load the vasprun file
234231
vasprun = Vasprun(
@@ -249,7 +246,6 @@ def reconstitute_vasprun(file: str):
249246

250247
def unpack_vasprun(args):
251248
"""Unpacks POSCAR, INCAR, CONTCAR, and KPOINTS from a vasprun.xml file"""
252-
from pymatgen.io.vasp import Poscar, Incar, Kpoints
253249

254250
poscar, incar, kpoints, contcar = reconstitute_vasprun(args.input)
255251

vsh/scripts/potcar.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from ase.io import read, write
1+
from ase.io import read
22
from pymatgen.io.vasp.inputs import Poscar, Potcar
33

44

vsh/scripts/procar.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ def plot_kpoint_orbital_variation(args):
335335
x=kpoints,
336336
y=sum_values,
337337
mode="lines",
338-
name=f"Charge Spilling",
338+
name="Charge Spilling",
339339
line=dict(color="grey", dash="dash", width=1),
340340
)
341341
)
@@ -458,7 +458,6 @@ def plot_compositional_variation(args):
458458

459459
def analyze_kpoint(args):
460460
"""Summarizes the data for a specific kpoint"""
461-
dataframe = load_dataframe_from_file(args.input)
462461
kpoint = args.kpoint
463462
band = args.band
464463

vsh/utils/fermi_surface.py

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from pymatgen.io.vasp.outputs import Vasprun
44
import pickle
55
import matplotlib.pyplot as plt
6-
from mpl_toolkits.mplot3d import Axes3D
76

87

98
def projected_eigenvalues_from_pickle(file: str) -> pd.DataFrame:

vsh/utils/procar_tools.py

-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from vsh.scripts.procar import load_dataframe_from_file, add_kpoint_labels
22
from pymatgen.io.vasp import Vasprun
3-
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
4-
from pymatgen.core.structure import Structure
53

64

75
# get ions from vasprun
@@ -58,7 +56,6 @@ def plot_compositional_variation(file: str, band: int, labels: list[str] = None)
5856

5957
def get_equivalent_positions(pmg_structure):
6058
"""Get the equivalent positions of a structure"""
61-
from pymatgen.core.structure import Structure
6259
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
6360

6461
spacegroup = SpacegroupAnalyzer(pmg_structure)

vsh/utils/stm_tools.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import numpy as np
22
from matplotlib import pyplot as plt
3-
import matplotlib.font_manager as fm
43

54

65
def get_plot_stm_from_dat(file: str, gridsize: int = 300) -> plt:

vsh/utils/structure_tools.py

-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ def plot_atomic_drift(initial_file: str, final_file: str, output_file: str = Non
147147
"""Plots the atomic drift between two structures"""
148148
import sisl
149149
import sisl.viz
150-
import numpy as np
151150

152151
intial_atoms = read(initial_file)
153152
final_atoms = read(final_file)

0 commit comments

Comments
 (0)