示例#1
0
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")
示例#2
0
atomstring = ""
for i in range(10):
  atomstring += "H 0 0 %g\n"%(i*r)
mol = gto.M(atom=atomstring, basis='sto-6g', unit='bohr', symmetry=0)
mf = scf.RHF(mol)
mf.kernel()
norb = mol.nao

# uhf
dm = [numpy.zeros((norb, norb)), numpy.zeros((norb, norb))]
for i in range(norb//2):
  dm[0][2*i, 2*i] = 1.
  dm[1][2*i+1, 2*i+1] = 1.
umf = scf.UHF(mol)
umf.kernel(dm)

# afqmc
print("Preparing AFQMC calculation")
# write hf wave function coefficients
rhfCoeffs = numpy.eye(mol.nao)
QMCUtils.writeMat(rhfCoeffs, "rhf.txt")
overlap = mf.get_ovlp(mol)
uhfCoeffs = numpy.empty((norb, 2*norb))
uhfCoeffs[:,:norb] = mf.mo_coeff.T.dot(overlap).dot(umf.mo_coeff[0])
uhfCoeffs[:,norb:] = mf.mo_coeff.T.dot(overlap).dot(umf.mo_coeff[1])
QMCUtils.writeMat(uhfCoeffs, "uhf.txt")

# calculate and write cholesky integrals
QMCUtils.prepAFQMC(mol, mf)
QMCUtils.write_afqmc_input(seed = 4321, left="uhf", right="rhf", nwalk=20, stochasticIter=50, choleskyThreshold=1.e-3, fname="afqmc.json")
示例#3
0
文件: n2.py 项目: sanshar/VMC
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")
示例#4
0
    fh.write("writebestdeterminants 10000")

# 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")
# write hf wave function coefficients
# rohf states are treated as uhf
rhfCoeffs = numpy.eye(mol.nao)
uhfCoeffs = numpy.block([rhfCoeffs, rhfCoeffs])
QMCUtils.writeMat(uhfCoeffs, "uhf.txt")

# calculate and write cholesky integrals
# 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=142108,
                           numAct=8,
                           numCore=1,
                           left="multislater",
                           ndets=100,
                           right="uhf",
                           nwalk=20,
                           stochasticIter=50,
示例#5
0
文件: hChain.py 项目: sanshar/VMC
os.system(command)
with open("dice.dat", "a") as fh:
  fh.write("writebestdeterminants 10000")

# 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")
# write hf wave function coefficients
rhfCoeffs = numpy.eye(mol.nao)
QMCUtils.writeMat(rhfCoeffs, "rhf.txt")

# calculate and write cholesky integrals
QMCUtils.prepAFQMC(mol, mf, mc)

# write afqmc input and perform calculation
afqmc_binary = vmc_root + "/bin/DQMC"
blocking_script = vmc_root + "/scripts/blocking.py"

os.system("export OMP_NUM_THREADS=1; rm samples.dat -f")

# rhf trial
QMCUtils.write_afqmc_input(seed = 4321, left="rhf", right="rhf", nwalk=50, stochasticIter=500, choleskyThreshold=1.e-3, fname="afqmc_rhf.json")
print("\nStarting AFQMC / RHF calculation", flush=True)
command = f'''
              mpirun -np {nproc} {afqmc_binary} afqmc_rhf.json > afqmc_rhf.out;
示例#6
0
文件: c.py 项目: sanshar/VMC
    fh.write("writebestdeterminants 10000")

# 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")
# write hf wave function coefficients
# rohf states are treated as uhf
rhfCoeffs = numpy.eye(mol.nao - norbFrozen)
uhfCoeffs = numpy.block([rhfCoeffs, rhfCoeffs])
QMCUtils.writeMat(uhfCoeffs, "uhf.txt")

# calculate and write cholesky integrals
# dummy mcsscf for core averaging
mc = mcscf.CASSCF(mf, mol.nao - norbFrozen, mol.nelectron - 2 * norbFrozen)
mc.mo_coeff = mc0.mo_coeff
QMCUtils.prepAFQMC(mol, mf, mc)

# write afqmc input and perform calculation
afqmc_binary = vmc_root + "/bin/DQMC"
blocking_script = vmc_root + "/scripts/blocking.py"

os.system("export OMP_NUM_THREADS=1; rm samples.dat -f")

# rohf trial
QMCUtils.write_afqmc_input(seed=89649,