Skip to content

Commit

Permalink
TST: Add tests for ARMCPT
Browse files Browse the repository at this point in the history
  • Loading branch information
Bas van Beek committed Nov 12, 2020
1 parent fc7845e commit 375786d
Show file tree
Hide file tree
Showing 596 changed files with 6,818,822 additions and 4 deletions.
40 changes: 37 additions & 3 deletions tests/test_armc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""Tests for various ARMC jobs."""

from pathlib import Path
from typing import Tuple, Generator, Any, cast
from itertools import combinations_with_replacement

import numpy as np
import h5py
Expand All @@ -12,7 +14,8 @@
from FOX.armc import dict_to_armc, run_armc

PATH = Path('tests') / 'test_files'
REF_PATH = PATH / 'ARMC_ref'
ARMC_REF = PATH / 'ARMC_ref'
ARMCPT_REF = PATH / 'ARMCPT_ref'


@delete_finally(PATH / '_ARMC')
Expand All @@ -23,12 +26,43 @@ def test_armc() -> None:
dct = yaml.load(f.read(), Loader=yaml.FullLoader)

armc, job_kwargs = dict_to_armc(dct)
armc.package_manager.hook = iter(load_results(REF_PATH, n=1))
armc.package_manager.hook = iter(load_results(ARMC_REF, n=1))

run_armc(armc, restart=False, **job_kwargs)

hdf5 = PATH / '_ARMC' / 'armc.hdf5'
hdf5_ref = REF_PATH / 'armc.hdf5'
hdf5_ref = ARMC_REF / 'armc.hdf5'
with h5py.File(hdf5, 'r') as f1, h5py.File(hdf5_ref, 'r') as f2:
assertion.eq(f1.keys(), f2.keys())

skip = {'param', 'aux_error_mod'}
iterator = ((k, f1[k][:], f2[k][:]) for k in f2.keys() if k not in skip)
for k, ar1, ar2 in iterator:
np.testing.assert_allclose(ar1, ar2, err_msg=f'dataset {k!r}\n')


def swap_phi(*args: Any, n: int = 3, **kwargs: Any) -> Generator[Tuple[int, int], None, None]:
while True:
iterator = combinations_with_replacement(range(n), r=2)
for i in iterator:
yield cast(Tuple[int, int], i)


@delete_finally(PATH / '_ARMCPT')
def test_armcpt() -> None:
"""Test :class:`ARMC`."""
file = PATH / 'armcpt_ref.yaml'
with open(file, 'r') as f:
dct = yaml.load(f.read(), Loader=yaml.FullLoader)

armc, job_kwargs = dict_to_armc(dct)
armc.swap_phi = swap_phi
armc.package_manager.hook = iter(load_results(ARMCPT_REF, n=3))

run_armc(armc, restart=False, **job_kwargs)

hdf5 = PATH / '_ARMCPT' / 'armc.hdf5'
hdf5_ref = ARMCPT_REF / 'armc.hdf5'
with h5py.File(hdf5, 'r') as f1, h5py.File(hdf5_ref, 'r') as f2:
assertion.eq(f1.keys(), f2.keys())

Expand Down
Binary file added tests/test_files/ARMCPT_ref/armc.hdf5
Binary file not shown.
Binary file added tests/test_files/ARMCPT_ref/armc.xyz.hdf5
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.002/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.002/md.002.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.003/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.003/md.003.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.004/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.004/md.004.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.005/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.005/md.005.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.006/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.006/md.006.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.007/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.007/md.007.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.008/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.008/md.008.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.009/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.009/md.009.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.010/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.010/md.010.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.011/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.011/md.011.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.012/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.012/md.012.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.013/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.013/md.013.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.014/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.014/md.014.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.015/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.015/md.015.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.016/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.016/md.016.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.017/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.017/md.017.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.018/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.018/md.018.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.019/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.019/md.019.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.020/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.020/md.020.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.021/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.021/md.021.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.022/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.022/md.022.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.023/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.023/md.023.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.024/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.024/md.024.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.025/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.025/md.025.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.026/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.026/md.026.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.027/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.027/md.027.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.028/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.028/md.028.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.029/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.029/md.029.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.030/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.030/md.030.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.031/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.031/md.031.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.032/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.032/md.032.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.033/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.033/md.033.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.034/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.034/md.034.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.035/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.035/md.035.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.036/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.036/md.036.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.037/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.037/md.037.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.038/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.038/md.038.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.039/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.039/md.039.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.040/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.040/md.040.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.041/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.041/md.041.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.042/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.042/md.042.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.043/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.043/md.043.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.044/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.044/md.044.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.045/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.045/md.045.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.046/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.046/md.046.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.047/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.047/md.047.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.048/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.048/md.048.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.049/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.049/md.049.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.050/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.050/md.050.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.051/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.051/md.051.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.052/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.052/md.052.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.053/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.053/md.053.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.054/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.054/md.054.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.055/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Binary file added tests/test_files/ARMCPT_ref/md.055/md.055.dill
Binary file not shown.
23,129 changes: 23,129 additions & 0 deletions tests/test_files/ARMCPT_ref/md.056/cp2k-pos-1.xyz

Large diffs are not rendered by default.

Loading

0 comments on commit 375786d

Please sign in to comment.