Skip to content

Commit 057ffc4

Browse files
committed
Fix lint errors in orca, tobacco, and remove_solvent modules
Fix unused variable (F841) in orca.py and line-too-long (E501) in create_linker_from_smiles.py and remove_solvent.py.
1 parent b3c7e53 commit 057ffc4

3 files changed

Lines changed: 20 additions & 7 deletions

File tree

src/matkit/orca/orca.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ def run_orca(
77
run_type: str,
88
):
99
profile = OrcaProfile(command=orca_command)
10-
calc = ORCA(profile=profile)
10+
_calc = ORCA(profile=profile)

src/matkit/tobacco/create_linker_from_smiles.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ def update_cif_with_connection_site(
150150
151151
Args:
152152
input_cif: Path to input CIF file
153-
connection_sites: List of atom labels to be converted to connection sites
153+
connection_sites: List of atom labels to be
154+
converted to connection sites
154155
output_cif: Path to output CIF file
155156
"""
156157
# Read and clean input file
@@ -193,7 +194,8 @@ def update_cif_with_connection_site(
193194

194195

195196
def update_aromatic_bond(cif_in, cif_out):
196-
"""Update CIF file by converting single bonds in aromatic rings to aromatic bonds."""
197+
"""Update CIF: convert single bonds in aromatic rings
198+
to aromatic bonds."""
197199
with open(cif_in, encoding="utf-8") as f:
198200
data = [line.strip() for line in f if line.strip()]
199201

@@ -257,11 +259,20 @@ def smiles_to_cif(smiles, output_prefix="L1"):
257259
for i, atom in enumerate(struct):
258260
label = f"{atom.symbol}{i + 1}"
259261
x, y, z = np.round(scaled_pos[i], 5)
260-
pos_block += f"{label:<10}{atom.symbol:<6}{x:<10}{y:<10}{z:<10}0.00000 Uiso 1.00 0.00000\n"
262+
pos_block += (
263+
f"{label:<10}{atom.symbol:<6}"
264+
f"{x:<10}{y:<10}{z:<10}"
265+
f"0.00000 Uiso 1.00 0.00000\n"
266+
)
261267
indices, _ = nl.get_neighbors(i)
262268
for j in indices:
263269
d = struct.get_distance(i, j, mic=True)
264-
bond_block += f"{label:<6}{struct[j].symbol}{j + 1:<6}{round(d, 4):<8}. S\n"
270+
jlabel = f"{struct[j].symbol}{j + 1}"
271+
dist = round(d, 4)
272+
bond_block += (
273+
f"{label:<6}{jlabel:<6}"
274+
f"{dist:<8}. S\n"
275+
)
265276

266277
with open(final_cif, "w", encoding="utf-8") as f:
267278
f.write(

src/matkit/utils/remove_solvent.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88

99
def remove_solvent(path_to_cif, output_path, mass_ratio=0.8, skin=0.3):
10-
""" Remove solvent, ions from a MOF using either chemical formula or ASE neighborlist
10+
"""Remove solvent, ions from a MOF using ASE
11+
neighborlist
1112
1213
Parameters:
1314
cif: str, absolute path to cif file
@@ -39,7 +40,8 @@ def remove_solvent(path_to_cif, output_path, mass_ratio=0.8, skin=0.3):
3940
g = list(g)
4041
fragment = atoms[g]
4142
fragment = sort(fragment)
42-
massG.append(sum(atoms[g].get_masses())) # Mass of each disconnected subgraph
43+
# Mass of each disconnected subgraph
44+
massG.append(sum(atoms[g].get_masses()))
4345

4446
max_index = np.argmax(massG)
4547
for index, mass in enumerate(massG):

0 commit comments

Comments
 (0)