Skip to content

Commit

Permalink
added soc test
Browse files Browse the repository at this point in the history
  • Loading branch information
ankit76 committed Apr 19, 2022
1 parent e74f183 commit 18e199d
Show file tree
Hide file tree
Showing 9 changed files with 322 additions and 1 deletion.
Binary file added test/DQMC/ghf_soc/FCIDUMP_chol
Binary file not shown.
21 changes: 21 additions & 0 deletions test/DQMC/ghf_soc/afqmc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"system": {
"integrals": "FCIDUMP_chol",
"soc": true
},
"wavefunction": {
"left": "ghf",
"right": "ghf"
},
"sampling": {
"seed": 4321,
"phaseless": true,
"dt": 0.005,
"nsteps": 50,
"nwalk": 5,
"stochasticIter": 50,
"choleskyThreshold": 0.001,
"orthoSteps": 20
},
"print": {}
}
114 changes: 114 additions & 0 deletions test/DQMC/ghf_soc/afqmc.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
User:
anma2640
Hostname:
bhpc-c7-u31-21.rc.int.colorado.edu
CPU info:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 36
On-line CPU(s) list: 0-35
Thread(s) per core: 1
Core(s) per socket: 18
Socket(s): 2
NUMA node(s): 2
Vendor ID: GenuineIntel
CPU family: 6
Model: 85
Model name: Intel(R) Xeon(R) Gold 6254 CPU @ 3.10GHz
Stepping: 7
CPU MHz: 3100.000
Computation started at:
Tue Apr 19 17:33:56 MDT 2022
git commit: d0990d8b710e46f71aa2fae46d2becc5320edffa, branch: dqmc, compiled at: Tue Apr 19 13:44:52 MDT 2022

nproc used: 4 (NB: stochasticIter below is per proc)

**************************************************************
Input file :
**************************************************************
{
"system": {
"integrals": "FCIDUMP_chol",
"soc": "true"
},
"wavefunction": {
"left": "ghf",
"right": "ghf"
},
"sampling": {
"seed": "4321",
"phaseless": "true",
"dt": "0.005",
"nsteps": "50",
"nwalk": "5",
"stochasticIter": "50",
"choleskyThreshold": "0.001",
"orthoSteps": "20"
},
"print": ""
}

Number of orbitals: 32, nelec: 17
Initial state energy: -152.93842
Number of Cholesky vectors: 195
Using GHF RDM for background subtraction

block propTime eshift weight energy cumulative_energy walltime
0 0.000e+00 -1.52938e+02 2.00000e+01 -1.529384164e+02 - 2.62e-02
1 2.500e-01 -1.53169e+02 2.02316e+01 -1.532320405e+02 - 1.87e-01
2 5.000e-01 -1.53179e+02 2.02125e+01 -1.532712523e+02 - 3.45e-01
3 7.500e-01 -1.53116e+02 2.01182e+01 -1.532073469e+02 - 4.98e-01
4 1.000e+00 -1.53161e+02 2.01427e+01 -1.531992769e+02 - 6.54e-01
5 1.250e+00 -1.53017e+02 1.99803e+01 -1.532396050e+02 - 8.10e-01
6 1.500e+00 -1.53176e+02 2.01186e+01 -1.532225518e+02 - 9.64e-01
7 1.750e+00 -1.53254e+02 2.01810e+01 -1.531774576e+02 - 1.12e+00
8 2.000e+00 -1.53077e+02 1.99926e+01 -1.531876098e+02 - 1.27e+00
9 2.250e+00 -1.53087e+02 1.99925e+01 -1.531388056e+02 - 1.42e+00
10 2.500e+00 -1.53121e+02 2.00223e+01 -1.531669869e+02 - 1.58e+00
11 2.750e+00 -1.53559e+02 2.04586e+01 -1.531657489e+02 - 1.73e+00
12 3.000e+00 -1.53229e+02 2.01179e+01 -1.531903438e+02 - 1.88e+00
13 3.250e+00 -1.53135e+02 2.00149e+01 -1.531667844e+02 - 2.04e+00
14 3.500e+00 -1.53173e+02 2.00486e+01 -1.532445238e+02 - 2.20e+00
15 3.750e+00 -1.53295e+02 2.01591e+01 -1.533224381e+02 - 2.35e+00
16 4.000e+00 -1.53216e+02 2.00608e+01 -1.532436037e+02 - 2.50e+00
17 4.250e+00 -1.53066e+02 1.99024e+01 -1.531626617e+02 - 2.66e+00
18 4.500e+00 -1.52815e+02 1.96540e+01 -1.532095162e+02 - 2.81e+00
19 4.750e+00 -1.53429e+02 2.02624e+01 -1.532160456e+02 - 2.96e+00
20 5.000e+00 -1.53079e+02 1.99058e+01 -1.532231987e+02 - 3.11e+00
21 5.250e+00 -1.53082e+02 1.99039e+01 -1.531855899e+02 - 3.27e+00
22 5.500e+00 -1.53129e+02 1.99506e+01 -1.531797165e+02 - 3.43e+00
23 5.750e+00 -1.53170e+02 1.99912e+01 -1.531986923e+02 - 3.58e+00
24 6.000e+00 -1.53303e+02 2.01221e+01 -1.532120185e+02 - 3.74e+00
25 6.250e+00 -1.53265e+02 2.00811e+01 -1.532275184e+02 - 3.90e+00
26 6.500e+00 -1.53034e+02 1.98465e+01 -1.531431433e+02 - 4.06e+00
27 6.750e+00 -1.53287e+02 2.01039e+01 -1.532012375e+02 - 4.21e+00
28 7.000e+00 -1.52914e+02 1.97303e+01 -1.531939443e+02 - 4.37e+00
29 7.250e+00 -1.53383e+02 2.01971e+01 -1.532559897e+02 - 4.52e+00
30 7.500e+00 -1.53198e+02 2.00049e+01 -1.531289634e+02 - 4.68e+00
31 7.750e+00 -1.53321e+02 2.01343e+01 -1.532168249e+02 - 4.84e+00
32 8.000e+00 -1.53340e+02 2.01511e+01 -1.532950894e+02 - 4.99e+00
33 8.250e+00 -1.53129e+02 1.99284e+01 -1.532969961e+02 - 5.15e+00
34 8.500e+00 -1.53160e+02 1.99496e+01 -1.532096244e+02 - 5.31e+00
35 8.750e+00 -1.53294e+02 2.00842e+01 -1.531718897e+02 - 5.46e+00
36 9.000e+00 -1.53290e+02 2.00843e+01 -1.532282671e+02 - 5.62e+00
37 9.250e+00 -1.52969e+02 1.97623e+01 -1.532305774e+02 - 5.77e+00
38 9.500e+00 -1.53224e+02 2.00130e+01 -1.532694444e+02 - 5.93e+00
39 9.750e+00 -1.53460e+02 2.02448e+01 -1.532487465e+02 - 6.09e+00
40 1.000e+01 -1.53249e+02 2.00292e+01 -1.532564904e+02 -1.532564904e+02 6.25e+00
41 1.025e+01 -1.53303e+02 2.00796e+01 -1.531494776e+02 -1.532029167e+02 6.40e+00
42 1.050e+01 -1.53123e+02 1.99076e+01 -1.531605556e+02 -1.531888654e+02 6.56e+00
43 1.075e+01 -1.53336e+02 2.01258e+01 -1.532441179e+02 -1.532027408e+02 6.72e+00
44 1.100e+01 -1.53175e+02 1.99609e+01 -1.532935625e+02 -1.532208509e+02 6.87e+00
45 1.125e+01 -1.53263e+02 2.00407e+01 -1.532852303e+02 -1.532315898e+02 7.03e+00
46 1.150e+01 -1.53074e+02 1.98467e+01 -1.532406721e+02 -1.532328774e+02 7.19e+00
47 1.175e+01 -1.53246e+02 2.00167e+01 -1.533137526e+02 -1.532429948e+02 7.34e+00
48 1.200e+01 -1.53328e+02 2.00906e+01 -1.532223615e+02 -1.532406931e+02 7.50e+00
49 1.225e+01 -1.53106e+02 1.98701e+01 -1.533379637e+02 -1.532503585e+02 7.66e+00

Propagation time: 6.9570725 s
Energy evaluation time: 0.67865086 s

Number of large deviations: 0

Total calculation time: 7.8553782 s
55 changes: 55 additions & 0 deletions test/DQMC/ghf_soc/br.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env python
import os,sys,numpy
from pyscf import gto, scf, lib, tools, ao2mo, mcscf
import h5py
import QMCUtils
import numpy as np
import scipy.linalg as la

mol = gto.M(atom = 'Br 0 0 0', basis = 'crenbl', ecp = 'crenbl', symmetry=1, spin = 1)
mf = scf.ROHF(mol)
mf.irrep_nelec = {'A1g':(2,2), 'A1u':(1,0), 'E1ux':(1,1), 'E1uy':(1,1), 'E2gx':(1,1), 'E2gy':(1,1), 'E1gx':(1,1), 'E1gy':(1,1)}
mf.level_shift = 0.1
mf.kernel()
mo_coeff = mf.mo_coeff

mol.symmetry = 0
gmf = scf.GHF(mol)
#mf.with_soc = True
s = .5 * lib.PauliMatrices
ecpso = -1j * lib.einsum('sxy,spq->xpyq', s, mol.intor('ECPso'))
hcore = gmf.get_hcore()
hcore = hcore + ecpso.reshape(hcore.shape)
gmf.get_hcore = lambda *args: hcore
norb = mol.nao
ncore = (sum(mol.nelec) - 5)//2

# diagonalize soc ham in p space to get initial guess for ghf
porbs = numpy.zeros((2*norb, 6))
for i in range(3):
porbs[:norb, 2*i] = mo_coeff[:, ncore + i]
porbs[norb:, 2*i+1] = mo_coeff[:, ncore + i]
soc_ham = porbs.T.dot(ecpso.reshape(hcore.shape)).dot(porbs)
soc_e, soc_c = numpy.linalg.eigh(soc_ham)

soc_orbs = porbs.dot(soc_c)
ghf_coeffs_guess = numpy.zeros((2*norb, sum(mol.nelec))) * 1.j
ghf_coeffs_guess[:norb, :ncore] = mo_coeff[:, :ncore]
ghf_coeffs_guess[norb:, ncore:2*ncore] = mo_coeff[:, :ncore]

# ground state
for i in range(5):
ghf_coeffs_guess[:, 2*ncore+i] = soc_orbs[:, i]
dm = ghf_coeffs_guess.dot(ghf_coeffs_guess.T.conj())
gmf.level_shift = 0.2
gmf.max_cycle = 100
gmf.kernel(dm0=dm)

# write ghf coeffs
overlap = gmf.get_ovlp(mol)
basis = la.block_diag(mo_coeff, mo_coeff)
ghfCoeffs = basis.T.dot(overlap).dot(gmf.mo_coeff)
QMCUtils.writeMat(ghfCoeffs, "ghf.txt", True)

QMCUtils.prepAFQMC_soc(mol, mf, ecpso.reshape(2*norb, 2*norb))
QMCUtils.write_afqmc_input(seed = 4321, soc=True, left="ghf", right="ghf", nwalk=10, stochasticIter=50, choleskyThreshold=1.e-3, fname="afqmc.json")
Loading

0 comments on commit 18e199d

Please sign in to comment.