Skip to content

Commit 0e0e48b

Browse files
committed
Added test files. Using relative paths from project root to read data and newtonet related files.
1 parent 460b1b9 commit 0e0e48b

File tree

8 files changed

+314
-0
lines changed

8 files changed

+314
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import pytest
2+
import logging
3+
from ase.io import read
4+
from pathlib import Path
5+
from quacc import get_settings
6+
from ts_workflow_examples.geodesic_ts_with_hessian.using_mace import geodesic_ts_hess_irc_mace
7+
8+
9+
# Define the paths relative to the project root
10+
project_root = Path(__file__).resolve().parents[2]
11+
12+
13+
@pytest.fixture()
14+
def setup_test_environment(tmp_path):
15+
reactant = read(project_root / "tests" / '000_R.xyz')
16+
product = read(project_root / "tests" / '000_P.xyz')
17+
18+
return reactant, product
19+
20+
21+
def test_geodesic_ts_hess_irc_mace(setup_test_environment):
22+
reactant, product = setup_test_environment
23+
# Create mock jobs
24+
calc_kwargs = {}
25+
26+
# Setup logging
27+
logging.basicConfig(level=logging.INFO)
28+
logger = logging.getLogger(__name__)
29+
30+
settings = get_settings()
31+
settings.CHECK_CONVERGENCE = False
32+
33+
jobs = geodesic_ts_hess_irc_mace(reactant, product, calc_kwargs, logger)
34+
35+
# Assertions
36+
assert len(jobs) == 4
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import os
2+
import pytest
3+
import logging
4+
from ase.io import read
5+
from pathlib import Path
6+
from quacc import get_settings
7+
from ts_workflow_examples.geodesic_ts_with_hessian.using_newtonnet import geodesic_ts_hess_irc_newtonnet
8+
9+
10+
# Define the paths relative to the project root
11+
project_root = Path(__file__).resolve().parents[2]
12+
13+
14+
@pytest.fixture()
15+
def setup_test_environment(tmp_path):
16+
reactant = read(project_root / "tests" / '000_R.xyz')
17+
product = read(project_root / "tests" / '000_P.xyz')
18+
19+
return reactant, product
20+
21+
22+
def test_geodesic_ts_hess_irc_newtonnet(setup_test_environment):
23+
reactant, product = setup_test_environment
24+
25+
# Calculation and optimization keyword arguments
26+
calc_kwargs1 = {
27+
'hess_method': None,
28+
}
29+
calc_kwargs2 = {
30+
'hess_method': 'autograd',
31+
}
32+
33+
settings = get_settings()
34+
settings.NEWTONNET_MODEL_PATH = project_root / "tests" / "best_model_state.tar"
35+
settings.NEWTONNET_CONFIG_PATH = project_root / "tests" / "config0.yml"
36+
settings.CHECK_CONVERGENCE = False
37+
38+
# Setup logging
39+
logging.basicConfig(level=logging.INFO)
40+
logger = logging.getLogger(__name__)
41+
42+
jobs = geodesic_ts_hess_irc_newtonnet(reactant, product, calc_kwargs1, calc_kwargs2, logger)
43+
44+
# Assertions
45+
assert len(jobs) == 4
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import pytest
2+
import logging
3+
from ase.io import read
4+
from quacc import get_settings
5+
from pathlib import Path
6+
from ts_workflow_examples.geodesic_ts_without_hessian.using_mace import geodesic_ts_no_hess_irc_mace
7+
8+
9+
# Define the paths relative to the project root
10+
project_root = Path(__file__).resolve().parents[2]
11+
12+
13+
@pytest.fixture()
14+
def setup_test_environment(tmp_path):
15+
reactant = read(project_root / "tests" / '000_R.xyz')
16+
product = read(project_root / "tests" / '000_P.xyz')
17+
18+
return reactant, product
19+
20+
21+
def test_geodesic_ts_hess_irc_mace(setup_test_environment):
22+
reactant, product = setup_test_environment
23+
calc_kwargs = {}
24+
25+
# Setup logging
26+
logging.basicConfig(level=logging.INFO)
27+
logger = logging.getLogger(__name__)
28+
29+
settings = get_settings()
30+
settings.CHECK_CONVERGENCE = False
31+
32+
jobs = geodesic_ts_no_hess_irc_mace(reactant, product, calc_kwargs, logger)
33+
34+
# Assertions
35+
assert len(jobs) == 4
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import os
2+
import pytest
3+
import logging
4+
from ase.io import read
5+
from quacc import get_settings
6+
from pathlib import Path
7+
from ts_workflow_examples.geodesic_ts_without_hessian.using_newtonnet import geodesic_ts_no_hess_irc_newtonnet
8+
9+
10+
# Define the paths relative to the project root
11+
project_root = Path(__file__).resolve().parents[2]
12+
13+
14+
@pytest.fixture()
15+
def setup_test_environment(tmp_path):
16+
reactant = read(project_root / "tests" / '000_R.xyz')
17+
product = read(project_root / "tests" / '000_P.xyz')
18+
19+
return reactant, product
20+
21+
22+
def test_geodesic_ts_hess_irc_newtonnet(setup_test_environment):
23+
reactant, product = setup_test_environment
24+
25+
# Calculation and optimization keyword arguments
26+
calc_kwargs1 = {
27+
'hess_method': None,
28+
}
29+
30+
settings = get_settings()
31+
settings.NEWTONNET_MODEL_PATH = project_root / "tests" / "best_model_state.tar"
32+
settings.NEWTONNET_CONFIG_PATH = project_root / "tests" / "config0.yml"
33+
settings.CHECK_CONVERGENCE = False
34+
35+
# Setup logging
36+
logging.basicConfig(level=logging.INFO)
37+
logger = logging.getLogger(__name__)
38+
39+
jobs = geodesic_ts_no_hess_irc_newtonnet(reactant, product, calc_kwargs1, logger)
40+
41+
# Assertions
42+
assert len(jobs) == 4
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import pytest
2+
import logging
3+
from ase.io import read
4+
from quacc import get_settings
5+
from pathlib import Path
6+
from ts_workflow_examples.neb_ts_with_hessian.using_mace import neb_ts_hess_irc_mace
7+
8+
9+
# Define the paths relative to the project root
10+
project_root = Path(__file__).resolve().parents[2]
11+
12+
13+
@pytest.fixture()
14+
def setup_test_environment(tmp_path):
15+
reactant = read(project_root / "tests" / '000_R.xyz')
16+
product = read(project_root / "tests" / '000_P.xyz')
17+
18+
return reactant, product
19+
20+
21+
def test_neb_ts_hess_irc_mace(setup_test_environment):
22+
reactant, product = setup_test_environment
23+
calc_kwargs = {}
24+
25+
# Setup logging
26+
logging.basicConfig(level=logging.INFO)
27+
logger = logging.getLogger(__name__)
28+
29+
settings = get_settings()
30+
settings.CHECK_CONVERGENCE = False
31+
32+
jobs = neb_ts_hess_irc_mace(reactant, product, calc_kwargs, logger)
33+
34+
# Assertions
35+
assert len(jobs) == 4
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import pytest
2+
import logging
3+
from ase.io import read
4+
from pathlib import Path
5+
from quacc import get_settings
6+
from ts_workflow_examples.neb_ts_with_hessian.using_newtonnet import neb_ts_hess_irc_newtonnet
7+
8+
9+
# Define the paths relative to the project root
10+
project_root = Path(__file__).resolve().parents[2]
11+
12+
13+
@pytest.fixture()
14+
def setup_test_environment(tmp_path):
15+
reactant = read(project_root / "tests" / '000_R.xyz')
16+
product = read(project_root / "tests" / '000_P.xyz')
17+
18+
return reactant, product
19+
20+
21+
def test_neb_ts_hess_irc_newtonnet(setup_test_environment):
22+
reactant, product = setup_test_environment
23+
24+
# Calculation and optimization keyword arguments
25+
calc_kwargs1 = {
26+
'hess_method': None,
27+
}
28+
calc_kwargs2 = {
29+
'hess_method': 'autograd',
30+
}
31+
32+
settings = get_settings()
33+
settings.NEWTONNET_MODEL_PATH = project_root / "tests" / "best_model_state.tar"
34+
settings.NEWTONNET_CONFIG_PATH = project_root / "tests" / "config0.yml"
35+
settings.CHECK_CONVERGENCE = False
36+
37+
# Setup logging
38+
logging.basicConfig(level=logging.INFO)
39+
logger = logging.getLogger(__name__)
40+
41+
jobs = neb_ts_hess_irc_newtonnet(reactant, product, calc_kwargs1, calc_kwargs2, logger)
42+
43+
# Assertions
44+
assert len(jobs) == 4
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import pytest
2+
import logging
3+
from ase.io import read
4+
from pathlib import Path
5+
from quacc import get_settings
6+
from ts_workflow_examples.neb_ts_without_hessian.using_mace import neb_ts_no_hess_irc_mace
7+
8+
9+
# Define the paths relative to the project root
10+
project_root = Path(__file__).resolve().parents[2]
11+
12+
13+
@pytest.fixture()
14+
def setup_test_environment(tmp_path):
15+
reactant = read(project_root / "tests" / '000_R.xyz')
16+
product = read(project_root / "tests" / '000_P.xyz')
17+
18+
return reactant, product
19+
20+
21+
def test_neb_ts_no_hess_irc_mace(setup_test_environment):
22+
reactant, product = setup_test_environment
23+
24+
calc_kwargs = {}
25+
26+
# Setup logging
27+
logging.basicConfig(level=logging.INFO)
28+
logger = logging.getLogger(__name__)
29+
30+
settings = get_settings()
31+
settings.CHECK_CONVERGENCE = False
32+
33+
jobs = neb_ts_no_hess_irc_mace(reactant, product, calc_kwargs, logger)
34+
35+
# Assertions
36+
assert len(jobs) == 4
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import pytest
2+
import logging
3+
from ase.io import read
4+
from pathlib import Path
5+
from quacc import get_settings
6+
from ts_workflow_examples.neb_ts_without_hessian.using_newtonnet import neb_ts_no_hess_irc_newtonnet
7+
8+
9+
# Define the paths relative to the project root
10+
project_root = Path(__file__).resolve().parents[2]
11+
12+
13+
@pytest.fixture()
14+
def setup_test_environment(tmp_path):
15+
reactant = read(project_root / "tests" / '000_R.xyz')
16+
product = read(project_root / "tests" / '000_P.xyz')
17+
18+
return reactant, product
19+
20+
21+
def test_neb_ts_no_hess_irc_newtonnet(setup_test_environment):
22+
reactant, product = setup_test_environment
23+
24+
# Calculation and optimization keyword arguments
25+
calc_kwargs1 = {
26+
'hess_method': None,
27+
}
28+
29+
settings = get_settings()
30+
settings.NEWTONNET_MODEL_PATH = project_root / "tests" / "best_model_state.tar"
31+
settings.NEWTONNET_CONFIG_PATH = project_root / "tests" / "config0.yml"
32+
settings.CHECK_CONVERGENCE = False
33+
34+
# Setup logging
35+
logging.basicConfig(level=logging.INFO)
36+
logger = logging.getLogger(__name__)
37+
38+
jobs = neb_ts_no_hess_irc_newtonnet(reactant, product, calc_kwargs1, logger)
39+
40+
# Assertions
41+
assert len(jobs) == 4

0 commit comments

Comments
 (0)