From d1a18ff39a7dd16de627095e62271816bf30bb92 Mon Sep 17 00:00:00 2001 From: NicoRenaud Date: Wed, 29 Apr 2020 13:56:35 +0200 Subject: [PATCH] example --- example/h2o_sampling.py | 34 ++++++++++++++++++++++++++++++++++ example/water.xyz | 5 +++++ 2 files changed, 39 insertions(+) create mode 100644 example/h2o_sampling.py create mode 100644 example/water.xyz diff --git a/example/h2o_sampling.py b/example/h2o_sampling.py new file mode 100644 index 00000000..e9f2677c --- /dev/null +++ b/example/h2o_sampling.py @@ -0,0 +1,34 @@ +from qmctorch.wavefunction import Orbital, Molecule +from qmctorch.sampler import Metropolis +from qmctorch.solver import SolverOrbital +from qmctorch.utils import plot_walkers_traj + +# define the molecule +mol = Molecule(atom='water.xyz', unit='angs', + calculator='pyscf', basis='sto-3g', name='water') + +# define the wave function +wf = Orbital(mol, kinetic='jacobi', + configs='ground_State', + use_jastrow=True) + +# sampler +sampler = Metropolis(nwalkers=100, nstep=300, step_size=0.25, + nelec=wf.nelec, ndim=wf.ndim, + init=mol.domain('atomic'), + move={'type': 'one-elec', 'proba': 'normal'}) + +# solver +solver = SolverOrbital(wf=wf, sampler=sampler) + +# single point +obs = solver.single_point() + +# reconfigure sampler +solver.sampler.ntherm = 0 +solver.sampler.ndecor = 3 + +# compute the sampling traj +pos = solver.sampler(solver.wf.pdf) +obs = solver.sampling_traj(pos) +plot_walkers_traj(obs.local_energy, walkers='mean') diff --git a/example/water.xyz b/example/water.xyz new file mode 100644 index 00000000..e1a4b014 --- /dev/null +++ b/example/water.xyz @@ -0,0 +1,5 @@ +3 +water molecule +O 0.000000 0.00000 0.00000 +H 0.758602 0.58600 0.00000 +H -0.758602 0.58600 0.00000