NLESC-JCER / QMCTorch

Pytorch Implementation of Real Space Quantum Monte Carlo Simulations of Molecular Systems
https://qmctorch.readthedocs.io/
Apache License 2.0
23 stars 2 forks source link

SCF energy of water #146

Closed scemama closed 10 months ago

scemama commented 1 year ago

I just downloaded QMCTorch with pip: It is version 0.3.0.

I am following the examples in the documentation to learn how to use QMCTorch. I am in section "Sampling and Energy Calculation of a Water Molecule". I am trying to compute the SCF wave function, but in cc-pvdz instead of sto-3g. I get the following output:

In [1]: import numpy as np
   ...: import matplotlib.pyplot as plt
   ...: from qmctorch.scf import Molecule
   ...: from qmctorch.wavefunction import SlaterJastrow
   ...: from qmctorch.sampler import Metropolis
   ...: from qmctorch.solver import Solver
   ...: from qmctorch.utils import plot_walkers_traj
   ...: 
INFO:QMCTorch|  ____    __  ______________             _
INFO:QMCTorch| / __ \  /  |/  / ___/_  __/__  ________/ /  
INFO:QMCTorch|/ /_/ / / /|_/ / /__  / / / _ \/ __/ __/ _ \ 
INFO:QMCTorch|\___\_\/_/  /_/\___/ /_/  \___/_/  \__/_//_/ 

In [2]: # define the molecule
   ...: mol = Molecule(atom='water.xyz', unit='angs',
   ...:                calculator='pyscf', basis='cc-pvdz', name='water')
INFO:QMCTorch|
INFO:QMCTorch| SCF Calculation
INFO:QMCTorch|  Running scf  calculation
converged SCF energy = -75.6449220050232
INFO:QMCTorch|  Molecule name       : water
INFO:QMCTorch|  Number of electrons : 10
INFO:QMCTorch|  SCF calculator      : pyscf
INFO:QMCTorch|  Basis set           : cc-pvdz
INFO:QMCTorch|  SCF                 : HF
INFO:QMCTorch|  Number of AOs       : 25
INFO:QMCTorch|  Number of MOs       : 24
INFO:QMCTorch|  SCF Energy          : -75.645 Hartree

But the SCF energy of water with this basis is -76.0267987035048

Here is the xyz file I used:

3

O      0.000000     0.000000     0.000000
H      0.000000     0.000000     0.957200
H     -0.926627     0.000000    -0.239987

Then, I tried with STO-3G. The output of QMCTorch gives

INFO:QMCTorch|
INFO:QMCTorch| SCF Calculation
INFO:QMCTorch|  Running scf  calculation
converged SCF energy = -74.5058778886388
INFO:QMCTorch|  Molecule name       : water
INFO:QMCTorch|  Number of electrons : 10
INFO:QMCTorch|  SCF calculator      : pyscf
INFO:QMCTorch|  Basis set           : sto-3g
INFO:QMCTorch|  SCF                 : HF
INFO:QMCTorch|  Number of AOs       : 7
INFO:QMCTorch|  Number of MOs       : 7
INFO:QMCTorch|  SCF Energy          : -74.506 Hartree

but the STO-3G SCF energy should be -74.96292825550279.

What am I doing wrong?

NicoRenaud commented 10 months ago

Hey @scemama thanks a lot for the review and apologies for the time it's taking me to get on to it. Thanks for finding this bug. There was a bug in the conversion when supplying the coordinate in angs, which I didn't catch. I've fixed it now as part of this PR #147