def dmc(self, nconfig=1000, **kwargs):
     configs = pyqmc.initial_guess(self.mol, nconfig)
     if self.client is None:
         pyqmc.vmc(self.wf, configs, nsteps=10)
         pyqmc.rundmc(
             self.wf,
             configs,
             accumulators={"energy": pyqmc.EnergyAccumulator(self.mol)},
             **kwargs,
         )
     else:
         pyqmc.dasktools.distvmc(
             self.wf,
             configs,
             nsteps=10,
             client=self.client,
             npartitions=self.npartitions,
         )
         pyqmc.rundmc(
             self.wf,
             configs,
             accumulators={"energy": pyqmc.EnergyAccumulator(self.mol)},
             propagate=pyqmc.dasktools.distdmc_propagate,
             **kwargs,
             client=self.client,
             npartitions=self.npartitions,
         )
Exemple #2
0
def DMC(dft_checkfile,
        output,
        nconfig=1000,
        start_from=None,
        S=None,
        client=None,
        npartitions=None,
        jastrow_kws=None,
        slater_kws=None,
        dmc_kws=None,
        accumulators=None):
    if dmc_kws is None:
        dmc_kws = {}
    mol, mf = pyqmc.recover_pyscf(dft_checkfile)
    if S is not None:
        mol = pyqmc.get_supercell(mol, np.asarray(S))

    wf, _ = pyqmc.generate_wf(mol,
                              mf,
                              jastrow_kws=jastrow_kws,
                              slater_kws=slater_kws)

    if start_from is not None:
        pyqmc.read_wf(wf, start_from)

    configs = pyqmc.initial_guess(mol, nconfig)

    pyqmc.rundmc(wf,
                 configs,
                 accumulators=generate_accumulators(mol, mf, **accumulators),
                 verbose=True,
                 hdf_file=output,
                 client=client,
                 npartitions=npartitions,
                 **dmc_kws)
Exemple #3
0
    # Initialize energy accumulator (and Ewald)
    pgrad = pyqmc.gradient_generator(supercell, wf, to_opt=to_opt)

    # Optimize jastrow
    wf, lm_df = pyqmc.line_minimization(wf,
                                        configs,
                                        pgrad,
                                        hdf_file="pbc_he_linemin.hdf",
                                        verbose=True)

    # Run VMC
    df, configs = pyqmc.vmc(
        wf,
        configs,
        nblocks=100,
        accumulators={"energy": pgrad.enacc},
        hdf_file="pbc_he_vmc.hdf",
        verbose=True,
    )

    # Run DMC
    pyqmc.rundmc(
        wf,
        configs,
        nsteps=1000,
        accumulators={"energy": pgrad.enacc},
        hdf_file="pbc_he_dmc.hdf",
        verbose=True,
    )
Exemple #4
0
# then minimizes the energy along that line.
wf, dfgrad, dfline = line_minimization(
    wf,
    configs,
    acc,
    npartitions=ncore,
    vmcoptions={"nsteps": 30},
    dataprefix="parsl_h2o",
)

dfdmc, configs_, weights_ = rundmc(
    wf,
    configs,
    nsteps=1000,
    branchtime=5,
    accumulators={"energy": EnergyAccumulator(mol)},
    ekey=("energy", "total"),
    tstep=0.01,
    verbose=True,
    propagate=distdmc_propagate,
    npartitions=ncore,
)

dfdmc = pd.DataFrame(dfdmc)
dfdmc.sort_values("step", inplace=True)
dfdmc.to_csv("parsl_h2o_dmc.csv")
warmup = 200
dfprod = dfdmc[dfdmc.step > warmup]

reblock = pyblock.reblock(dfprod[["energytotal", "energyei"]])
print(reblock[1])
Exemple #5
0
    line_minimization(
        wf,
        configs,
        pgrad_acc,
        hdf_file="h2o_opt.hdf",
        client=client,
        npartitions=ncore,
        verbose=True,
    )
    df, configs = vmc(
        wf,
        configs,
        hdf_file="h2o_vmc.hdf",
        accumulators={"energy": pgrad_acc.enacc},
        client=client,
        npartitions=ncore,
        verbose=True,
    )
    dfdmc, configs, weights = rundmc(
        wf,
        configs,
        hdf_file="h2o_dmc.hdf",
        nsteps=1000,
        accumulators={"energy": pgrad_acc.enacc},
        ekey=("energy", "total"),
        tstep=0.02,
        verbose=True,
        client=client,
        npartitions=ncore,
    )
Exemple #6
0
if __name__ == "__main__":
    import pyscf
    import pyqmc
    import pandas as pd
    mol = pyscf.gto.M(atom="He 0. 0. 0.",
                      basis='bfd_vdz',
                      ecp='bfd',
                      unit='bohr')

    mf = pyscf.scf.RHF(mol).run()

    wf = pyqmc.slater_jastrow(mol, mf)

    nconfig = 1000
    configs = pyqmc.initial_guess(mol, nconfig)

    acc = pyqmc.gradient_generator(mol, wf, ['wf2acoeff', 'wf2bcoeff'])
    wf, dfgrad, dfline = pyqmc.line_minimization(wf, configs, acc)
    pd.DataFrame(dfgrad).to_json("optgrad.json")
    pd.DataFrame(dfline).to_json("optline.json")

    dfdmc, configs, weights = pyqmc.rundmc(
        wf,
        configs,
        nsteps=5000,
        accumulators={'energy': pyqmc.EnergyAccumulator(mol)},
        tstep=0.02)
    pd.DataFrame(dfdmc).to_json("dmc.json")
Exemple #7
0
if __name__ == "__main__":
    import pyscf
    import pyqmc
    import pandas as pd
    mol = pyscf.gto.M(atom="He 0. 0. 0.",
                      basis='bfd_vdz',
                      ecp='bfd',
                      unit='bohr')

    mf = pyscf.scf.RHF(mol).run()
    wf = pyqmc.slater_jastrow(mol, mf)

    nconfig = 1000
    configs = pyqmc.initial_guess(mol, nconfig)

    acc = pyqmc.gradient_generator(mol, wf, ['wf2acoeff', 'wf2bcoeff'])
    pyqmc.line_minimization(wf, configs, acc, hdf_file="he_opt.hdf5")

    pyqmc.rundmc(wf,
                 configs,
                 nsteps=5000,
                 accumulators={'energy': pyqmc.EnergyAccumulator(mol)},
                 tstep=0.02,
                 hdf_file="he_dmc.hdf5")
Exemple #8
0
    import pyscf
    import pyqmc

    mol = pyscf.gto.M(atom="He 0. 0. 0.",
                      basis="bfd_vdz",
                      ecp="bfd",
                      unit="bohr")

    mf = pyscf.scf.RHF(mol).run()
    wf, to_opt = pyqmc.default_sj(mol, mf)

    nconfig = 1000
    configs = pyqmc.initial_guess(mol, nconfig)

    acc = pyqmc.gradient_generator(mol, wf, to_opt)
    pyqmc.line_minimization(wf,
                            configs,
                            acc,
                            hdf_file="he_opt.hdf5",
                            verbose=True)

    pyqmc.rundmc(
        wf,
        configs,
        nsteps=5000,
        accumulators={"energy": pyqmc.EnergyAccumulator(mol)},
        tstep=0.02,
        hdf_file="he_dmc.hdf5",
        verbose=True,
    )