Skip to content

Commit

Permalink
reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
JaGeo committed Jul 3, 2024
1 parent d3d4a6c commit 73b06f6
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions jobflow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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)"
],
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 73b06f6

Please sign in to comment.