Skip to content

Commit

Permalink
added some afqmc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ankit76 committed Apr 19, 2022
1 parent d2bd1eb commit 8997aa8
Show file tree
Hide file tree
Showing 51 changed files with 1,674 additions and 40 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ Note that the Boost libraries (mpi and serializtion) have to be compiled with th
```
make bin/DQMC -j
```

There are two phaseless AFQMC examples in the "examples" directory along with output files that can be used to make sure that the code is working correctly. The python scripts used in these examples require python 3.6 or newer. They also require pyscf and pandas packages. Tests to be added soon!
Tests can be run using the runDQMC.sh script in the "test" directory. Examples of phaseless AFQMC calculations are in the "examples" directory along with output files. The python scripts used in these examples require python 3.6 or newer. They also require pyscf and pandas packages.


## Compiling other parts of the code
Expand Down
Binary file added test/DQMC/multislater_rhf/FCIDUMP_chol
Binary file not shown.
24 changes: 24 additions & 0 deletions test/DQMC/multislater_rhf/afqmc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"system": {
"integrals": "FCIDUMP_chol",
"numAct": 8,
"numCore": 2
},
"wavefunction": {
"left": "multislater",
"right": "rhf",
"determinants": "dets.bin",
"ndets": 500
},
"sampling": {
"seed": 4321,
"phaseless": true,
"dt": 0.005,
"nsteps": 50,
"nwalk": 5,
"stochasticIter": 50,
"choleskyThreshold": 0.001,
"orthoSteps": 20
},
"print": {}
}
120 changes: 120 additions & 0 deletions test/DQMC/multislater_rhf/afqmc.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
User:
anma2640
Hostname:
bhpc-c7-u31-3.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 00:58:51 MDT 2022
git commit: a4aeb963eb2b6d57a28fe1affda42364be597046, branch: master, compiled at: Tue Apr 19 00:04:06 MDT 2022

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

**************************************************************
Input file :
**************************************************************
{
"system": {
"integrals": "FCIDUMP_chol",
"numAct": "8",
"numCore": "2"
},
"wavefunction": {
"left": "multislater",
"right": "rhf",
"determinants": "dets.bin",
"ndets": "500"
},
"sampling": {
"seed": "4321",
"phaseless": "true",
"dt": "0.005",
"nsteps": "50",
"nwalk": "5",
"stochasticIter": "50",
"choleskyThreshold": "0.001",
"orthoSteps": "20"
},
"print": ""
}

Number of orbitals: 18, nalpha: 7, nbeta: 7
Rankwise number of excitations 1 2 51 96 154 68 16 0 0 0
Number of determinants 388

Initial state energy: (-109.01618,0)
Number of Cholesky vectors: 92
Using HF RDM for background subtraction

block propTime eshift weight energy cumulative_energy walltime
0 0.000e+00 -1.09016e+02 2.00000e+01 -1.090161826e+02 - 6.36e-02
1 2.500e-01 -1.09038e+02 2.00214e+01 -1.090550889e+02 - 2.09e-01
2 5.000e-01 -1.09109e+02 2.00896e+01 -1.091256091e+02 - 3.54e-01
3 7.500e-01 -1.09188e+02 2.01584e+01 -1.091007397e+02 - 4.97e-01
4 1.000e+00 -1.09051e+02 2.00136e+01 -1.090770242e+02 - 6.36e-01
5 1.250e+00 -1.09075e+02 2.00331e+01 -1.090808221e+02 - 7.75e-01
6 1.500e+00 -1.08956e+02 1.99106e+01 -1.090729119e+02 - 9.18e-01
7 1.750e+00 -1.09036e+02 1.99883e+01 -1.090730521e+02 - 1.06e+00
8 2.000e+00 -1.09052e+02 2.00014e+01 -1.090650408e+02 - 1.20e+00
9 2.250e+00 -1.08997e+02 1.99446e+01 -1.090842348e+02 - 1.34e+00
10 2.500e+00 -1.09090e+02 2.00348e+01 -1.090663175e+02 - 1.48e+00
11 2.750e+00 -1.09080e+02 2.00240e+01 -1.090600745e+02 - 1.63e+00
12 3.000e+00 -1.09001e+02 1.99438e+01 -1.090876186e+02 - 1.77e+00
13 3.250e+00 -1.09078e+02 2.00179e+01 -1.090973997e+02 - 1.92e+00
14 3.500e+00 -1.09117e+02 2.00538e+01 -1.090829927e+02 - 2.06e+00
15 3.750e+00 -1.09100e+02 2.00349e+01 -1.090739289e+02 - 2.21e+00
16 4.000e+00 -1.09103e+02 2.00368e+01 -1.090879410e+02 - 2.35e+00
17 4.250e+00 -1.09119e+02 2.00508e+01 -1.091172499e+02 - 2.49e+00
18 4.500e+00 -1.09072e+02 1.99988e+01 -1.091060362e+02 - 2.64e+00
19 4.750e+00 -1.09051e+02 1.99742e+01 -1.090932040e+02 - 2.78e+00
20 5.000e+00 -1.09079e+02 2.00008e+01 -1.090964995e+02 - 2.93e+00
21 5.250e+00 -1.09095e+02 2.00150e+01 -1.090856913e+02 - 3.07e+00
22 5.500e+00 -1.09070e+02 1.99890e+01 -1.090969899e+02 - 3.22e+00
23 5.750e+00 -1.09135e+02 2.00525e+01 -1.090709987e+02 - 3.36e+00
24 6.000e+00 -1.09013e+02 1.99320e+01 -1.090672659e+02 - 3.50e+00
25 6.250e+00 -1.08953e+02 1.98731e+01 -1.090660569e+02 - 3.64e+00
26 6.500e+00 -1.08979e+02 1.99009e+01 -1.090785767e+02 - 3.78e+00
27 6.750e+00 -1.09065e+02 1.99865e+01 -1.090980377e+02 - 3.92e+00
28 7.000e+00 -1.09110e+02 2.00292e+01 -1.091069325e+02 - 4.07e+00
29 7.250e+00 -1.09098e+02 2.00146e+01 -1.091128553e+02 - 4.21e+00
30 7.500e+00 -1.09137e+02 2.00511e+01 -1.090982835e+02 - 4.36e+00
31 7.750e+00 -1.09105e+02 2.00174e+01 -1.090899178e+02 - 4.50e+00
32 8.000e+00 -1.09056e+02 1.99690e+01 -1.090910311e+02 - 4.65e+00
33 8.250e+00 -1.09045e+02 1.99574e+01 -1.090883312e+02 - 4.79e+00
34 8.500e+00 -1.09088e+02 2.00005e+01 -1.091021249e+02 - 4.93e+00
35 8.750e+00 -1.09121e+02 2.00319e+01 -1.090860015e+02 - 5.08e+00
36 9.000e+00 -1.09097e+02 2.00078e+01 -1.090642364e+02 - 5.22e+00
37 9.250e+00 -1.09149e+02 2.00621e+01 -1.091105952e+02 - 5.37e+00
38 9.500e+00 -1.09148e+02 2.00595e+01 -1.091062376e+02 - 5.51e+00
39 9.750e+00 -1.08985e+02 1.98943e+01 -1.090836337e+02 - 5.66e+00
40 1.000e+01 -1.09082e+02 1.99921e+01 -1.091194522e+02 -1.091194522e+02 5.80e+00
41 1.025e+01 -1.09091e+02 1.99984e+01 -1.091172530e+02 -1.091183524e+02 5.94e+00
42 1.050e+01 -1.09124e+02 2.00287e+01 -1.090939032e+02 -1.091101936e+02 6.08e+00
43 1.075e+01 -1.09103e+02 2.00083e+01 -1.090877645e+02 -1.091045859e+02 6.23e+00
44 1.100e+01 -1.09007e+02 1.99130e+01 -1.090945124e+02 -1.091025788e+02 6.37e+00
45 1.125e+01 -1.09085e+02 1.99901e+01 -1.091105981e+02 -1.091039155e+02 6.52e+00
46 1.150e+01 -1.09101e+02 2.00053e+01 -1.090940140e+02 -1.091024999e+02 6.66e+00
47 1.175e+01 -1.08966e+02 1.98703e+01 -1.090839873e+02 -1.091001981e+02 6.81e+00
48 1.200e+01 -1.08999e+02 1.99044e+01 -1.091020305e+02 -1.091004010e+02 6.95e+00
49 1.225e+01 -1.09079e+02 1.99840e+01 -1.090951118e+02 -1.090998717e+02 7.10e+00

Propagation time: 3.9513144 s
Energy evaluation time: 3.1104367 s

Number of large deviations: 0

Total calculation time: 7.2891331 s
Binary file added test/DQMC/multislater_rhf/dets.bin
Binary file not shown.
58 changes: 58 additions & 0 deletions test/DQMC/multislater_rhf/n2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import sys, os
import numpy
from pyscf import gto, scf, mcscf, fci, ao2mo, lib, tools, cc
from pyscf.shciscf import shci
import QMCUtils

# these need to be provided
nproc = 8
dice_binary = "/projects/anma2640/newDice/Dice/Dice"
vmc_root = "/projects/anma2640/VMC/master/VMC"

# build your molecule
r = 2.0
atomstring = f"N 0 0 {-r/2}; N 0 0 {r/2}"
mol = gto.M(atom = atomstring, basis='6-31g', unit='bohr', symmetry=1)
mf = scf.RHF(mol)
mf.kernel()

# casscf
mc0 = mcscf.CASSCF(mf, 8, 10)
mc0.mc1step()

# dice

# writing input and integrals
print("\nPreparing Dice calculation")
# dummy shciscf object for specifying options
mc = shci.SHCISCF(mf, 8, 10)
mc.mo_coeff = mc0.mo_coeff
mc.fcisolver.sweep_iter = [ 0 ]
mc.fcisolver.sweep_epsilon = [ 1e-5 ]
mc.fcisolver.davidsonTol = 5.e-5
mc.fcisolver.dE = 1.e-6
mc.fcisolver.maxiter = 6
mc.fcisolver.nPTiter = 0
mc.fcisolver.DoRDM = False
shci.dryrun(mc, mc.mo_coeff)
command = "mv input.dat dice.dat"
os.system(command)
with open("dice.dat", "a") as fh:
fh.write("writebestdeterminants 1000")

# run dice calculation
print("Starting Dice calculation")
command = f"mpirun -np {nproc} {dice_binary} dice.dat > dice.out; rm -f shci.e"
os.system(command)
print("Finished Dice calculation\n")

# afqmc
print("Preparing AFQMC calculation")
rhfCoeffs = numpy.eye(mol.nao)
QMCUtils.writeMat(rhfCoeffs, "rhf.txt")

# dummy mcsscf for core averaging
mc = mcscf.CASSCF(mf, mol.nao, mol.nelectron)
mc.mo_coeff = mc0.mo_coeff
QMCUtils.prepAFQMC(mol, mf, mc)
QMCUtils.write_afqmc_input(seed = 4321, numAct=8, numCore=2, left="multislater", right="rhf", ndets=500, nwalk=10, stochasticIter=50, choleskyThreshold=1.e-3, fname="afqmc.json")
12 changes: 12 additions & 0 deletions test/DQMC/multislater_rhf/pyscf.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
converged SCF energy = -108.864599611748
CASSCF energy = -109.016191662362
CASCI E = -109.016191662362 E(CI) = -32.1184849425394 S^2 = 0.0000000

Preparing Dice calculation
Starting Dice calculation
Finished Dice calculation

Preparing AFQMC calculation
nelec: (7, 7)
nbasis: 18
chol.shape: (92, 324)
18 changes: 18 additions & 0 deletions test/DQMC/multislater_rhf/rhf.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00
0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00
0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00
50 changes: 50 additions & 0 deletions test/DQMC/multislater_rhf/samples.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
2.0000000e+01 -1.0901618257e+02
2.0021354e+01 -1.0905508892e+02
2.0089560e+01 -1.0912560914e+02
2.0158360e+01 -1.0910073971e+02
2.0013589e+01 -1.0907702419e+02
2.0033117e+01 -1.0908082209e+02
1.9910560e+01 -1.0907291190e+02
1.9988253e+01 -1.0907305211e+02
2.0001443e+01 -1.0906504077e+02
1.9944560e+01 -1.0908423480e+02
2.0034822e+01 -1.0906631748e+02
2.0023982e+01 -1.0906007448e+02
1.9943775e+01 -1.0908761856e+02
2.0017913e+01 -1.0909739974e+02
2.0053777e+01 -1.0908299272e+02
2.0034882e+01 -1.0907392887e+02
2.0036837e+01 -1.0908794095e+02
2.0050800e+01 -1.0911724987e+02
1.9998799e+01 -1.0910603620e+02
1.9974161e+01 -1.0909320402e+02
2.0000823e+01 -1.0909649952e+02
2.0015001e+01 -1.0908569134e+02
1.9989020e+01 -1.0909698993e+02
2.0052547e+01 -1.0907099872e+02
1.9931956e+01 -1.0906726595e+02
1.9873115e+01 -1.0906605691e+02
1.9900906e+01 -1.0907857665e+02
1.9986510e+01 -1.0909803774e+02
2.0029180e+01 -1.0910693245e+02
2.0014556e+01 -1.0911285530e+02
2.0051134e+01 -1.0909828354e+02
2.0017358e+01 -1.0908991775e+02
1.9968954e+01 -1.0909103110e+02
1.9957438e+01 -1.0908833123e+02
2.0000454e+01 -1.0910212493e+02
2.0031896e+01 -1.0908600154e+02
2.0007784e+01 -1.0906423636e+02
2.0062098e+01 -1.0911059521e+02
2.0059531e+01 -1.0910623760e+02
1.9894287e+01 -1.0908363369e+02
1.9992122e+01 -1.0911945216e+02
1.9998409e+01 -1.0911725302e+02
2.0028671e+01 -1.0909390321e+02
2.0008254e+01 -1.0908776446e+02
1.9913034e+01 -1.0909451243e+02
1.9990051e+01 -1.0911059814e+02
2.0005345e+01 -1.0909401397e+02
1.9870339e+01 -1.0908398730e+02
1.9904427e+01 -1.0910203050e+02
1.9984035e+01 -1.0909511182e+02
Binary file added test/DQMC/multislater_uhf/FCIDUMP_chol
Binary file not shown.
24 changes: 24 additions & 0 deletions test/DQMC/multislater_uhf/afqmc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"system": {
"integrals": "FCIDUMP_chol",
"numAct": 8,
"numCore": 1
},
"wavefunction": {
"left": "multislater",
"right": "uhf",
"determinants": "dets.bin",
"ndets": 100
},
"sampling": {
"seed": 142108,
"phaseless": true,
"dt": 0.005,
"nsteps": 50,
"nwalk": 20,
"stochasticIter": 50,
"choleskyThreshold": 0.002,
"orthoSteps": 20
},
"print": {}
}
Loading

0 comments on commit 8997aa8

Please sign in to comment.