From 73b06f691cd26971495269446f08f60b222be61d Mon Sep 17 00:00:00 2001 From: JaGeo Date: Wed, 3 Jul 2024 15:17:35 +0200 Subject: [PATCH] reformatting --- jobflow.ipynb | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/jobflow.ipynb b/jobflow.ipynb index 3e7f9eb..8a5ce20 100644 --- a/jobflow.ipynb +++ b/jobflow.ipynb @@ -64,7 +64,7 @@ "\n", "\n", "@job\n", - "def my_function(my_parameter: int)->int:\n", + "def my_function(my_parameter: int) -> int:\n", " return my_parameter\n", "\n", "\n", @@ -91,12 +91,12 @@ "\n", "\n", "@job\n", - "def my_function(my_parameter: int)->int:\n", + "def my_function(my_parameter: int) -> int:\n", " return my_parameter\n", "\n", "\n", "@job\n", - "def my_second_function(my_parameter: int)->int:\n", + "def my_second_function(my_parameter: int) -> int:\n", " return my_parameter\n", "\n", "\n", @@ -182,7 +182,7 @@ " scaling: float = 1.1\n", "\n", " @job\n", - " def make(self, my_parameter: int)->float:\n", + " def make(self, my_parameter: int) -> float:\n", " return my_parameter * self.scaling\n", "\n", "\n", @@ -322,8 +322,12 @@ "source": [ "from pymatgen.io.ase import MSONAtoms\n", "from ase import Atoms\n", - "def generate_structures(structure: Atoms, strain_lst: list(float)): # structure should be of ase Atoms type\n", - " structure=MSONAtoms(structure)\n", + "\n", + "\n", + "def generate_structures(\n", + " structure: Atoms, strain_lst: list(float)\n", + "): # structure should be of ase Atoms type\n", + " structure = MSONAtoms(structure)\n", " structure_lst = []\n", " for strain in strain_lst:\n", " structure_strain = structure.copy()\n", @@ -354,7 +358,7 @@ { "cell_type": "code", "source": [ - "def plot_energy_volume_curve(volume_lst: list(float), energy_lst:list(float)):\n", + "def plot_energy_volume_curve(volume_lst: list(float), energy_lst: list(float)):\n", " plt.plot(volume_lst, energy_lst)\n", " plt.xlabel(\"Volume\")\n", " plt.ylabel(\"Energy\")\n", @@ -381,7 +385,7 @@ { "cell_type": "code", "source": [ - "def write_input(input_dict: dict, working_directory: str=\".\"):\n", + "def write_input(input_dict: dict, working_directory: str = \".\"):\n", " filename = os.path.join(working_directory, \"input.pwi\")\n", " os.makedirs(working_directory, exist_ok=True)\n", " write(\n", @@ -500,8 +504,10 @@ "\n", "\n", "def write_qe_input_set(\n", - " structure: Atoms, input_set_generator: InputGenerator=QEInputGenerator(), working_directory: str=\".\"\n", - ")->None:\n", + " structure: Atoms,\n", + " input_set_generator: InputGenerator = QEInputGenerator(),\n", + " working_directory: str = \".\",\n", + ") -> None:\n", " qis = input_set_generator.get_input_set(structure=structure)\n", " qis.write_input(working_directory=working_directory)" ], @@ -535,7 +541,7 @@ "QE_CMD = \"mpirun -np 1 pw.x -in input.pwi > output.pwo\"\n", "\n", "\n", - "def run_qe(qe_cmd: str=QE_CMD):\n", + "def run_qe(qe_cmd: str = QE_CMD):\n", " subprocess.check_output(qe_cmd, shell=True, universal_newlines=True)\n", "\n", "\n", @@ -572,7 +578,7 @@ " input_set_generator: QEInputGenerator = field(default_factory=QEInputGenerator)\n", "\n", " @job(output_schema=QETaskDoc)\n", - " def make(self, structure: Atoms|MSONAtoms) -> QETaskDoc:\n", + " def make(self, structure: Atoms | MSONAtoms) -> QETaskDoc:\n", " \"\"\"\n", " Run a QE calculation.\n", "\n", @@ -645,7 +651,7 @@ "\n", "\n", "@job\n", - "def get_ev_curve(structure: Atoms|MSONAtoms, strain_lst: list(float)):\n", + "def get_ev_curve(structure: Atoms | MSONAtoms, strain_lst: list(float)):\n", " structures = generate_structures(structure, strain_lst=strain_lst)\n", " jobs = []\n", " volumes = []\n",