Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DSRG-MRPT2 PySCF implementation #1

Open
wants to merge 87 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
a2a452b
Initial commit
brianz98 Sep 18, 2023
feaafd9
Merge branch 'pyscf:master' into dsrg-mrpt
brianz98 Sep 18, 2023
8ea0617
Infrastructure work
brianz98 Sep 18, 2023
87402a1
Shuhang Li: State-specific spin-adapted DSRG-MRPT2
shuhangli98 Sep 20, 2023
6c4271e
Working SF-DSRG-MRPT2 with no bells and whistles.
brianz98 Sep 22, 2023
f371b6e
Remove DSRG.py
brianz98 Sep 23, 2023
3335f16
Modify test case to use mc2step, add asserts
brianz98 Sep 24, 2023
cf6c338
Enable state-averaging.
brianz98 Sep 24, 2023
20c953b
Enable density fitting and batching.
shuhangli98 Sep 24, 2023
6c03ecd
Merge branch 'dsrg-mrpt' of https://github.com/evangelistalab/pyscf i…
shuhangli98 Sep 24, 2023
22c054e
Small changes
shuhangli98 Oct 1, 2023
a9dced2
Implement partial relaxation
brianz98 Oct 2, 2023
ea2ec45
Fix a few contractions, complete code for partial ref relaxation.
brianz98 Oct 3, 2023
8c5b499
Add state averaing to ref relaxation, remove the 'root' class argumen…
brianz98 Oct 3, 2023
867410b
Small bugfix for SA, standardize einsums.
brianz98 Oct 3, 2023
ee0493a
Code cleanup, preparation for iterative ref relaxation.
brianz98 Oct 3, 2023
8ae3ff4
Density fitting for state-averaging
shuhangli98 Oct 5, 2023
e8036e9
Merge branch 'dsrg-mrpt' of https://github.com/evangelistalab/pyscf i…
shuhangli98 Oct 5, 2023
da3ca56
The V has been changed from ndarray to dictionary for direct computat…
shuhangli98 Oct 5, 2023
300c01b
Implement iterative relaxation, new N2 test.
brianz98 Oct 6, 2023
a626ee6
Set appropriate state averaging parameters automatically, return the …
brianz98 Oct 6, 2023
481f3c0
Change SA warning to error, minor formatting.
brianz98 Oct 6, 2023
b7e4108
Implement .density_fit() method for DSRG
brianz98 Oct 8, 2023
d41933a
Fix reference relaxation for high spin
brianz98 Nov 17, 2023
a4c61ec
Einsum optimize
shuhangli98 Nov 21, 2023
34664ad
Merge origin/master into dsrg-mrpt
brianz98 May 27, 2024
b19e09a
Move tests to dedicated test file
brianz98 Jun 4, 2024
ebfeaf4
Optimize canonicalize
brianz98 Jun 4, 2024
bb8baec
More opt
brianz98 Jun 4, 2024
f1d4445
More opt
brianz98 Jun 4, 2024
ffb2d59
Optimize T2 build
brianz98 Jun 5, 2024
32f525a
Optimize T1 build
brianz98 Jun 5, 2024
25a99cb
Fix race condition
brianz98 Jun 5, 2024
25514fd
Optimize load balanacing for omp
brianz98 Jun 5, 2024
ed9fdab
Optimize DF loops
brianz98 Jun 5, 2024
07b2e82
Optimize renormalize F/V
brianz98 Jun 5, 2024
9940e46
Clean up
brianz98 Jun 5, 2024
b625702
some forte results
shuhangli98 Jun 7, 2024
f7c95cb
add forte results
shuhangli98 Jun 7, 2024
3c36214
Fix relaxation fci solver
brianz98 Jun 10, 2024
fde977a
All tests now validated with Forte and pass
brianz98 Jun 10, 2024
40e73eb
Merge remote-tracking branch 'origin' into dsrg-mrpt
brianz98 Jun 19, 2024
85135cf
Merge remote-tracking branch 'pyscf/master' into dsrg-mrpt
shuhangli98 Jun 23, 2024
19071a4
Merge branch 'master' into dsrg-mrpt
brianz98 Jul 8, 2024
7ba3378
Merge branch 'master' into dsrg-mrpt
shuhangli98 Jul 12, 2024
18bf44a
Merge branch 'master' into dsrg-mrpt
shuhangli98 Jul 22, 2024
d0d36d3
Merge branch 'master' into dsrg-mrpt
shuhangli98 Jul 30, 2024
c67deaa
Fix bug in GHF-X2C dipole function (#2396)
sunqm Sep 7, 2024
3dc4547
Fix FCI wfn symmetry validation code for Dooh symmetry (fix #2383)
sunqm Sep 2, 2024
5a18d3f
Merge branch 'master' into dsrg-mrpt
shuhangli98 Sep 11, 2024
943d39a
fix SymAdaptedGHF.eig for complex orbitals
hczhai Sep 16, 2024
136e416
add int1e_ovlp for fcidump to scf
hczhai Sep 16, 2024
e19c0b7
The missing quadrature adjustment in treutler_ahlrichs radial grids (…
sunqm Sep 26, 2024
ff8d81b
Updates for DF auxiliary basis generation (#2285)
sunqm Sep 26, 2024
410d960
Release 2.7 (#2407)
sunqm Sep 26, 2024
53f5954
Merge branch 'master' into dsrg-mrpt
shuhangli98 Oct 11, 2024
fd6a601
add link to news page
fishjojo Oct 11, 2024
13b6627
Merge pull request #2462 from fishjojo/news
gkc1000 Oct 12, 2024
c305a63
Fix an error in the native interface to the Basis Set Exchange
susilehtola Oct 17, 2024
0ada19a
integral screening for gaunt and breit term (#2437)
xubwa Oct 19, 2024
25eaa95
fix uccsd failing for empty active space
fishjojo Oct 9, 2024
bb9caf7
add ccpy extension
fishjojo Oct 26, 2024
ed8c68d
Improve error message for ao2mo module (fix #2473)
sunqm Oct 20, 2024
d0d0e06
Update 09-band_ase.py
juanjoaucar Oct 16, 2024
77d13c7
Fix compiling issues. Remove the non-standard ffsll function (#2449)
sunqm Oct 27, 2024
4b63d1c
Update test tolerances (#2482)
awvwgk Oct 30, 2024
b519c3d
Adds COSMO-RS functionality (#2480)
IvanChernyshov Oct 30, 2024
e66bb81
`SCFWithSolvent.get_fock` no longer requires specifying `dm` as keywo…
kvkarandashev Oct 29, 2024
c447280
refactor dfmp2 & rpa (#2418)
hongzhouye Nov 4, 2024
6683747
Fixes calculating exchange integrals when only_dfj=True, issue #2456 …
jonas-greiner Nov 4, 2024
360e6b7
Update 04-input_basis.py
steto123 Nov 7, 2024
13c9926
Add minimally augmented basis sets
awvwgk Nov 8, 2024
3214578
Fix dump_chk in UCASSCF (fix #2432)
sunqm Nov 4, 2024
74840cd
Integer overflow due to the type casting issue in numpy-2.0 (fix #2481)
sunqm Nov 4, 2024
6c37a90
Periodic stability analysis update to match with molecular version
ethanvo Oct 24, 2024
1761a03
Fix: add missing conj() to t2 amps in init_amps of gccsd and uccsd ro…
rhkim79 Nov 9, 2024
09b7f59
fix mp2 compile errors (#2511)
chillenb Nov 10, 2024
a19bb91
limit effects of NumPy 2 type promotion
chillenb Nov 9, 2024
0968f0d
Add functions to read and write Cell geometry including lattice vecto…
tberkel Nov 10, 2024
008b8a9
Parallel in-place matrix transposition and scaling (#2507)
chillenb Nov 10, 2024
2c7f762
Add def2-mtzvp and def2-mtzvpp basis sets for 3c methods
awvwgk Nov 10, 2024
903aacb
Fix iterative damping error (#2524)
mkrompiec Nov 16, 2024
8420273
Update the blacklist of dispersion correction
wxj6000 Nov 18, 2024
612d956
some lightweight array helper functions (#2515)
chillenb Nov 25, 2024
8215a21
Fix biased implementation for the becke radi method (#2499)
tvogels Nov 25, 2024
9f8fe30
Verify Examples (#2379)
matthew-hennefarth Nov 25, 2024
5cdaeae
Merge branch 'master' into dsrg-mrpt
shuhangli98 Dec 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/ci_conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI_conda

on:
workflow_dispatch:

jobs:
build-conda-linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Setup conda
uses: s-weigand/setup-conda@v1
with:
update-conda: true
conda-channels: conda-forge
- run: conda --version
- run: which python
- name: Build conda package
run: |
export CMAKE_BUILD_PARALLEL_LEVEL=4
conda install -y conda-build
conda config --set anaconda_upload False
conda build --output-folder . conda
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
strategy:
fail-fast: false
env:
img: quay.io/pypa/manylinux2014_aarch64:2023-03-12-25fd859
img: quay.io/pypa/manylinux2014_aarch64:latest
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
38 changes: 38 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
PySCF 2.7.0 (2024-09-23)
------------------------
* Added
- Superposition of Atomic Potentials (SAP) initial guess for SCF methods.
- Supports pickle serialization for all methods.
- ADC 1-particle density matrix and dipole moment.
- Spin-separated 3-RDMs.
- Traceless quadrupole moment for SCF methods.
- Supports for fractional coordinates in Cell.
- Population analysis for KSCF.
- A, B matrices for k-point TDRKS.
- AutoAux scheme for generating auxiliary basis sets.
* Improved
- Automatic cleanup for HDF5 temporary files.
- Saves CI coefficients for SA-CASSCF to chkfile.
- UHF/UKS initial guess with better spin-symmetry breaking code.
- New attribute .cycles in SCF methods and CC methods to save iteration counts.
- FFT performance.
- CPHF convergence in nuclear hessian.
- Eigenvalue solver for linear response theory.
- Enhance TDDFT code with symmetry adaptation in diagonalization.
- More efficient PBC-CDERI loading.
* Fixes
- The missing atomic radius parameters for the Treutler-Ahlrichs scheme in DFT grids
- Symmetry adapted GHF with complex orbitals.
- Complex-valued FCI matvec operation.
- Bug in Smearing-RHF for odd number of electrons and disable Smearing-ROHF.
- MP2 FNO bug when pct_occ=1 .
- DHF dipole moment.
- Bug in PBC ECP integral.
- Bug in parser for spin-orbit ECPs.
- Wrong transition dipoles of triplet TDDFT states.
- GHF-X2C dipole moment.
- FCI symmetry validation code for cylindrical symmetry.
- Missing complex conjugation for complex orbitals in SymAdaptedGHF.
- Custom UHF objects using the Hamiltonian in FCIDUMP.


PySCF 2.6.2 (2024-06-19)
------------------------
* Fixes
Expand Down
2 changes: 2 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ Christopher Hillenbrand
scohenjanes5
Michal Krompiec
Victor Yu
James Serna (The Ohio State University)
Brian Zhao


---
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ Python-based Simulations of Chemistry Framework
[![Build Status](https://github.com/pyscf/pyscf/workflows/CI/badge.svg)](https://github.com/pyscf/pyscf/actions?query=workflow%3ACI)
[![codecov](https://codecov.io/gh/pyscf/pyscf/branch/master/graph/badge.svg)](https://codecov.io/gh/pyscf/pyscf)

2024-06-19
2024-09-23

* [Stable release 2.6.2](https://github.com/pyscf/pyscf/releases/tag/v2.6.2)
* [Stable release 2.7.0](https://github.com/pyscf/pyscf/releases/tag/v2.7.0)
* [Changelog](../master/CHANGELOG)
* [Documentation](http://www.pyscf.org)
* [Installation](#installation)
* [Features](../master/FEATURES)
* [News](https://pyscf.org/news.html): **2nd PySCF Developers Meeting!**


# Installation
Expand Down
5 changes: 5 additions & 0 deletions examples/df/01-auxbasis.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,8 @@
mf.with_df.auxbasis = df.aug_etb(mol, beta=1.7)
mf.kernel()

# Generating auxiliary basis using the AutoAux algorithms proposed by Stoychev
# (JCTC, 13, 554)
mf = scf.RHF(mol).density_fit()
mf.with_df.auxbasis = df.auto_aux(mol)
mf.kernel()
2 changes: 1 addition & 1 deletion examples/gto/04-input_basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
mol = gto.M(
atom = '''O 0 0 0; H1 0 1 0; H2 0 0 1''',
basis = {'O': gto.parse('''
# Parse NWChem format basis string (see https://bse.pnl.gov/bse/portal).
# Parse NWChem format basis string (see https://www.basissetexchange.org/).
# Comment lines are ignored
#BASIS SET: (6s,3p) -> [2s,1p]
O S
Expand Down
16 changes: 16 additions & 0 deletions examples/gto/31-basis_set_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,22 @@
a local copy of the Basis Set Exchange.
'''

# PySCF has a native interface to the Basis Set Exchange, which is
# used as a fall-through if the basis set was not found within PySCF
# itself
mol = gto.M(
atom = '''
N 0.6683566134 0.2004327755 0.0000000000
H 0.9668193796 -0.3441960976 0.8071193402
H 0.9668193796 -0.3441960976 -0.8071193402
F -0.7347916126 -0.0467759204 0.0000000000
''',
basis = 'HGBSP1-7',
verbose = 4
)


# One can also use the Basis Set Exchange in a more direct fashion
mol = gto.M(
atom = '''
N 0.6683566134 0.2004327755 0.0000000000
Expand Down
48 changes: 48 additions & 0 deletions examples/pbc/01-input_output_geometry.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env python

'''
This example demonstrates some ways to input the Cell geometry, including
lattice vectors, and to write the Cell geometry to file.

Example solid is wurtzite BN.
'''

from pyscf.pbc import gto

# Input Cartesian coordinates for the lattice vectors a and the atomic
# positions. Coordinates are in Angstrom by default

cell = gto.Cell()
cell.a = [[ 2.5539395809, 0.0000000000, 0.0000000000],
[ -1.2769697905, 2.2117765568, 0.0000000000],
[ 0.0000000000, 0.0000000000, 4.2268548012]]
cell.atom = '''
B 1.276969829 0.737258874 4.225688066
N 1.276969829 0.737258874 2.642950986
B 0.000000000 1.474517748 2.112260792
N 0.000000000 1.474517748 0.529523459
'''
cell.pseudo = 'gth-pade'
cell.basis = 'gth-szv'
cell.build()

# Write cell geometry to file
# - Format is guessed from filename
# - These can be read by VESTA, Avogadro, etc.
# - XYZ is Extended XYZ file format, which includes lattice vectors in the
# comment line
cell.tofile('bn.vasp')
cell.tofile('POSCAR')
cell.tofile('bn.xyz')

# Read a and atom from file
from pyscf.pbc.gto.cell import fromfile
a, atom = fromfile('bn.vasp')
a, atom = fromfile('bn.xyz')

# Read a and atom from file directly into Cell
cell = gto.Cell()
cell.fromfile('bn.vasp')
cell.pseudo = 'gth-pade'
cell.basis = 'gth-szv'
cell.build()
2 changes: 1 addition & 1 deletion examples/pbc/09-band_ase.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import matplotlib.pyplot as plt

from ase.lattice import bulk
from ase.build import bulk
from ase.dft.kpoints import sc_special_points as special_points, get_bandpath

c = bulk('C', 'diamond', a=3.5668)
Expand Down
11 changes: 10 additions & 1 deletion examples/solvent/05-pcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,13 @@
td.kernel()

mf = mol.RHF().PCM().run()
td = mf.TDA().run()
td = mf.TDA().run()

# infinite epsilon with any PCM computations
cm = pcm.PCM(mol)
cm.eps = float('inf') # ideal conductor
mf = dft.RKS(mol, xc='b3lyp')
mf = mf.PCM(cm)
mf.kernel()


115 changes: 115 additions & 0 deletions examples/solvent/07-cosmors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#!/usr/bin/env python
'''
An example of using COSMO-RS functionality.
'''

#%% Imports

import io

import numpy as np
import matplotlib.pyplot as plt

from pyscf import gto, dft
from pyscf.solvent import pcm
from pyscf.solvent.cosmors import get_sas_volume
from pyscf.solvent.cosmors import write_cosmo_file
from pyscf.solvent.cosmors import get_cosmors_parameters


#%% Set parameters

# get molecule
coords = '''
C 0.000000 0.000000 -0.542500
O 0.000000 0.000000 0.677500
H 0.000000 0.9353074360871938 -1.082500
H 0.000000 -0.9353074360871938 -1.082500
'''
mol = gto.M(atom=coords, basis='6-31G*', verbose=1)

# configure PCM
cm = pcm.PCM(mol)
cm.eps = float('inf') # f_epsilon = 1 is required for COSMO-RS
cm.method = 'C-PCM' # or COSMO, IEF-PCM, SS(V)PE, see https://manual.q-chem.com/5.4/topic_pcm-em.html
cm.lebedev_order = 29 # lebedev grids on the cavity surface, lebedev_order=29 <--> # of grids = 302


#%% COSMO-files

# run DFT SCF (any level of theory is OK, though DFT is optimal)
mf = dft.RKS(mol, xc='b3lyp')
mf = mf.PCM(cm)
mf.kernel()

# generate COSMO-file
with io.StringIO() as outp: # with open('formaldehyde.cosmo', 'w') as outf:
write_cosmo_file(outp, mf)
print(outp.getvalue())


# if PCM DFT were computed with fepsilon < 1 <=> eps != inf the ValueError will be raised
# use ignore_low_feps=True to overrule it, but please be sure you know what you're doing

# run DFT SCF
cm = pcm.PCM(mol)
cm.eps = 32.613 # methanol
mf = dft.RKS(mol, xc='b3lyp')
mf = mf.PCM(cm)
mf.kernel()

# try to get COSMO-file
with io.StringIO() as outp:
try:
write_cosmo_file(outp, mf)
print(outp.getvalue())
except ValueError as e:
print(e)

# overruling
with io.StringIO() as outp:
write_cosmo_file(outp, mf, ignore_low_feps=True)
print(outp.getvalue())


# The molecular volume is computed for the solvent-accessible surface generated
# within pcm.PCM object. Please note that r_sol is assumed to be equal to zero,
# so that SAS is a union of vdW spheres.
# Increasing integration step increases accuracy of integration, but for most COSMO-RS
# modelling and ML step=0.2 should be enough:

# compute volumes with different step values
steps = [1.0, 0.5, 0.2, 0.1, 0.05, 0.02, 0.01]
Vs = [get_sas_volume(mf.with_solvent.surface, step) for step in steps]
# plot
ax = plt.gca()
ax.plot(Vs)
ax.set_xticks(range(len(steps)))
_ = ax.set_xticklabels(steps)
plt.show()


#%% Sigma-profiles

# compute SCF PCM
cm = pcm.PCM(mol)
cm.eps = float('inf')
mf = dft.RKS(mol, xc='b3lyp')
mf = mf.PCM(cm)
mf.kernel()

# compute sigma-profile and related parameters
params = get_cosmors_parameters(mf)
print(params)
plt.plot(params['Screening charge, e/A**2'],
params['Screening charge density, A**2'])
plt.show()

# custom sigma grid
sigmas_grid = np.linspace(-0.025, 0.025, 101)
params = get_cosmors_parameters(mf, sigmas_grid)
plt.plot(params['Screening charge, e/A**2'],
params['Screening charge density, A**2'])
plt.show()


1 change: 1 addition & 0 deletions examples/tools/01-fcidump.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,4 @@
mf.mol.verbose = 4
mf.run()
mf.MP2().run()
mf.to_uhf().newton().run()
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ cppe = ["cppe"]
pyqmc = ["pyqmc"]
bse = ["basis-set-exchange"]
dispersion = ["pyscf-dispersion"]
ccpy = ["coupled-cluster-py"]

all = ["pyscf[forge,geomopt,doci,properties,semiempirical,cppe,pyqmc,bse,dispersion]"]
all = ["pyscf[forge,geomopt,doci,properties,semiempirical,cppe,pyqmc,bse,dispersion,ccpy]"]

# extras which should not be installed by "all" components
cornell_shci = ["pyscf-cornell-shci"]
Expand Down
2 changes: 1 addition & 1 deletion pyscf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

'''

__version__ = '2.6.2'
__version__ = '2.7.0'

import os
import sys
Expand Down
Loading
Loading