Skip to content

Commit

Permalink
Resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
basilib committed Sep 2, 2022
2 parents e4b743a + c952ae4 commit 274effd
Show file tree
Hide file tree
Showing 284 changed files with 38,202 additions and 16,630 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
yum install -y epel-release && \
yum-config-manager --enable epel && \
yum install -y openblas-devel gcc cmake curl && \
cd ./pyscf/lib && curl -o deps.tar.gz -L "https://github.com/kkyusuke/pyscf-build-deps/blob/master/pyscf-2.1a-aarch64-deps.tar.gz?raw=true" && \
cd ./pyscf/lib && curl -o deps.tar.gz -L "https://github.com/pyscf/pyscf-build-deps/blob/master/pyscf-2.1-aarch64-deps.tar.gz?raw=true" && \
tar xzf deps.tar.gz && \
mkdir build && cd build && \
cmake -DBUILD_LIBXC=OFF -DBUILD_XCFUN=OFF -DBUILD_LIBCINT=OFF .. && \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_linux/build_pyscf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

cd ./pyscf/lib
curl -L "https://github.com/pyscf/pyscf-build-deps/blob/master/pyscf-2.1a-deps.tar.gz?raw=true" | tar xzf -
curl -L "https://github.com/pyscf/pyscf-build-deps/blob/master/pyscf-2.1-deps.tar.gz?raw=true" | tar xzf -
mkdir build; cd build
cmake -DBUILD_LIBXC=OFF -DBUILD_XCFUN=OFF -DBUILD_LIBCINT=OFF ..
make -j4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci_linux/python_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
python -m pip install --upgrade pip
pip install "numpy!=1.16,!=1.17" "scipy!=1.5" h5py pytest pytest-cov pytest-timer codecov
pip install pyberny geometric
pip install spglib

#cppe
version=$(python -c 'import sys; version=sys.version_info[:2]; print("{0}.{1}".format(*version))')
Expand Down
4 changes: 2 additions & 2 deletions examples/adc/03-closed_shell_different_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@

#IP-RADC(2) for 3 roots
myadc.verbose = 4
myadcip = adc.radc.RADCIP(myadc)
myadcip = adc.radc_ip.RADCIP(myadc)
eip,vip,pip,xip = myadcip.kernel(nroots=3)

#EA-RADC(3) for 3 roots
myadc.method = "adc(3)"
myadc.kernel_gs()
myadcea = adc.radc.RADCEA(myadc)
myadcea = adc.radc_ea.RADCEA(myadc)
eea,vea,pea,xea = myadcea.kernel(nroots=3)

#Analyze eigenvectors only
Expand Down
2 changes: 1 addition & 1 deletion examples/dft/24-define_xc_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def eval_xc(xc_code, rho, spin=0, relativity=0, deriv=1, verbose=None):
rho0, dx, dy, dz = rho[:4]
gamma = (dx**2 + dy**2 + dz**2)
exc = .01 * rho0**2 + .02 * (gamma+.001)**.5
vrho = .01 * 2 * rho0
vrho = .01 * 3 * rho0**2 + .02 * (gamma+.001)**.5
vgamma = .02 * .5 * (gamma+.001)**(-.5)
vlapl = None
vtau = None
Expand Down
7 changes: 3 additions & 4 deletions examples/gto/02-dump_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
'''
Mute input dumping
Input file is dump at the beginning of the output by default. Siwtch it off
by setting dump_input=False. Also the command line arguments can be ignored
Input file is dump at the beginning of the output by default. Switch it off
by setting dump_input=False. Also the command line arguments can be ignored
if parse_arg=False.
dump_input and parse_arg are the first two arguments of the Mole.build
function. They can be turned off by short notation .build(0, 0). This trick
function. They can be turned off by short notation .build(0, 0). This trick
can be found many places in the package.
'''

Expand All @@ -25,4 +25,3 @@
)

mol.build(0, 0)

81 changes: 81 additions & 0 deletions examples/pbc/20-k_points_scf_ksymm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/usr/bin/env python

'''
Mean field with k-points sampling when Brillouin Zone symmetry is considered
'''

import numpy
from pyscf.pbc import gto, scf, dft

cell = gto.M(
a = numpy.asarray([[0.0, 2.6935121974, 2.6935121974],
[2.6935121974, 0.0, 2.6935121974],
[2.6935121974, 2.6935121974, 0.0]]),
atom = '''Si 0.0000000000 0.0000000000 0.0000000000
Si 1.3467560987 1.3467560987 1.3467560987''',
basis = 'gth-szv',
pseudo = 'gth-pade',
mesh = [24,24,24],
verbose = 5,
)

nk = [2,2,2]
#The Brillouin Zone symmetry info is contained in the kpts object
#symmorphic: if True, only the symmorphic subgroup is considered
kpts = cell.make_kpts(nk,
space_group_symmetry=True,
time_reversal_symmetry=True,
symmorphic=True)
print(kpts)

kmf = scf.KRHF(cell, kpts)
kmf.kernel()

kmf = dft.KRKS(cell, kpts)
kmf.xc = 'camb3lyp'
kmf.kernel()

#
# The mean-field object with k-point symmetry can be converted back to
# the correponding non-symmetric mean-field object
#

kmf = kmf.to_khf()
kmf.kernel(kmf.make_rdm1())

#
# Second order SCF solver can be used in the PBC SCF code the same way in the
# molecular calculation
#
kmf = scf.KRHF(cell, kpts).newton()
kmf.kernel()

#
#KUHF
#
kumf = scf.KUHF(cell, kpts)
kumf.kernel()

#
# The mean-field object with k-point symmetry can be converted back to
# the correponding non-symmetric mean-field object
#
kumf = kumf.to_khf()
kumf.kernel(kumf.make_rdm1())

#
#KUHF with smearing
#
cell.spin = 2 * 2**3 #assume S=1 in each cell
kumf = scf.KUHF(cell, kpts)
#fix_spin:
# if True:
# the final solution will have the same spin as input
# if False:
# alpha and beta orbitals are sorted together based on energies,
# and the final solution can have different spin from input
#
#Note: when gap is small, symmetry broken solution is usually the case,
# which should be computed by turning off the symmstry options
kumf = scf.addons.smearing_(kumf, sigma=0.001, method='fermi',fix_spin=True)
kumf.kernel()
2 changes: 1 addition & 1 deletion examples/pbc/22-k_points_mp2.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python

'''
MP2 at an individual k-point
MP2 with k-points sampling
'''

from functools import reduce
Expand Down
32 changes: 32 additions & 0 deletions examples/pbc/22-k_points_mp2_ksymm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env python

'''
MP2 with k-points sampling when Brillouin Zone symmetry is considered
'''

import numpy
from pyscf.pbc import gto, scf, mp

cell = gto.M(
a = numpy.asarray([[0.0, 2.6935121974, 2.6935121974],
[2.6935121974, 0.0, 2.6935121974],
[2.6935121974, 2.6935121974, 0.0]]),
atom = '''Si 0.0000000000 0.0000000000 0.0000000000
Si 1.3467560987 1.3467560987 1.3467560987''',
basis = 'gth-szv',
pseudo = 'gth-pade',
mesh = [24,24,24],
verbose = 5,
)

nk = [2,2,2]
kpts = cell.make_kpts(nk,
space_group_symmetry=True,
time_reversal_symmetry=True)

kmf = scf.KRHF(cell, kpts)
kmf.kernel()

kmp2 = mp.KMP2(kmf)
kmp2.kernel()
print("KMP2 energy (per unit cell) =", kmp2.e_tot)
149 changes: 149 additions & 0 deletions examples/pbc/22-k_points_mp2_stagger.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
#!/usr/bin/env python

'''
Example code for
k-point spin-restricted periodic MP2 calculation using staggered mesh method
Author: Xin Xing ([email protected])
Reference: Staggered Mesh Method for Correlation Energy Calculations of Solids:
Second-Order Møller-Plesset Perturbation Theory, J. Chem. Theory
Comput. 2021, 17, 8, 4733-4745
'''


from pyscf.pbc.mp.kmp2_stagger import KMP2_stagger
from pyscf.pbc import df, gto, scf, mp


'''
Hydrogen dimer
'''
cell = gto.Cell()
cell.pseudo = 'gth-pade'
cell.basis = 'gth-szv'
cell.ke_cutoff = 100
cell.atom = '''
H 3.00 3.00 2.10
H 3.00 3.00 3.90
'''
cell.a = '''
6.0 0.0 0.0
0.0 6.0 0.0
0.0 0.0 6.0
'''
cell.unit = 'B'
cell.verbose = 4
cell.build()


# HF calculation using FFTDF
nks_mf = [2, 2, 2]
kpts = cell.make_kpts(nks_mf, with_gamma_point=True)
kmf = scf.KRHF(cell, kpts, exxdiv='ewald')
ehf = kmf.kernel()

# staggered mesh KMP2 using two 1*1*1 submeshes in kmf.kpts
kmp = KMP2_stagger(kmf, flag_submesh=True)
emp2 = kmp.kernel()
assert((abs(emp2 - -0.0160902544091997)) < 1e-5)

# staggered mesh KMP2 using two 2*2*2 submeshes based on non-SCF
kmp = KMP2_stagger(kmf, flag_submesh=False)
emp2 = kmp.kernel()
assert((abs(emp2 - -0.0140289970302513)) < 1e-5)

# standard KMP2 calculation
kmp = mp.KMP2(kmf)
emp2, _ = kmp.kernel()
assert((abs(emp2 - -0.0143904878990777)) < 1e-5)


# HF calculation using GDF
nks_mf = [2, 2, 2]
kpts = cell.make_kpts(nks_mf, with_gamma_point=True)
kmf = scf.KRHF(cell, kpts, exxdiv='ewald')
kmf.with_df = df.GDF(cell, kpts).build()
ehf = kmf.kernel()

# staggered mesh KMP2 using two 1*1*1 submeshes in kmf.kpts
kmp = KMP2_stagger(kmf, flag_submesh=True)
emp2 = kmp.kernel()
assert((abs(emp2 - -0.0158364523431071)) < 1e-5)

# staggered mesh KMP2 using two 2*2*2 submeshes based on non-SCF
kmp = KMP2_stagger(kmf, flag_submesh=False)
emp2 = kmp.kernel()
assert((abs(emp2 - -0.0140280303691396)) < 1e-5)

# standard KMP2 calculation
kmp = mp.KMP2(kmf)
emp2, _ = kmp.kernel()
assert((abs(emp2 - -0.0141829343769316)) < 1e-5)


'''
Diamond system
'''

cell = gto.Cell()
cell.pseudo = 'gth-pade'
cell.basis = 'gth-szv'
cell.ke_cutoff = 100
cell.atom = '''
C 0. 0. 0.
C 1.26349729, 0.7294805 , 0.51582061
'''
cell.a = '''
2.52699457, 0. , 0.
1.26349729, 2.18844149, 0.
1.26349729, 0.7294805 , 2.06328243
'''
cell.unit = 'angstrom'
cell.verbose = 4
cell.build()


# HF calculation using FFTDF
nks_mf = [2, 2, 2]
kpts = cell.make_kpts(nks_mf, with_gamma_point=True)
kmf = scf.KRHF(cell, kpts, exxdiv='ewald')
ehf = kmf.kernel()

# staggered mesh KMP2 using two 1*1*1 submeshes in kmf.kpts
kmp = KMP2_stagger(kmf, flag_submesh=True)
emp2 = kmp.kernel()
assert((abs(emp2 - -0.156289981810986)) < 1e-5)

# staggered mesh KMP2 using two 2*2*2 submeshes based on non-SCF
kmp = KMP2_stagger(kmf, flag_submesh=False)
emp2 = kmp.kernel()
assert((abs(emp2 - -0.105454107635884)) < 1e-5)

# standard KMP2 calculation
kmp = mp.KMP2(kmf)
emp2, _ = kmp.kernel()
assert((abs(emp2 - -0.095517731535516)) < 1e-5)


# HF calculation using GDF
nks_mf = [2, 2, 2]
kpts = cell.make_kpts(nks_mf, with_gamma_point=True)
kmf = scf.KRHF(cell, kpts, exxdiv='ewald')
kmf.with_df = df.GDF(cell, kpts).build()
ehf = kmf.kernel()

# staggered mesh KMP2 using two 1*1*1 submeshes in kmf.kpts
kmp = KMP2_stagger(kmf, flag_submesh=True)
emp2 = kmp.kernel()
assert((abs(emp2 - -0.154923152683604)) < 1e-5)

# staggered mesh KMP2 using two 2*2*2 submeshes based on non-SCF
kmp = KMP2_stagger(kmf, flag_submesh=False)
emp2 = kmp.kernel()
assert((abs(emp2 - -0.105421948003715)) < 1e-5)

# standard KMP2 calculation
kmp = mp.KMP2(kmf)
emp2, _ = kmp.kernel()
assert((abs(emp2 - -0.0952009565805345)) < 1e-5)
4 changes: 2 additions & 2 deletions examples/pbc/24-k_points_vs_gamma.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
'''

import numpy as np
from pyscf import cc
from pyscf.pbc import cc as pbccc
from pyscf.pbc import scf as pbchf
from pyscf.pbc import gto
Expand Down Expand Up @@ -34,7 +33,8 @@
mf.kernel()
supcell_energy = mf.energy_tot() / np.prod(nmp)

mycc = cc.RCCSD(mf)
# A wrapper calling molecular CC method for gamma point calculation.
mycc = pbccc.RCCSD(mf)
gccsd_energy = mycc.ccsd()[0] / np.prod(nmp)
eip, wip = mycc.ipccsd(nroots=2)
eea, wea = mycc.eaccsd(nroots=2)
Expand Down
Loading

0 comments on commit 274effd

Please sign in to comment.