From c163530d74fe654c55fe5eda0aabcce812cae079 Mon Sep 17 00:00:00 2001 From: gelzinyte Date: Fri, 16 Aug 2024 14:58:41 +0200 Subject: [PATCH 1/6] update readme. Remove unused calculator utils funciton --- README.md | 13 ++++++++++--- wfl/calculators/utils.py | 27 --------------------------- 2 files changed, 10 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index b8647eb6..a4027211 100644 --- a/README.md +++ b/README.md @@ -10,12 +10,19 @@ For examples and more information see [documentation](https://libatoms.github.io `wfl` and its dependencies may be installed via `pip install wfl`. -NOTE: (as of 14 June 2024) `wfl` is only tested against the latest ASE pip release, currently v3.23.0. -For the time being, v3.22.1 is the minimum version listed as a (pip) prerequisite of `wfl`, because -it at least mostly works, but it may not be fully compatible and is not actively tested. # Recent changes +v0.3.0: + +- Update the file-based calculators (Orca, FHI-Aims, Vasp, Quantum Espresso, Castep) to work + with with ASE v3.23. This update breaks backwards-compatibility. For compatibility with with + the ASE v3.22 see use wfl v0.2.7 or earlier. + +v0.2.7: + +- Latest version compatible with ASE v3.22.x. To install, use `pip install wfl==0.2.7`. + v0.2.3: - Add wfl.generate.neb, with required improved support for passing ConfigSet.groups() to diff --git a/wfl/calculators/utils.py b/wfl/calculators/utils.py index 30d22563..1ca8c6b6 100644 --- a/wfl/calculators/utils.py +++ b/wfl/calculators/utils.py @@ -22,31 +22,4 @@ def clean_rundir(rundir, keep_files, default_keep_files, calculation_succeeded): else: clean_dir(rundir, keep_files, force=False) -def parse_genericfileio_profile_argv(argv): - """Parse a command provided as a conventional argv into the separate - structures that generic file-io calculators use to construct their Profile - Parameters - ---------- - argv: list(str) - command to execute, split into separate arguments (e.g. using shlex.split?) - - Returns - ------- - binary: str binary to execute - parallel_info: dict with parallel info, in particular "binary" for mpirun/mpiexec/srun etc, - and additional fields to reconstruct rest of command line (all fake, depending - on details of how ASE constructs the final command line - """ - binary = argv[-1] - parallel_info = None - if len(argv) > 1: - # assume earlier arguments are parallel execution dependent, in particular - # mpirun/mpiexec/srun [other mpi argument] pw_executable - parallel_info = {"binary": argv[0]} - for arg in argv[1:-1]: - # add additional arguments, faked into a dict that ASE will convert into - # a proper command line - parallel_info[arg] = True - - return binary, parallel_info From 068607760dcbfa67a26c82845931c9cb605df63a Mon Sep 17 00:00:00 2001 From: elena Date: Fri, 16 Aug 2024 15:18:04 +0200 Subject: [PATCH 2/6] make docs be version-specific --- docs/source/conf.py | 4 ++++ pyproject.toml | 5 ++++- wfl/__init__.py | 1 + wfl/__version__.py | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 wfl/__version__.py diff --git a/docs/source/conf.py b/docs/source/conf.py index 1fee59ae..3ff3ab09 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -12,6 +12,8 @@ # import os import sys +from wfl import __version__ + sys.path.insert(0, os.path.abspath('../../wfl')) @@ -21,6 +23,8 @@ #copyright = '2021, N. Bernstein, T. K. Stenczel, E. Gelzinyte' author = 'N. Bernstein, T. K. Stenczel, E. Gelzinyte' +release = __version__ + # -- General configuration --------------------------------------------------- diff --git a/pyproject.toml b/pyproject.toml index 9d115787..acf17796 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,12 @@ [project] name = "wfl" -version = "0.3.0" requires-python = ">=3.9" dependencies = [ "click>=7.0", "numpy<2", "ase>=3.22.1", "pyyaml", "spglib", "docstring_parser", "expyre-wfl", "universalSOAP" ] readme = "README.md" license = { file = "LICENSE" } +dynamic = ["version"] [project.scripts] wfl = "wfl.cli.cli:cli" @@ -16,3 +16,6 @@ license = { file = "LICENSE" } [tool.setuptools.packages.find] exclude = [ "test*" ] + +[tool.setuptools.dynamic] +version = {attr = "wfl.__version__"} diff --git a/wfl/__init__.py b/wfl/__init__.py index e69de29b..9226fe7e 100644 --- a/wfl/__init__.py +++ b/wfl/__init__.py @@ -0,0 +1 @@ +from .__version__ import __version__ diff --git a/wfl/__version__.py b/wfl/__version__.py new file mode 100644 index 00000000..493f7415 --- /dev/null +++ b/wfl/__version__.py @@ -0,0 +1 @@ +__version__ = "0.3.0" From c350ea957aed9dfd471d41b3921e71fbfeccde75 Mon Sep 17 00:00:00 2001 From: elena Date: Mon, 2 Sep 2024 18:38:02 +0200 Subject: [PATCH 3/6] fix skipping espresso tests, add optional dependencies, update readme and docs/index --- README.md | 29 +------- docs/source/index.rst | 69 +++++++++++++++++--- pyproject.toml | 20 +++++- tests/calculators/test_ase_fileio_caching.py | 6 +- tests/calculators/test_calc_generic.py | 3 + tests/calculators/test_wrapped_calculator.py | 4 +- tests/cli/test_descriptor.py | 4 ++ 7 files changed, 93 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index a4027211..97299fa6 100644 --- a/README.md +++ b/README.md @@ -23,32 +23,5 @@ v0.2.7: - Latest version compatible with ASE v3.22.x. To install, use `pip install wfl==0.2.7`. -v0.2.3: +For older changes see [documentation](https://libatoms.github.io/workflow). -- Add wfl.generate.neb, with required improved support for passing ConfigSet.groups() to - autoaparallelized functions - -- Improved handling of old and new style ase.calculators.espresso.Espresso initialization - -v0.2.2: - -- Improve checking of DFT calculator convergence - -v0.2.1: - -- Fix group iterator - -v0.2.0: - -- Change all wfl operations to use explicit random number generator [pull 285](https://github.com/libAtoms/workflow/pull/285), to improve reproducibility of scripts and reduce the chances that on script rerun, cached jobs will not be recognized due to uncontrolled change in random seed (as in [issue 283](https://github.com/libAtoms/workflow/issues/283) and [issue 284](https://github.com/libAtoms/workflow/issues/284)). Note that this change breaks backward compatibility because many functions now _require_ an `rng` argument, for example - ```python - rng = np.random.default_rng(1) - md_configs = md.md(..., rng=rng, ...) - ``` - -v0.1.0: - -- make it possible to fire off several remote autoparallelized ops without waiting for their jobs to finish -- multi-pass calculation in `Vasp`, to allow for things like GGA followed by HSE -- MACE fitting, including remote jobs -- various bug fixes diff --git a/docs/source/index.rst b/docs/source/index.rst index 7839db96..03b53f6b 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -23,14 +23,6 @@ Quick start that installs all of the mandatory dependencies: python3 -m pip install wfl -.. note:: - - (as of 14 June 2024) `wfl` is only tested against the latest - ASE pip release, currently v3.23.0. For the time being, v3.22.1 is - the mininum version listed as a (pip) prerequisite of `wfl`, because - it at least mostly works, but it may not be fully compatible and is - not actively tested. - *************************************** Repository @@ -39,6 +31,67 @@ Repository Please find the code, raise issues and cotribute at https://github.com/libAtoms/workflow. +*************************************** +Development +*************************************** + +To install all dependencies needed for running unit tests: + +.. code-block:: sh + + python3 -m pip install /path/to/workflow[test] + + +Some of the `wfl` functions rely on the `quippy-ase` package, which currently (2 September 2024) supports no higher Python versions than v3.9. + +The file-based calculator tests need ASE calculator configiguration file to be present; `see the ASE documentation `. + + +*************************************** +Recent Changes +*************************************** + +v0.3.0: + +- Update the file-based calculators (Orca, FHI-Aims, Vasp, Quantum Espresso, Castep) to work + with with ASE v3.23. This update breaks backwards-compatibility. For compatibility with with + the ASE v3.22 see use wfl v0.2.7 or earlier. + +v0.2.7: + +- Latest version compatible with ASE v3.22.x. To install, use `pip install wfl==0.2.7`. + +v0.2.3: + +- Add wfl.generate.neb, with required improved support for passing ConfigSet.groups() to + autoaparallelized functions + +- Improved handling of old and new style ase.calculators.espresso.Espresso initialization + +v0.2.2: + +- Improve checking of DFT calculator convergence + +v0.2.1: + +- Fix group iterator + +v0.2.0: + +- Change all wfl operations to use explicit random number generator [pull 285](https://github.com/libAtoms/workflow/pull/285), to improve reproducibility of scripts and reduce the chances that on script rerun, cached jobs will not be recognized due to uncontrolled change in random seed (as in [issue 283](https://github.com/libAtoms/workflow/issues/283) and [issue 284](https://github.com/libAtoms/workflow/issues/284)). Note that this change breaks backward compatibility because many functions now _require_ an `rng` argument, for example + ```python + rng = np.random.default_rng(1) + md_configs = md.md(..., rng=rng, ...) + ``` + +v0.1.0: + +- make it possible to fire off several remote autoparallelized ops without waiting for their jobs to finish +- multi-pass calculation in `Vasp`, to allow for things like GGA followed by HSE +- MACE fitting, including remote jobs +- various bug fixes + + *************************************** Contents *************************************** diff --git a/pyproject.toml b/pyproject.toml index acf17796..65873722 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "wfl" requires-python = ">=3.9" dependencies = [ "click>=7.0", "numpy<2", "ase>=3.22.1", "pyyaml", "spglib", - "docstring_parser", "expyre-wfl", "universalSOAP" ] + "docstring_parser", "expyre-wfl", "universalSOAP", "pandas" ] readme = "README.md" license = { file = "LICENSE" } dynamic = ["version"] @@ -19,3 +19,21 @@ dynamic = ["version"] [tool.setuptools.dynamic] version = {attr = "wfl.__version__"} + +[project.optional-dependencies] +test = [ + "pytest", + "mace-torch", + "quippy-ase", + "requests", + "rdkit==2024.3.3", +] +doc = [ + "sphinx", + "sphinx_click", + "nbsphinx", + "myst_parser", + "sphinx_book_theme", +] +all = ["wfl[test,doc]"] + diff --git a/tests/calculators/test_ase_fileio_caching.py b/tests/calculators/test_ase_fileio_caching.py index 00883e03..4f2e9bd6 100644 --- a/tests/calculators/test_ase_fileio_caching.py +++ b/tests/calculators/test_ase_fileio_caching.py @@ -8,8 +8,8 @@ ######################## # test Vasp calculator -from tests.calculators.test_vasp import test_vasp_mark -@pytest.mark.skipif(test_vasp_mark, reason='Vasp testing env vars missing') +from tests.calculators.test_vasp import pytestmark as vasp_pytestmark +@vasp_pytestmark def test_vasp_cache_timing(tmp_path, monkeypatch): from ase.calculators.vasp import Vasp as Vasp_ase from wfl.calculators.vasp import Vasp as Vasp_wrap @@ -27,7 +27,7 @@ def test_vasp_cache_timing(tmp_path, monkeypatch): ######################## # test quantum espresso calculator from tests.calculators.test_qe import espresso_avail, qe_pseudo -@pytest.mark.skipif(not espresso_avail, reason='qe testing env vars missing') +@espresso_avail def test_qe_cache_timing(tmp_path, monkeypatch, qe_pseudo): from ase.calculators.espresso import Espresso as Espresso_ASE from wfl.calculators.espresso import Espresso as Espresso_wrap diff --git a/tests/calculators/test_calc_generic.py b/tests/calculators/test_calc_generic.py index d08c12bb..d952582f 100644 --- a/tests/calculators/test_calc_generic.py +++ b/tests/calculators/test_calc_generic.py @@ -15,6 +15,8 @@ from wfl.calculators.espresso import Espresso from wfl.autoparallelize import AutoparaInfo +from tests.calculators.test_qe import espresso_avail + ref_lj_energy = -4.52573996914352 ref_morse_energy = -3.4187397762024867 @@ -139,6 +141,7 @@ def test_generic_autopara_defaults(): sys.stderr = sys.__stderr__ assert "num_inputs_per_python_subprocess=3" in l_stderr.getvalue() +@espresso_avail def test_generic_DFT_autopara_defaults(tmp_path, monkeypatch): ats = [Atoms('Al2', positions=[[0,0,0], [1,1,1]], cell=[10]*3, pbc=[True]*3) for _ in range(50)] diff --git a/tests/calculators/test_wrapped_calculator.py b/tests/calculators/test_wrapped_calculator.py index 4fe2b3e9..c273a026 100644 --- a/tests/calculators/test_wrapped_calculator.py +++ b/tests/calculators/test_wrapped_calculator.py @@ -6,7 +6,7 @@ ######################## # test a RuntimeWarning is raised when using the Espresso Calculator directly from ase from tests.calculators.test_qe import espresso_avail, qe_pseudo -@pytest.mark.skipif(not espresso_avail, reason='qe testing env vars missing') +@espresso_avail def test_wrapped_qe(tmp_path, qe_pseudo): from ase.calculators.espresso import Espresso as Espresso_ASE from wfl.calculators.espresso import Espresso as Espresso_wrap @@ -27,4 +27,4 @@ def test_wrapped_qe(tmp_path, qe_pseudo): direct_calc = (Espresso_ASE, [], kwargs) kwargs_generic = dict(inputs=ConfigSet(config), outputs=OutputSpec(), calculator=direct_calc) - pytest.warns(RuntimeWarning, generic.calculate, **kwargs_generic) \ No newline at end of file + pytest.warns(RuntimeWarning, generic.calculate, **kwargs_generic) diff --git a/tests/cli/test_descriptor.py b/tests/cli/test_descriptor.py index e278d453..2b5cb793 100644 --- a/tests/cli/test_descriptor.py +++ b/tests/cli/test_descriptor.py @@ -43,9 +43,13 @@ def test_descriptor_quippy(tmp_path): f'--key soap' ] + + import pdb; pdb.set_trace() + runner = CliRunner() result = runner.invoke(cli, ' '.join(params)) + target = Descriptor( descriptor_str).calc(ats[0])['data'][0] assert target.shape[0] == 181 From ade7234b8b02555cf63504bf717dae48617ddcd0 Mon Sep 17 00:00:00 2001 From: elena Date: Mon, 2 Sep 2024 18:40:09 +0200 Subject: [PATCH 4/6] publish docs on tag --- .github/workflows/docs.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 31a5e1da..a534b721 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -103,12 +103,9 @@ jobs: cd docs make html -# event type from https://stackoverflow.com/questions/61886993/in-github-actions-how-to-get-the-type-of-a-trigger-event-as-a-variable -# conditional control ("if:") from https://docs.github.com/en/actions/using-jobs/using-conditions-to-control-job-execution -# dependency from https://docs.github.com/en/actions/using-jobs/using-jobs-in-a-workflow - deploy-docs: - if: github.event.action == 'push' + name: Publish documentation + if: startsWith(github.ref, "refs/tags/") needs: build-docs runs-on: ubuntu-latest From ae01fe31d1872855a504877d092f8330c1a30dfb Mon Sep 17 00:00:00 2001 From: gelzinyte Date: Tue, 3 Sep 2024 17:03:19 +0200 Subject: [PATCH 5/6] remove pdb trace --- tests/cli/test_descriptor.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/cli/test_descriptor.py b/tests/cli/test_descriptor.py index 2b5cb793..e278d453 100644 --- a/tests/cli/test_descriptor.py +++ b/tests/cli/test_descriptor.py @@ -43,13 +43,9 @@ def test_descriptor_quippy(tmp_path): f'--key soap' ] - - import pdb; pdb.set_trace() - runner = CliRunner() result = runner.invoke(cli, ' '.join(params)) - target = Descriptor( descriptor_str).calc(ats[0])['data'][0] assert target.shape[0] == 181 From 8a37f3db04e17813de992cbc2db6df0f1da69963 Mon Sep 17 00:00:00 2001 From: Noam Bernstein Date: Tue, 3 Sep 2024 13:19:49 -0400 Subject: [PATCH 6/6] Update version to 0.3.1 --- README.md | 5 +++++ wfl/__version__.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 97299fa6..f9ca95d9 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,11 @@ For examples and more information see [documentation](https://libatoms.github.io # Recent changes +v0.3.1: + +- additional updates to file-based calculators for ASE v3.23. +- fixes to parity plots + v0.3.0: - Update the file-based calculators (Orca, FHI-Aims, Vasp, Quantum Espresso, Castep) to work diff --git a/wfl/__version__.py b/wfl/__version__.py index 493f7415..260c070a 100644 --- a/wfl/__version__.py +++ b/wfl/__version__.py @@ -1 +1 @@ -__version__ = "0.3.0" +__version__ = "0.3.1"