diff --git a/.github/workflows/pytests.yml b/.github/workflows/pytests.yml index 9f585820..4c0a780c 100644 --- a/.github/workflows/pytests.yml +++ b/.github/workflows/pytests.yml @@ -19,7 +19,6 @@ jobs: env: coverage-on-version: "3.10" use-mpi: True - PIP_CONSTRAINT: pip_constraint.txt defaults: run: shell: bash -l {0} @@ -40,13 +39,11 @@ jobs: - name: Install dependencies from pip run: | - echo "numpy<2" >> $PIP_CONSTRAINT python3 -m pip install wheel setuptools numpy scipy click matplotlib pyyaml spglib rdkit==2024.3.3 flake8 pytest pytest-cov requests python3 -c "import numpy; print('numpy version', numpy.__version__)" - name: Install latest ASE from pypi run: | - echo PIP_CONSTRAINT $PIP_CONSTRAINT # avoid broken extxyz writing (3.25, fixed in 3.26) # avoid broken optimizer.converged() (3.26) https://gitlab.com/ase/ase/-/issues/1744 python3 -m pip install 'ase<3.25' @@ -83,9 +80,6 @@ jobs: fi source $mklvars intel64 - # pip constraint needs to be an absolute filename - export PIP_CONSTRAINT=$PWD/$PIP_CONSTRAINT - git clone https://github.com/phonopy/phonopy cd phonopy echo python3 -m pip install -e . -vvv @@ -103,14 +97,10 @@ jobs: python3 -m pip install quippy-ase python3 -c "import numpy; print('numpy version', numpy.__version__)" - - name: Install xTB (before things that need pandas like MACE and wfl, since it will break pandas-numpy compatibility by downgrading numpy) + - name: Install tblite run: | - # force compatible numpy version - conda install 'numpy<2' - conda install -c conda-forge xtb-python + conda install -c conda-forge tblite-python python3 -m pip install typing-extensions - # install pandas now to encourage compatible numpy version after conda regressed it - python3 -m pip install pandas python3 -c "import numpy; print('numpy version', numpy.__version__)" - name: MACE diff --git a/docs/source/examples.daisy_chain_mlip_fitting.ipynb b/docs/source/examples.daisy_chain_mlip_fitting.ipynb index 07520478..73afc9fc 100644 --- a/docs/source/examples.daisy_chain_mlip_fitting.ipynb +++ b/docs/source/examples.daisy_chain_mlip_fitting.ipynb @@ -36,19 +36,17 @@ " Installation: `pip install quippy-ase`\n", "\n", "\n", - "- GFN2-xTB: a semi-empirical method designed for molecular systems, used as a reference method. \n", + "- GFN2-xTB: a semi-empirical method designed for molecular systems, used as a reference method. We use the `tblite` implementation of GFN2-xTB. \n", "\n", - " Documentation: \n", - " - https://xtb-docs.readthedocs.io/en/latest/contents.html\n", - " - https://xtb-python.readthedocs.io/en/latest/\n", + " Documentation: https://tblite.readthedocs.io/\n", "\n", - " Installation: `conda install -c conda-forge xtb-python`\n", + " Installation: `conda install -c conda-forge tblite-python`\n", "\n", "- RDKit: a chemoinformatics package that wfl uses to convert 2D SMILES strings (e.g. \"CCO\" for ethanol) into 3D `Atoms` objects. \n", "\n", " Documentation: https://rdkit.org/\n", "\n", - " Installation: `conda install -c conda-forge rdkit`\n" + " Installation: `conda install -c conda-forge rdkit`" ] }, { @@ -61,7 +59,7 @@ "\n", "from ase import Atoms\n", "\n", - "from xtb.ase.calculator import XTB\n", + "from tblite.ase import TBLite\n", "\n", "from quippy.potential import Potential\n", "\n", @@ -103,9 +101,9 @@ "\n", "`(Initalizer, [args], {kwargs})`\n", "\n", - "e.g. xtb would normally be called with \n", + "e.g. GFN2-xTB would normally be called with \n", "\n", - "`xtb_calc = XTB(method=\"GFN2-xTB\")`\n", + "`xtb_calc = TBLite(method=\"GFN2-xTB\")`\n", "\n", "but instead in wfl scripts we define it as" ] @@ -116,7 +114,7 @@ "metadata": {}, "outputs": [], "source": [ - "xtb_calc = (XTB, [], {\"method\": \"GFN2-xTB\"})" + "xtb_calc = (TBLite, [], {\"method\": \"GFN2-xTB\"})" ] }, { @@ -673,4 +671,4 @@ }, "nbformat": 4, "nbformat_minor": 2 -} +} \ No newline at end of file diff --git a/docs/source/examples.index.md b/docs/source/examples.index.md index ffd6633b..9331f9b7 100644 --- a/docs/source/examples.index.md +++ b/docs/source/examples.index.md @@ -10,7 +10,7 @@ Examples often show examples of more than one thing. Below is a list of common o - EMT: - [First example](first_example.md) - [Iterative GAP fitting ](examples.mlip_fitting.md) -- XTB: +- GFN2-xTB: - [Normal Modes of molecules](examples.normal_modes.md) - [Molecular Dynamics](examples.md.md) - [GAP fit workflow with many wfl use-case examples ](examples.daisy_chain_mlip_fitting.ipynb) diff --git a/docs/source/examples.md.md b/docs/source/examples.md.md index 7784ca59..0f02424e 100644 --- a/docs/source/examples.md.md +++ b/docs/source/examples.md.md @@ -4,7 +4,7 @@ The following script takes atomic structures from "configs.xyz", runs Berendsen ``` import os -from xtb.ase.calculator import XTB +from tblite.ase import TBLite from expyre.resources import Resources from wfl.autoparallelize import RemoteInfo from wfl.autoparallelize import AutoparaInfo @@ -39,7 +39,7 @@ remote_info = RemoteInfo( pre_cmds = ["conda activate my-env"] ) -calc = (XTB, [], {'method':'GFN2-xTB'}) +calc = (TBLite, [], {'method':'GFN2-xTB'}) ci = ConfigSet(input_fname) co = OutputSpec(out_fname) @@ -49,7 +49,7 @@ co = OutputSpec(out_fname) # script would make it create and submit new jobs rather than monitor the ones already running. os.environ["WFL_DETERMINISTIC_HACK"] = "true" -# xTB has some internal parallelisation that needs turning off by setting this env. variable. +# GFN2-xTB uses OpenMP internally, which clashes with the multiprocessing.pool parallelisation wfl uses, so turn it off. os.environ["OMP_NUM_THREADS"] = "1" ci = md.md( diff --git a/docs/source/examples.normal_modes.md b/docs/source/examples.normal_modes.md index c58abcae..31ec5a9f 100644 --- a/docs/source/examples.normal_modes.md +++ b/docs/source/examples.normal_modes.md @@ -5,11 +5,11 @@ Workflow can numerically generate normal modes of a molecule with specified calc ## Generate -The following script generates normal modes of methane and water with a [xTB](https://xtb-python.readthedocs.io/en/latest/index.html) calculator. The unit normal mode displacements are stored in `Atoms.arrays` and associated frequencies in `Atoms.info`. +The following script generates normal modes of methane and water with a [GFN2-xTB](https://tblite.readthedocs.io/) calculator. The unit normal mode displacements are stored in `Atoms.arrays` and associated frequencies in `Atoms.info`. ```python from ase.build import molecule -from xtb.ase.calculator import XTB +from tblite.ase import TBLite from wfl.configset import ConfigSet, OutputSpec from wfl.generate import normal_modes as nm @@ -17,7 +17,7 @@ mols = [molecule("CH4"), molecule("H2O")] configset = ConfigSet(mols) outputspec = OutputSpec("molecules.normal_modes.xyz") -calc = (XTB, [], {'method':'GFN2-xTB'}) +calc = (TBLite, [], {'method':'GFN2-xTB'}) prop_prefix = 'xtb2_' nm.generate_normal_modes_parallel_hessian(inputs=configset, @@ -34,7 +34,7 @@ To generate normal modes via finite differences, each of N atoms are displaced b ```python from ase.build import molecule -from xtb.ase.calculator import XTB +from tblite.ase import TBLite from wfl.configset import ConfigSet, OutputSpec from wfl.generate import normal_modes as nm from wfl.autoparallelize import AutoparaInfo @@ -43,7 +43,7 @@ mols = [molecule("CH4"), molecule("H2O")] configset = ConfigSet(mols) outputspec = OutputSpec("molecules.normal_modes.xyz") -calc = (XTB, [], {'method':'GFN2-xTB'}) +calc = (TBLite, [], {'method':'GFN2-xTB'}) prop_prefix = 'xtb2_' nm.generate_normal_modes_parallel_atoms(inputs=configset, diff --git a/pyproject.toml b/pyproject.toml index d2300b16..039f0e34 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ name = "wfl" requires-python = ">=3.9" -dependencies = [ "click>=7.0", "numpy<2", "ase>=3.22.1", "pyyaml", "spglib", +dependencies = [ "click>=7.0", "numpy>=1.23", "ase>=3.22.1", "pyyaml", "spglib", "docstring_parser", "expyre-wfl", "universalSOAP", "pandas" ] readme = "README.md" license = { file = "LICENSE" } diff --git a/tests/conda-build/meta.yaml b/tests/conda-build/meta.yaml index 431f88aa..70c333c7 100644 --- a/tests/conda-build/meta.yaml +++ b/tests/conda-build/meta.yaml @@ -22,7 +22,7 @@ requirements: run: - python - - numpy=1.19 + - numpy>=1.23 - ase - scipy - click diff --git a/wfl/generate/supercells.py b/wfl/generate/supercells.py index 4eb1d885..cde13a11 100644 --- a/wfl/generate/supercells.py +++ b/wfl/generate/supercells.py @@ -65,7 +65,7 @@ def _largest_isotropic_supercell(at, max_n_atoms, vary_cell_vectors=None): min_cell_i = np.argmin(np.linalg.norm(t_cell[vary_cell_vectors], axis=1)) min_cell_i = vary_cell_vectors[min_cell_i] n_dups[min_cell_i] += 1 - if np.product(n_dups) * len(at) > max_n_atoms: + if np.prod(n_dups) * len(at) > max_n_atoms: n_dups[min_cell_i] -= 1 break return n_dups diff --git a/wfl/select/flat_histogram.py b/wfl/select/flat_histogram.py index 9fbfc1c3..ac2c4613 100644 --- a/wfl/select/flat_histogram.py +++ b/wfl/select/flat_histogram.py @@ -13,7 +13,7 @@ def _select_by_bin(weights, bin_edges, quantities, n, rng, kT=-1.0, replace=Fals raise ValueError("Not defined for non-positive n") if kT is None or kT <= 0: - kT = np.Infinity + kT = np.inf bin_centers = 0.5 * (bin_edges[:-1] + bin_edges[1:]) bin_centers -= bin_centers[0] diff --git a/wfl/utils/ndim_neighbor_list.py b/wfl/utils/ndim_neighbor_list.py index 7e95183e..eb4cf33c 100644 --- a/wfl/utils/ndim_neighbor_list.py +++ b/wfl/utils/ndim_neighbor_list.py @@ -133,7 +133,7 @@ def calc_list_cells(positions, ranges, Cartesian_distance=True): # First configs in pair. _first_at_neightuple_n = configs_in_bin_ba[:, config_pairs_pn[0]] - for i_offset in range(np.product(2 * neigh_search + 1)): + for i_offset in range(np.prod(2 * neigh_search + 1)): dD = [] for i_dim in range(n_dims): dD.append(i_offset % (2 * neigh_search[i_dim] + 1))