Skip to content

Commit a9579d4

Browse files
committed
Added numpy-styled docstrings and typehints to the workflows.
1 parent 790ccf5 commit a9579d4

File tree

8 files changed

+284
-21
lines changed

8 files changed

+284
-21
lines changed

src/ts_workflow_examples/geodesic_ts_with_hessian/using_mace.py

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,44 @@
1+
import os
2+
import toml
3+
import glob
4+
import shutil
15
import logging
26
from ase.io import read
3-
import os, toml, glob, shutil
7+
from ase.atoms import Atoms
48
from quacc import get_settings
59
from quacc import strip_decorator
10+
from typing import List, Dict, Any
611
from quacc.recipes.mace.ts import ts_job, irc_job, geodesic_job
712

813

9-
def geodesic_ts_hess_irc_mace(reactant, product, calc_kwargs, logger, clean_up=True):
14+
def geodesic_ts_hess_irc_mace(
15+
reactant: Atoms,
16+
product: Atoms,
17+
calc_kwargs: Dict[str, Any],
18+
logger: logging.Logger,
19+
clean_up: bool = True,
20+
) -> List[Dict[str, Any]]:
21+
"""
22+
Perform geodesic, transition state, and intrinsic reaction coordinate (IRC) calculations using MACE.
23+
24+
Parameters
25+
----------
26+
reactant : Atoms
27+
The reactant structure.
28+
product : Atoms
29+
The product structure.
30+
calc_kwargs : dict
31+
Keyword arguments for the ASE calculator.
32+
logger : logging.Logger
33+
Logger for logging information.
34+
clean_up : bool, optional
35+
Whether to clean up raw files after completion, by default True.
36+
37+
Returns
38+
-------
39+
List[Dict[str, Any]]
40+
List containing results from geodesic, TS, and IRC jobs.
41+
"""
1042
# Create NEB job
1143
job1 = strip_decorator(geodesic_job)(reactant, product, calc_kwargs=calc_kwargs)
1244
logger.info("Geodesic job done.")

src/ts_workflow_examples/geodesic_ts_with_hessian/using_newtonnet.py

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,47 @@
1+
import os
2+
import toml
3+
import glob
4+
import shutil
15
import logging
26
from ase.io import read
3-
import os, toml, glob, shutil
7+
from ase.atoms import Atoms
48
from quacc import get_settings
59
from quacc import strip_decorator
10+
from typing import List, Dict, Any
611
from quacc.recipes.newtonnet.ts import ts_job, irc_job, geodesic_job
712

813

9-
def geodesic_ts_hess_irc_newtonnet(reactant, product, calc_kwargs1, calc_kwargs2, logger, clean_up=True):
14+
def geodesic_ts_hess_irc_newtonnet(
15+
reactant: Atoms,
16+
product: Atoms,
17+
calc_kwargs1: Dict[str, Any],
18+
calc_kwargs2: Dict[str, Any],
19+
logger: logging.Logger,
20+
clean_up: bool = True,
21+
) -> List[Dict[str, Any]]:
22+
"""
23+
Perform geodesic, transition state, and intrinsic reaction coordinate (IRC) calculations using NewtonNet.
24+
25+
Parameters
26+
----------
27+
reactant : Atoms
28+
The reactant structure.
29+
product : Atoms
30+
The product structure.
31+
calc_kwargs1 : dict
32+
Keyword arguments for the ASE calculator for the geodesic and IRC jobs.
33+
calc_kwargs2 : dict
34+
Keyword arguments for the ASE calculator for the TS job with custom Hessian.
35+
logger : logging.Logger
36+
Logger for logging information.
37+
clean_up : bool, optional
38+
Whether to clean up raw files after completion, by default True.
39+
40+
Returns
41+
-------
42+
List[Dict[str, Any]]
43+
List containing results from geodesic, TS, and IRC jobs.
44+
"""
1045
# Create NEB job
1146
job1 = strip_decorator(geodesic_job)(reactant, product, calc_kwargs=calc_kwargs1)
1247
logger.info("Created Geodesic job.")

src/ts_workflow_examples/geodesic_ts_without_hessian/using_mace.py

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,45 @@
1+
import os
2+
import toml
3+
import glob
4+
import shutil
15
import logging
26
from ase.io import read
3-
import os, toml, glob, shutil
7+
from ase.atoms import Atoms
48
from quacc import get_settings
59
from quacc import strip_decorator
10+
from typing import List, Dict, Any
611
from quacc.recipes.mace.ts import ts_job, irc_job, geodesic_job
712

813

9-
def geodesic_ts_no_hess_irc_mace(reactant, product, calc_kwargs, logger, clean_up=True):
14+
def geodesic_ts_no_hess_irc_mace(
15+
reactant: Atoms,
16+
product: Atoms,
17+
calc_kwargs: Dict[str, Any],
18+
logger: logging.Logger,
19+
clean_up: bool = True,
20+
) -> List[Dict[str, Any]]:
21+
"""
22+
Perform geodesic, transition state (TS) without custom Hessian, and intrinsic reaction coordinate (IRC)
23+
calculations using MACE.
24+
25+
Parameters
26+
----------
27+
reactant : Atoms
28+
The reactant structure.
29+
product : Atoms
30+
The product structure.
31+
calc_kwargs : dict
32+
Keyword arguments for the ASE calculator.
33+
logger : logging.Logger
34+
Logger for logging information.
35+
clean_up : bool, optional
36+
Whether to clean up raw files after completion, by default True.
37+
38+
Returns
39+
-------
40+
List[Dict[str, Any]]
41+
List containing results from geodesic, TS, and IRC jobs.
42+
"""
1043
# Create geodesic path
1144
job1 = strip_decorator(geodesic_job)(reactant, product, calc_kwargs=calc_kwargs)
1245
logger.info("Created Geodesic job.")

src/ts_workflow_examples/geodesic_ts_without_hessian/using_newtonnet.py

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,45 @@
1+
import os
2+
import toml
3+
import glob
4+
import shutil
15
import logging
26
from ase.io import read
3-
import os, toml, glob, shutil
7+
from ase.atoms import Atoms
48
from quacc import get_settings
59
from quacc import strip_decorator
10+
from typing import List, Dict, Any
611
from quacc.recipes.newtonnet.ts import ts_job, irc_job, geodesic_job
712

813

9-
def geodesic_ts_no_hess_irc_newtonnet(reactant, product, calc_kwargs1, logger, clean_up=True):
14+
def geodesic_ts_no_hess_irc_newtonnet(
15+
reactant: Atoms,
16+
product: Atoms,
17+
calc_kwargs1: Dict[str, Any],
18+
logger: logging.Logger,
19+
clean_up: bool = True,
20+
) -> List[Dict[str, Any]]:
21+
"""
22+
Perform geodesic, transition state (TS) without custom Hessian, and intrinsic reaction coordinate (IRC)
23+
calculations using NewtonNet.
24+
25+
Parameters
26+
----------
27+
reactant : Atoms
28+
The reactant structure.
29+
product : Atoms
30+
The product structure.
31+
calc_kwargs1 : dict
32+
Keyword arguments for the ASE calculator.
33+
logger : logging.Logger
34+
Logger for logging information.
35+
clean_up : bool, optional
36+
Whether to clean up raw files after completion, by default True.
37+
38+
Returns
39+
-------
40+
List[Dict[str, Any]]
41+
List containing results from geodesic, TS, and IRC jobs.
42+
"""
1043
# Create geodesic job
1144
job1 = strip_decorator(geodesic_job)(reactant, product, calc_kwargs=calc_kwargs1)
1245
logger.info("Created Geodesic job.")

src/ts_workflow_examples/neb_ts_with_hessian/using_mace.py

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,45 @@
1+
import os
2+
import toml
3+
import glob
4+
import shutil
15
import logging
26
from ase.io import read
3-
import os, toml, glob, shutil
7+
from ase.atoms import Atoms
48
from quacc import get_settings
59
from quacc import strip_decorator
10+
from typing import List, Dict, Any
611
from quacc.recipes.mace.ts import ts_job, irc_job, neb_job
712

813

9-
def neb_ts_hess_irc_mace(reactant, product, calc_kwargs1, logger, clean_up=True):
14+
def neb_ts_hess_irc_mace(
15+
reactant: Atoms,
16+
product: Atoms,
17+
calc_kwargs1: Dict[str, Any],
18+
logger: logging.Logger,
19+
clean_up: bool = True,
20+
) -> List[Dict[str, Any]]:
21+
"""
22+
Perform NEB, transition state (TS) with custom Hessian, and intrinsic reaction coordinate (IRC)
23+
calculations using MACE.
24+
25+
Parameters
26+
----------
27+
reactant : Atoms
28+
The reactant structure.
29+
product : Atoms
30+
The product structure.
31+
calc_kwargs1 : dict
32+
Keyword arguments for the ASE calculator.
33+
logger : logging.Logger
34+
Logger for logging information.
35+
clean_up : bool, optional
36+
Whether to clean up raw files after completion, by default True.
37+
38+
Returns
39+
-------
40+
List[Dict[str, Any]]
41+
List containing results from NEB, TS, and IRC jobs.
42+
"""
1043
# Create NEB job
1144
job1 = strip_decorator(neb_job)(reactant, product, calc_kwargs=calc_kwargs1)
1245
logger.info("Created NEB job.")
@@ -68,4 +101,3 @@ def neb_ts_hess_irc_mace(reactant, product, calc_kwargs1, logger, clean_up=True)
68101
print('\n\n', job2)
69102
print('\n\n', job3)
70103
print('\n\n', job4)
71-

src/ts_workflow_examples/neb_ts_with_hessian/using_newtonnet.py

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,48 @@
1+
import os
2+
import toml
3+
import glob
4+
import shutil
15
import logging
2-
import jobflow as jf
36
from ase.io import read
4-
import os, toml, glob, shutil
7+
from ase.atoms import Atoms
58
from quacc import get_settings
69
from quacc import strip_decorator
10+
from typing import List, Dict, Any
711
from quacc.recipes.newtonnet.ts import ts_job, irc_job, neb_job
812

913

10-
def neb_ts_hess_irc_newtonnet(reactant, product, calc_kwargs1, calc_kwargs2, logger, clean_up=True):
14+
def neb_ts_hess_irc_newtonnet(
15+
reactant: Atoms,
16+
product: Atoms,
17+
calc_kwargs1: Dict[str, Any],
18+
calc_kwargs2: Dict[str, Any],
19+
logger: logging.Logger,
20+
clean_up: bool = True,
21+
) -> List[Dict[str, Any]]:
22+
"""
23+
Perform NEB, transition state (TS) with custom Hessian, and intrinsic reaction coordinate (IRC)
24+
calculations using NewtonNet.
25+
26+
Parameters
27+
----------
28+
reactant : Atoms
29+
The reactant structure.
30+
product : Atoms
31+
The product structure.
32+
calc_kwargs1 : dict
33+
Keyword arguments for the ASE calculator for NEB and IRC jobs.
34+
calc_kwargs2 : dict
35+
Keyword arguments for the ASE calculator for TS job.
36+
logger : logging.Logger
37+
Logger for logging information.
38+
clean_up : bool, optional
39+
Whether to clean up raw files after completion, by default True.
40+
41+
Returns
42+
-------
43+
List[Dict[str, Any]]
44+
List containing results from NEB, TS, and IRC jobs.
45+
"""
1146
# Create NEB job
1247
job1 = strip_decorator(neb_job)(reactant, product, calc_kwargs=calc_kwargs1)
1348
logger.info("Created NEB job.")
@@ -76,4 +111,3 @@ def neb_ts_hess_irc_newtonnet(reactant, product, calc_kwargs1, calc_kwargs2, log
76111
print('\n\n', job2)
77112
print('\n\n', job3)
78113
print('\n\n', job4)
79-

src/ts_workflow_examples/neb_ts_without_hessian/using_mace.py

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,45 @@
1+
import os
2+
import toml
3+
import glob
4+
import shutil
15
import logging
26
from ase.io import read
3-
import os, toml, glob, shutil
7+
from ase.atoms import Atoms
48
from quacc import get_settings
59
from quacc import strip_decorator
10+
from typing import List, Dict, Any
611
from quacc.recipes.mace.ts import ts_job, irc_job, neb_job
712

813

9-
def neb_ts_no_hess_irc_mace(reactant, product, calc_kwargs1, logger, clean_up=True):
14+
def neb_ts_no_hess_irc_mace(
15+
reactant: Atoms,
16+
product: Atoms,
17+
calc_kwargs1: Dict[str, Any],
18+
logger: logging.Logger,
19+
clean_up: bool = True
20+
) -> List[Dict[str, Any]]:
21+
"""
22+
Perform NEB, transition state (TS) without custom Hessian, and intrinsic reaction coordinate (IRC)
23+
calculations using MACE.
24+
25+
Parameters
26+
----------
27+
reactant : Atoms
28+
The reactant structure.
29+
product : Atoms
30+
The product structure.
31+
calc_kwargs1 : dict
32+
Keyword arguments for the ASE calculator for NEB, TS, and IRC jobs.
33+
logger : logging.Logger
34+
Logger for logging information.
35+
clean_up : bool, optional
36+
Whether to clean up raw files after completion, by default True.
37+
38+
Returns
39+
-------
40+
List[Dict[str, Any]]
41+
List containing results from NEB, TS, and IRC jobs.
42+
"""
1043
# Create NEB job
1144
job1 = strip_decorator(neb_job)(reactant, product, calc_kwargs=calc_kwargs1)
1245
logger.info("Created NEB job.")
@@ -67,4 +100,3 @@ def neb_ts_no_hess_irc_mace(reactant, product, calc_kwargs1, logger, clean_up=Tr
67100
print('\n\n', job2)
68101
print('\n\n', job3)
69102
print('\n\n', job4)
70-

0 commit comments

Comments
 (0)