Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasturcani committed Jul 4, 2024
1 parent 1a4e9e0 commit e41e91e
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 33 deletions.
5 changes: 1 addition & 4 deletions src/stko/_internal/calculators/extractors/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,4 @@ def check_line(line: str, option: str, options_dict: dict[str, str]) -> bool:
Returns ``True`` if the desired string is present.
"""
if options_dict[option] in line:
return True

return False
return options_dict[option] in line
2 changes: 1 addition & 1 deletion src/stko/_internal/calculators/orca_calculators.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def _run_orca( # noqa: PLR0913
with out_file.open("w") as f:
# Note that sp.call will hold the program until
# completion of the calculation.
sp.call(
sp.call( # noqa: S602
cmd,
stdin=sp.PIPE,
stdout=f,
Expand Down
2 changes: 1 addition & 1 deletion src/stko/_internal/calculators/xtb_calculators.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def _run_xtb(
with out_file.open("w") as f:
# Note that sp.call will hold the program until
# completion of the calculation.
sp.call(
sp.call( # noqa: S602
cmd,
stdin=sp.PIPE,
stdout=f,
Expand Down
18 changes: 11 additions & 7 deletions src/stko/_internal/optimizers/gulp.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import shutil
import subprocess as sp
import uuid
import warnings
from pathlib import Path

import stk
Expand Down Expand Up @@ -547,12 +548,15 @@ def assign_FF(self, mol: stk.Molecule) -> None: # noqa: N802
The molecule to be optimized.
"""
FutureWarning(
"We have found some minor discrepancies in this "
"assignment algorithm, which is based off rdkit code. "
"Changes should come soon. This UFF optimisation should "
" not be your final step! Due to this, some tests in "
"test_uff_assign_ff.py have been muted."
warnings.warn(
FutureWarning(
"We have found some minor discrepancies in this "
"assignment algorithm, which is based off rdkit code. "
"Changes should come soon. This UFF optimisation should "
" not be your final step! Due to this, some tests in "
"test_uff_assign_ff.py have been muted."
),
stacklevel=2,
)

metal_atoms = get_metal_atoms(mol)
Expand Down Expand Up @@ -595,7 +599,7 @@ def _run_gulp(self, in_file: Path, out_file: Path) -> None:
with out_file.open("w") as f:
# Note that sp.call will hold the program until completion
# of the calculation.
sp.call(
sp.call( # noqa: S602
cmd,
stdin=sp.PIPE,
stdout=f,
Expand Down
13 changes: 5 additions & 8 deletions src/stko/_internal/optimizers/macromodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def _run_bmin(self, mol: stk.Molecule, run_name: str) -> None:

incomplete = True
while incomplete:
process = sp.Popen(
process = sp.Popen( # noqa: S603
opt_cmd,
stdout=sp.PIPE,
stderr=sp.STDOUT,
Expand Down Expand Up @@ -227,7 +227,7 @@ def _kill_bmin(self, run_name: str) -> None:

incomplete = True
while incomplete:
out = sp.run(
out = sp.run( # noqa: S603
cmd,
stdout=sp.PIPE,
stderr=sp.STDOUT,
Expand All @@ -248,7 +248,7 @@ def _kill_bmin(self, run_name: str) -> None:
output = name
start = time.time()
while name in output:
output = sp.run(
output = sp.run( # noqa: S603
cmd,
stdout=sp.PIPE,
stderr=sp.STDOUT,
Expand Down Expand Up @@ -303,10 +303,7 @@ def _license_found(
with Path(f"{run_name}.log").open() as f:
log_file = f.read()

if "Could not check out a license for mmlibs" in log_file:
return False

return True
return "Could not check out a license for mmlibs" not in log_file

@staticmethod
def _get_com_line( # noqa: PLR0913
Expand Down Expand Up @@ -344,7 +341,7 @@ def _run_structconvert(self, input_path: Path, output_path: Path) -> None:
while incomplete:
# Execute the file conversion.
try:
convrt_return = sp.run(
convrt_return = sp.run( # noqa: S603
convrt_cmd,
stdout=sp.PIPE,
stderr=sp.STDOUT,
Expand Down
10 changes: 2 additions & 8 deletions src/stko/_internal/optimizers/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,7 @@ def has_h_atom(bond: stk.Bond) -> bool:
"""
if bond.get_atom1().get_atomic_number() == 1:
return True
if bond.get_atom2().get_atomic_number() == 1:
return True

return False
return bond.get_atom2().get_atomic_number() == 1


def has_metal_atom(bond: stk.Bond, metal_atoms: list[stk.Atom]) -> bool:
Expand All @@ -328,10 +325,7 @@ def has_metal_atom(bond: stk.Bond, metal_atoms: list[stk.Atom]) -> bool:
"""
if bond.get_atom1() in metal_atoms:
return True
if bond.get_atom2() in metal_atoms:
return True

return False
return bond.get_atom2() in metal_atoms


def metal_atomic_numbers() -> abc.Iterable:
Expand Down
8 changes: 4 additions & 4 deletions src/stko/_internal/optimizers/xtb.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def _run_xtb(self, xyz: str, out_file: Path | str) -> None:
with out_file.open("w") as f:
# Note that sp.call will hold the program until completion
# of the calculation.
sp.call(
sp.call( # noqa: S602
cmd,
stdin=sp.PIPE,
stdout=f,
Expand Down Expand Up @@ -804,7 +804,7 @@ def _run_crest(self, xyz: str, out_file: Path | str) -> None:
with out_file.open("w") as f:
# Note that sp.call will hold the program until completion
# of the calculation.
sp.call(
sp.call( # noqa: S602
cmd,
stdin=sp.PIPE,
stdout=f,
Expand Down Expand Up @@ -1050,7 +1050,7 @@ def _run_xtb(self, xyz: str, out_file: Path | str) -> None:
with out_file.open("w") as f:
# Note that sp.call will hold the program until completion
# of the calculation.
sp.call(
sp.call( # noqa: S602
cmd,
stdin=sp.PIPE,
stdout=f,
Expand Down Expand Up @@ -1392,7 +1392,7 @@ def _run_crest(self, xyz: Path, out_file: Path) -> None:
with out_file.open("w") as f:
# Note that sp.call will hold the program until completion
# of the calculation.
sp.call(
sp.call( # noqa: S602
cmd,
stdin=sp.PIPE,
stdout=f,
Expand Down

0 comments on commit e41e91e

Please sign in to comment.