Skip to content

Commit ad5be6f

Browse files
authored
Improvements to the Sparse classes (evangelistalab#386)
* Coded alpha creation transposition * Coded operator product * Add test case * Introduce new class * Implemented a commutator function * Transitioned to unordered_map * Implement commutator * Implemented similarity transformation on the C++ side * Implemented low-level similarity transformation * Improved printing * Implement second version of operator product * Algorithmic improvements * Megalorewrite * Fixed some tests * Fixed some more tests * Fixed tutorials * Some work on exponential code * Improved screening in SparseExp * Implement faster function to apply operator to state * Simplified SparseFactExp class * Add comments * Use templated class for SparseState * Rename files * Fix some test cases * Fixed bug in ci occupation code * Merge fixes to GHA from Brian and fix issues * Add missing header * Add limits header * Add missing <functional> include to sq_operator_string.h * Clean before test * Switch to forte methods tests * Run on one thread * Print failed tests * Add python * Relax energy test * Update tests
1 parent 8cc280f commit ad5be6f

File tree

71 files changed

+6416
-3430
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+6416
-3430
lines changed
+51-21
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,64 @@
11
name: Python Package using Conda
22

3-
on: [push]
3+
on: [push, pull_request]
44

55
jobs:
66
build-linux:
77
runs-on: ubuntu-latest
8-
strategy:
9-
max-parallel: 5
8+
defaults:
9+
run:
10+
shell: bash -el {0}
1011

1112
steps:
12-
- uses: actions/checkout@v3
13-
- name: Set up Python 3.10
14-
uses: actions/setup-python@v3
13+
- name: Checkout code
14+
uses: actions/checkout@v4
1515
with:
16-
python-version: '3.10'
17-
- name: Add conda to system path
18-
run: |
19-
# $CONDA is an environment variable pointing to the root of the miniconda directory
20-
echo $CONDA/bin >> $GITHUB_PATH
21-
- name: Install dependencies
16+
submodules: 'true'
17+
18+
- name: Setup Conda
19+
uses: conda-incubator/setup-miniconda@v3
20+
with:
21+
activate-environment: forte
22+
environment-file: environment.yml
23+
channels: conda-forge
24+
show-channel-urls: true
25+
python-version: '3.11'
26+
auto-activate-base: false
27+
add-pip-as-python-dependency: true
28+
29+
- name: Install ambit
2230
run: |
23-
conda env update --file environment.yml --name base
24-
- name: Lint with flake8
31+
conda info
32+
conda list
33+
cd $HOME
34+
git clone https://github.com/jturney/ambit.git
35+
cd ambit
36+
cmake -H. -Bobjdir -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$HOME/bin/ambit
37+
cd objdir
38+
make -j4
39+
make install
40+
41+
- name: Compile psi4
2542
run: |
26-
conda install flake8
27-
# stop the build if there are Python syntax errors or undefined names
28-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
29-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
30-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
31-
- name: Test with pytest
43+
cd $HOME
44+
git clone https://github.com/psi4/psi4.git
45+
cd psi4
46+
git pull origin master --tags
47+
git fetch origin "refs/tags/*:refs/tags/*"
48+
cmake -H. -Bobjdir -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$HOME/psi4bin -DENABLE_ecpint=ON
49+
cd objdir
50+
make -j4
51+
52+
- name: Compile forte
3253
run: |
33-
conda install pytest
54+
export PYTHONPATH=$PYTHONPATH:$HOME/psi4/objdir/stage/lib:$HOME/bin/ambit/lib
55+
export AMBITPATH=$HOME/bin/ambit
56+
export PATH=$PATH:$HOME/psi4/objdir/stage/bin
57+
cd $HOME/work/forte/forte
58+
python setup.py develop
59+
pip list
60+
# cd $HOME/work/forte/forte/tests/pytest
3461
# pytest
62+
export OPENBLAS_NUM_THREADS=1
63+
cd $HOME/work/forte/forte/tests/methods
64+
python run_forte_tests.py --failed_dump --bw

environment.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: forte
2+
3+
dependencies:
4+
- python=3.11
5+
- pip
6+
- pybind11
7+
- cxx-compiler
8+
- mkl
9+
- cmake
10+
- numpy
11+
- scipy
12+
- eigen
13+
- boost
14+
- pint
15+
- pydantic
16+
- pyyaml
17+
- py-cpuinfo
18+
- hdf5
19+
- yaml
20+
- pytest
21+
- conda-forge::lcov
22+
- conda-forge::libint
23+
- conda-forge::libxc
24+
- psi4::gau2grid
25+
- conda-forge::qcelemental
26+
- conda-forge::qcengine
27+
- conda-forge::optking
28+

forte/CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,9 @@ sparse_ci/sparse_operator.cc
253253
sparse_ci/sparse_exp.cc
254254
sparse_ci/sparse_fact_exp.cc
255255
sparse_ci/sparse_hamiltonian.cc
256-
sparse_ci/sq_operator.cc
257-
sparse_ci/sparse_state_vector.cc
256+
sparse_ci/sq_operator_string.cc
257+
sparse_ci/sq_operator_string_ops.cc
258+
sparse_ci/sparse_state.cc
258259
v2rdm/v2rdm.cc
259260
)
260261

forte/api/active_space_integrals_api.cc

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ void export_ActiveSpaceIntegrals(py::module& m) {
4343
"ActiveSpaceIntegrals")
4444
.def("slater_rules", &ActiveSpaceIntegrals::slater_rules,
4545
"Compute the matrix element of the Hamiltonian between two determinants")
46+
.def("energy", &ActiveSpaceIntegrals::energy, "Return the energy of a determinant")
4647
.def("nuclear_repulsion_energy", &ActiveSpaceIntegrals::nuclear_repulsion_energy,
4748
"Get the nuclear repulsion energy")
4849
.def("frozen_core_energy", &ActiveSpaceIntegrals::frozen_core_energy,

0 commit comments

Comments
 (0)