chore: switches from black and isort to ruff

This commit is contained in:
2026-02-26 17:40:26 -03:00
parent d89124b1e8
commit 5d76e49f89
20 changed files with 286 additions and 77 deletions

View File

@@ -1 +1,4 @@
from .__interface import Interface
__all__ = ["Interface"]

View File

@@ -17,6 +17,7 @@ import time
from multiprocessing import Process, connection
from pathlib import Path
DICE_END_FLAG: Final[str] = "End of simulation"
DICE_FLAG_LINE: Final[int] = -2
UMAANG3_TO_GCM3: Final[float] = 1.6605
@@ -206,10 +207,10 @@ class DiceInterface(Interface):
f.write(f"temp = {self.step.dice.temp}\n")
if self.step.dice.randominit == "first" and cycle > 1:
f.write(f"init = yesreadxyz\n")
f.write("init = yesreadxyz\n")
f.write(f"nstep = {self.step.altsteps}\n")
else:
f.write(f"init = yes\n")
f.write("init = yes\n")
f.write(f"nstep = {self.step.dice.nstep[0]}\n")
f.write("vstep = 0\n")
@@ -301,7 +302,7 @@ class DiceInterface(Interface):
f.write(f"press = {self.step.dice.press}\n")
f.write(f"temp = {self.step.dice.temp}\n")
f.write(f"nstep = 5\n")
f.write("nstep = 5\n")
f.write(f"vstep = {int(self.step.dice.nstep[2] / 5)}\n")
f.write("init = no\n")

View File

@@ -60,13 +60,13 @@ class GaussianInterface(Interface):
def _copy_chk_file_from_previous_step(self, cycle: int):
current_chk_file_path = Path(
self.step.simulation_dir, f"step{cycle:02d}", "qm", f"asec.chk"
self.step.simulation_dir, f"step{cycle:02d}", "qm", "asec.chk"
)
if current_chk_file_path.exists():
raise FileExistsError(f"File {current_chk_file_path} already exists.")
previous_chk_file_path = Path(
self.step.simulation_dir, f"step{(cycle - 1):02d}", "qm", f"asec.chk"
self.step.simulation_dir, f"step{(cycle - 1):02d}", "qm", "asec.chk"
)
if not previous_chk_file_path.exists():
raise FileNotFoundError(f"File {previous_chk_file_path} does not exist.")
@@ -139,7 +139,7 @@ class GaussianInterface(Interface):
charges_nsites = int(charges.pop(0))
if int(charges_nsites) != total_nsites:
raise ValueError(
f"Number of sites does not match total number of sites."
"Number of sites does not match total number of sites."
)
thickness.append(self._calculate_proc_thickness(charges))
@@ -166,7 +166,7 @@ class GaussianInterface(Interface):
].strip()
):
raise SyntaxError(
f"Error: Invalid Dice Output. Atom type does not match."
"Error: Invalid Dice Output. Atom type does not match."
)
new_molecule.add_atom(
@@ -216,7 +216,7 @@ class GaussianInterface(Interface):
def _make_gaussian_input_file(self, cycle: int, asec_charges: list[dict]) -> None:
gaussian_input_file_path = Path(
self.step.simulation_dir, f"step{cycle:02d}", "qm", f"asec.gjf"
self.step.simulation_dir, f"step{cycle:02d}", "qm", "asec.gjf"
)
with open(gaussian_input_file_path, "w") as gaussian_input_file: