Skip to content

CI for py312

CI for py312 #616

Workflow file for this run

name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
schedule:
- cron: "9 16 * * 1"
jobs:
build:
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
cfg:
- conda-env: psi-cf
python-version: "3.12"
label: Psi4-cf
runs-on: ubuntu-latest
- conda-env: psi-cf
python-version: "3.12"
label: Psi4-cf
runs-on: windows-latest
name: "🐍 ${{ matrix.cfg.python-version }} • ${{ matrix.cfg.label }} • ${{ matrix.cfg.runs-on }}"
runs-on: ${{ matrix.cfg.runs-on }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create Environment
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test
environment-file: devtools/conda-envs/${{ matrix.cfg.conda-env }}.yaml
python-version: ${{ matrix.cfg.python-version }}
auto-activate-base: false
show-channel-urls: true
miniforge-variant: Mambaforge
use-mamba: true
add-pip-as-python-dependency: true
# note: conda-forge chnl req'd for Mambaforge, but we'll spec in file, not here `channels: conda-forge,...`
# note: any activate/deactivate use the conda cmd. other cmds use mamba cmd.
- name: Special Config - NWChem
if: "(matrix.cfg.label == 'NWChem')"
run: |
sudo apt-get -y install nwchem
- name: Special Config - QCore
if: "(matrix.cfg.label == 'QCore')"
run: |
qcore --accept-license
# note: psi4 on c-f pins to a single qcel and qcng, so this may be handy for solve-and-replace
#- name: Special Config - QCElemental Dep
# if: (matrix.cfg.label == 'ADCC')
# run: |
# conda remove qcelemental --force
# python -m pip install qcelemental>=0.26.0 --no-deps
- name: Special Config - QCElemental Dep
run: |
conda remove qcelemental --force
python -m pip install 'git+https://github.com/MolSSI/QCElemental.git@loriab-patch-2' --no-deps
# note: conda remove --force, not mamba remove --force b/c https://github.com/mamba-org/mamba/issues/412
# alt. is micromamba but not yet ready for setup-miniconda https://github.com/conda-incubator/setup-miniconda/issues/75
- name: Special Config - QCEngine Dep
if: "(matrix.cfg.label == 'Psi4-nightly') || (matrix.cfg.label == 'ADCC') || (matrix.cfg.label == 'optimization-dispersion')"
run: |
conda remove qcengine --force
# QCEngine CI and Psi4 are circularly dependent, so a hack is in order
- name: Special Config - Faux Pydantic Upgrade
if: "((matrix.cfg.label == 'Psi4-nightly') || (matrix.cfg.label == 'optimization-dispersion')) && (runner.os != 'Windows')"
run: |
sed -i s/from\ pydantic\ /from\ pydantic.v1\ /g ${CONDA_PREFIX}/lib/python${{ matrix.cfg.python-version }}/site-packages/psi4/driver/*py
- name: Environment Information
run: |
mamba info
mamba list
- name: Install QCEngine
run: |
python -m pip install . --no-deps
- name: Which Testing
run: |
python -c 'import qcelemental as qcel; print(qcel.util.which("psi4.bat"))'
python -c 'import qcelemental as qcel; print(qcel.util.which("psi4.exe"))'
python -c 'import qcelemental as qcel; print(qcel.util.which("psi4"))'
python -c 'import qcelemental as qcel; print(qcel.util.which("ls"))'
python -c "import qcengine as qcng; pf = qcng.get_program('psi4'); print(pf.found(), pf.get_version())"
- name: QCEngineRecords
if: false
run: |
qcengine info
export QCER_VER=`python -c "import qcengine.testing; print(qcengine.testing.QCENGINE_RECORDS_COMMIT)"`
pip install git+https://github.com/MolSSI/QCEngineRecords.git@${QCER_VER}#egg=qcenginerecords
python -c "import qcengine; print(qcengine.config.global_repr())"
- name: Misc A
run: |
cat > labelfailA.py <<EOF
import pprint
import qcelemental as qcel
from qcelemental.testing import compare, compare_values
import qcengine as qcng
import psi4
kmol = qcel.models.Molecule.from_data(
"""
H 0 0 0
H5 5 0 0
H_other 0 5 0
H_4sq 5 5 0
units au
"""
)
assert compare(["H", "H", "H", "H"], kmol.symbols, "elem")
assert compare(["", "5", "_other", "_4sq"], kmol.atom_labels, "elbl")
atin = qcel.models.AtomicInput(
**{"molecule": kmol, "model": {"method": "mp2", "basis": "aug-cc-pvdz"}, "driver": "energy", "keywords": {"scf_type": "pk", "mp2_type": "conv"}}
)
atres = psi4.schema_wrapper.run_qcschema(atin)
#atres = qcng.compute(atin, "psi4")
pprint.pprint(atres.dict(), width=200)
nre = 1.0828427
assert compare_values(
nre, atres.properties.nuclear_repulsion_energy, atol=1.0e-4, label="nre"
), f"nre: {atres.properties.nuclear_repulsion_energy} != {nre}"
nmo = 36
assert compare(nmo, atres.properties.calcinfo_nmo, label="nmo"), f"nmo: {atres.properties.calcinfo_nmo} != {nmo}"
scf = -1.656138508
scf_alt = -1.705577613 # some versions of NWChem land on this value
mp2 = -1.7926264513
mp2_alt = -1.870251459939
assert compare_values(
scf, atres.properties.scf_total_energy, atol=3.0e-6, label="scf ene"
), f"scf ene: {atres.properties.scf_total_energy} != {scf}"
EOF
python labelfailA.py
- name: Misc D
run: |
cat > labelfailD.py <<EOF
import pprint
from pathlib import Path
import qcelemental as qcel
from qcelemental.testing import compare, compare_values
import qcengine as qcng
import psi4
kmol = qcel.models.Molecule.from_data(
"""
H 0 0 0
H5 5 0 0
H_other 0 5 0
H_4sq 5 5 0
units au
"""
)
assert compare(["H", "H", "H", "H"], kmol.symbols, "elem")
assert compare(["", "5", "_other", "_4sq"], kmol.atom_labels, "elbl")
atin = qcel.models.AtomicInput(
**{"molecule": kmol, "model": {"method": "mp2", "basis": "aug-cc-pvdz"}, "driver": "energy", "keywords": {"scf_type": "pk", "mp2_type": "conv"}}
)
input_files = {"dataD.json": atin.json()}
run_cmd = [qcel.util.which("psi4"), "--qcschema", "dataD.json"]
print(f"{run_cmd=}")
success, output = qcng.util.execute(run_cmd, input_files, ["dataD.json"])
print("BBBB", success, output)
print("CCCC", qcel.util.deserialize(output["outfiles"]["dataD.json"], "json"))
EOF
python labelfailD.py
- name: Misc E
run: |
cat > labelfailE.py <<EOF
import pprint
from pathlib import Path
import qcelemental as qcel
from qcelemental.testing import compare, compare_values
import qcengine as qcng
import psi4
kmol = qcel.models.Molecule.from_data(
"""
H 0 0 0
H5 5 0 0
H_other 0 5 0
H_4sq 5 5 0
units au
"""
)
assert compare(["H", "H", "H", "H"], kmol.symbols, "elem")
assert compare(["", "5", "_other", "_4sq"], kmol.atom_labels, "elbl")
atin = qcel.models.AtomicInput(
**{"molecule": kmol, "model": {"method": "mp2", "basis": "aug-cc-pvdz"}, "driver": "energy", "keywords": {"scf_type": "pk", "mp2_type": "conv"}}
)
input_files = {"dataE.json": atin.json()}
run_cmd = [qcel.util.which("psi4"), "--qcschema", "dataE.json", "--nthread", "2", "--memory", "1.0GiB"]
print(f"{run_cmd=}")
success, output = qcng.util.execute(run_cmd, input_files, ["dataE.json"])
print("BBBB", success, output)
print("CCCC", qcel.util.deserialize(output["outfiles"]["dataE.json"], "json"))
EOF
python labelfailE.py
- name: Misc F
run: |
cat > labelfailF.py <<EOF
import pprint
from pathlib import Path
import qcelemental as qcel
from qcelemental.testing import compare, compare_values
import qcengine as qcng
import psi4
kmol = qcel.models.Molecule.from_data(
"""
H 0 0 0
H5 5 0 0
H_other 0 5 0
H_4sq 5 5 0
units au
"""
)
assert compare(["H", "H", "H", "H"], kmol.symbols, "elem")
assert compare(["", "5", "_other", "_4sq"], kmol.atom_labels, "elbl")
atin = qcel.models.AtomicInput(
**{"molecule": kmol, "model": {"method": "mp2", "basis": "aug-cc-pvdz"}, "driver": "energy", "keywords": {"scf_type": "pk", "mp2_type": "conv"}}
)
input_files = {"dataF.msgpack": atin.serialize("msgpack-ext")}
run_cmd = [qcel.util.which("psi4"), "--qcschema", "dataF.msgpack"]
print(f"{run_cmd=}")
success, output = qcng.util.execute(run_cmd, input_files, ["dataF.msgpack"], as_binary=["dataF.msgpack"])
print("BBBB", success, output)
print("CCCC", qcel.util.deserialize(output["outfiles"]["dataF.msgpack"], "msgpack-ext"))
EOF
python labelfailF.py
- name: Misc G
run: |
cat > labelfailG.py <<EOF
import pprint
from pathlib import Path
import qcelemental as qcel
from qcelemental.testing import compare, compare_values
import qcengine as qcng
import psi4
kmol = qcel.models.Molecule.from_data(
"""
H 0 0 0
H5 5 0 0
H_other 0 5 0
H_4sq 5 5 0
units au
"""
)
assert compare(["H", "H", "H", "H"], kmol.symbols, "elem")
assert compare(["", "5", "_other", "_4sq"], kmol.atom_labels, "elbl")
atin = qcel.models.AtomicInput(
**{"molecule": kmol, "model": {"method": "mp2", "basis": "aug-cc-pvdz"}, "driver": "energy", "keywords": {"scf_type": "pk", "mp2_type": "conv"}}
)
input_files = {"dataG.msgpack": atin.serialize("msgpack-ext")}
run_cmd = [qcel.util.which("psi4"), '--nthread', '1', '--memory', '2.375GiB', '--qcschema', 'dataG.msgpack']
print(f"{run_cmd=}")
success, output = qcng.util.execute(run_cmd, input_files, ["dataG.msgpack"], as_binary=["dataG.msgpack"])
print("BBBB", success, output)
print("CCCC", qcel.util.deserialize(output["outfiles"]["dataG.msgpack"], "msgpack-ext"))
EOF
python labelfailG.py
- name: Misc H
run: |
cat > labelfailH.py <<EOF
import pprint
from pathlib import Path
import qcelemental as qcel
from qcelemental.testing import compare, compare_values
import qcengine as qcng
import psi4
kmol = qcel.models.Molecule.from_data(
"""
H 0 0 0
H5 5 0 0
H_other 0 5 0
H_4sq 5 5 0
units au
"""
)
assert compare(["H", "H", "H", "H"], kmol.symbols, "elem")
assert compare(["", "5", "_other", "_4sq"], kmol.atom_labels, "elbl")
atin = qcel.models.AtomicInput(
**{"molecule": kmol, "model": {"method": "mp2", "basis": "aug-cc-pvdz"}, "driver": "energy", "keywords": {"scf_type": "pk", "mp2_type": "conv"}}
)
input_files = {"dataH.msgpack": atin.serialize("msgpack-ext")}
with qcng.util.temporary_directory(suffix="_psi_scratch", messy=True) as tmpdir:
run_cmd = [qcel.util.which("psi4"), '--nthread', '1', '--memory', '2.375GiB', '--qcschema', 'dataH.msgpack', '--messy', "--scratch", str(tmpdir)]
print(f"{run_cmd=}")
success, output = qcng.util.execute(run_cmd, input_files, ["dataH.msgpack"], as_binary=["dataH.msgpack"],
scratch_directory=tmpdir)
print("BBBB", success, output)
print("CCCC", qcel.util.deserialize(output["outfiles"]["dataH.msgpack"], "msgpack-ext"))
EOF
python labelfailH.py
- name: Misc I
run: |
cat > labelfailI.py <<EOF
import pprint
from pathlib import Path
import qcelemental as qcel
from qcelemental.testing import compare, compare_values
import qcengine as qcng
import psi4
kmol = qcel.models.Molecule.from_data(
"""
H 0 0 0
H5 5 0 0
H_other 0 5 0
H_4sq 5 5 0
units au
"""
)
assert compare(["H", "H", "H", "H"], kmol.symbols, "elem")
assert compare(["", "5", "_other", "_4sq"], kmol.atom_labels, "elbl")
atin = qcel.models.AtomicInput(
**{"molecule": kmol, "model": {"method": "mp2", "basis": "aug-cc-pvdz"}, "driver": "energy", "keywords": {"scf_type": "pk", "mp2_type": "conv"}}
)
input_files = {"dataI.msgpack": atin.serialize("msgpack-ext")}
with qcng.util.temporary_directory(suffix="_psi_scratch", messy=False) as tmpdir:
run_cmd = [qcel.util.which("psi4"), '--nthread', '1', '--memory', '2.375GiB', '--qcschema', 'dataI.msgpack', "--scratch", str(tmpdir)]
print(f"{run_cmd=}")
success, output = qcng.util.execute(run_cmd, input_files, ["dataI.msgpack"], as_binary=["dataI.msgpack"],
scratch_directory=tmpdir)
print("BBBB", success, output)
print("CCCC", qcel.util.deserialize(output["outfiles"]["dataI.msgpack"], "msgpack-ext"))
EOF
python labelfailI.py
- name: Misc J
run: |
cat > labelfailJ.py <<EOF
import pprint
import qcelemental as qcel
from qcelemental.testing import compare, compare_values
import qcengine as qcng
import psi4
kmol = qcel.models.Molecule.from_data(
"""
H 0 0 0
H5 5 0 0
H_other 0 5 0
H_4sq 5 5 0
units au
"""
)
assert compare(["H", "H", "H", "H"], kmol.symbols, "elem")
assert compare(["", "5", "_other", "_4sq"], kmol.atom_labels, "elbl")
atin = qcel.models.AtomicInput(
**{"molecule": kmol, "model": {"method": "mp2", "basis": "aug-cc-pvdz"}, "driver": "energy", "keywords": {"scf_type": "pk", "mp2_type": "conv"}}
)
#atres = psi4.schema_wrapper.run_qcschema(atin)
atres = qcng.compute(atin, "psi4", task_config={"scratch_messy": True})
pprint.pprint(atres.dict(), width=200)
nre = 1.0828427
assert compare_values(
nre, atres.properties.nuclear_repulsion_energy, atol=1.0e-4, label="nre"
), f"nre: {atres.properties.nuclear_repulsion_energy} != {nre}"
nmo = 36
assert compare(nmo, atres.properties.calcinfo_nmo, label="nmo"), f"nmo: {atres.properties.calcinfo_nmo} != {nmo}"
scf = -1.656138508
scf_alt = -1.705577613 # some versions of NWChem land on this value
mp2 = -1.7926264513
mp2_alt = -1.870251459939
assert compare_values(
scf, atres.properties.scf_total_energy, atol=3.0e-6, label="scf ene"
), f"scf ene: {atres.properties.scf_total_energy} != {scf}"
EOF
python labelfailJ.py
- name: Misc C
run: |
cat > labelfailC.py <<EOF
import pprint
import qcelemental as qcel
from qcelemental.testing import compare, compare_values
import qcengine as qcng
import psi4
kmol = qcel.models.Molecule.from_data(
"""
H 0 0 0
H5 5 0 0
H_other 0 5 0
H_4sq 5 5 0
units au
"""
)
assert compare(["H", "H", "H", "H"], kmol.symbols, "elem")
assert compare(["", "5", "_other", "_4sq"], kmol.atom_labels, "elbl")
atin = qcel.models.AtomicInput(
**{"molecule": kmol, "model": {"method": "mp2", "basis": "aug-cc-pvdz"}, "driver": "energy", "keywords": {"scf_type": "pk", "mp2_type": "conv"}}
)
#atres = psi4.schema_wrapper.run_qcschema(atin)
atres = qcng.compute(atin, "psi4")
pprint.pprint(atres.dict(), width=200)
nre = 1.0828427
assert compare_values(
nre, atres.properties.nuclear_repulsion_energy, atol=1.0e-4, label="nre"
), f"nre: {atres.properties.nuclear_repulsion_energy} != {nre}"
nmo = 36
assert compare(nmo, atres.properties.calcinfo_nmo, label="nmo"), f"nmo: {atres.properties.calcinfo_nmo} != {nmo}"
scf = -1.656138508
scf_alt = -1.705577613 # some versions of NWChem land on this value
mp2 = -1.7926264513
mp2_alt = -1.870251459939
assert compare_values(
scf, atres.properties.scf_total_energy, atol=3.0e-6, label="scf ene"
), f"scf ene: {atres.properties.scf_total_energy} != {scf}"
EOF
python labelfailC.py
- name: Misc B
run: |
cat > labelfailB.py <<EOF
import pprint
import qcelemental as qcel
from qcelemental.testing import compare, compare_values
import qcengine as qcng
import psi4
kmol = qcel.models.Molecule.from_data(
"""
H 0 0 0
H5 5 0 0
H_other 0 5 0
H_4sq 5 5 0
units au
"""
)
assert compare(["H", "H", "H", "H"], kmol.symbols, "elem")
assert compare(["", "5", "_other", "_4sq"], kmol.atom_labels, "elbl")
atin = qcel.models.AtomicInput(
**{"molecule": kmol, "model": {"method": "mp2", "basis": "aug-cc-pvdz"}, "driver": "energy", "keywords": {"scf_type": "pk", "mp2_type": "conv"}, "extras": {"psiapi": True}}
)
#atres = psi4.schema_wrapper.run_qcschema(atin)
atres = qcng.compute(atin, "psi4")
pprint.pprint(atres.dict(), width=200)
nre = 1.0828427
assert compare_values(
nre, atres.properties.nuclear_repulsion_energy, atol=1.0e-4, label="nre"
), f"nre: {atres.properties.nuclear_repulsion_energy} != {nre}"
nmo = 36
assert compare(nmo, atres.properties.calcinfo_nmo, label="nmo"), f"nmo: {atres.properties.calcinfo_nmo} != {nmo}"
scf = -1.656138508
scf_alt = -1.705577613 # some versions of NWChem land on this value
mp2 = -1.7926264513
mp2_alt = -1.870251459939
assert compare_values(
scf, atres.properties.scf_total_energy, atol=3.0e-6, label="scf ene"
), f"scf ene: {atres.properties.scf_total_energy} != {scf}"
EOF
python labelfailB.py
- name: PyTest
run: |
pytest -rws -v --cov=qcengine -k "label" --color=yes --cov-report=xml qcengine/
- name: CodeCov
uses: codecov/codecov-action@v3
release_sphinx:
needs: [build]
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
cfg:
- conda-env: docs-cf
python-version: 3.8
label: Sphinx
runs-on: ubuntu-latest
name: "🐍 ${{ matrix.cfg.python-version }} • ${{ matrix.cfg.label }}"
runs-on: ${{ matrix.cfg.runs-on }}
steps:
- uses: actions/checkout@v3
- name: Create Environment
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test
environment-file: devtools/conda-envs/${{ matrix.cfg.conda-env }}.yaml
python-version: ${{ matrix.cfg.python-version }}
auto-activate-base: false
miniforge-variant: Mambaforge
use-mamba: true
add-pip-as-python-dependency: true
channels: conda-forge
- name: Environment Information
run: |
mamba info
mamba list --show-channel-urls
- name: Build Documentation
run: |
python -m pip install . --no-deps
cd docs
make html
- name: GitHub Pages Deploy
uses: JamesIves/[email protected]
if: github.event_name == 'push' && github.repository == 'MolSSI/QCEngine' && ( startsWith( github.ref, 'refs/tags/' ) || github.ref == 'refs/heads/master' )
with:
branch: gh-pages
folder: docs/build/html