Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extracting CI coefficients #8

Open
vvp-nsk opened this issue Mar 24, 2023 · 1 comment
Open

Extracting CI coefficients #8

vvp-nsk opened this issue Mar 24, 2023 · 1 comment

Comments

@vvp-nsk
Copy link

vvp-nsk commented Mar 24, 2023

Hi!

I wonder how to get CI coefficients using the SHSISCF solver. Specifically, it returns just an integer instead of a float array :

from pyscf import gto, scf, fci
from pyscf.shciscf import shci

b =  1.243
mol = gto.Mole()
mol.build(
verbose = 5,
output = None,
atom = [
    ['C',(  0.000000,  0.000000, -b/2)],
    ['C',(  0.000000,  0.000000,  b/2)], ],
basis = {'C': 'ccpvdz', },
symmetry = True,
symmetry_subgroup = 'D2h',
spin = 0
)

# Create HF molecule
mf = scf.RHF( mol )
mf.conv_tol = 1e-9
mf.scf()

# Number of orbital and electrons
norb = 26
nelec = 8

# Create SHCI molecule for just variational opt.
# Active spaces chosen to reflect valence active space.
mch = shci.SHCISCF( mf, norb, nelec )
mch.fcisolver.stochastic = True
mch.fcisolver.nPTiter = 0
mch.fcisolver.sweep_iter = [ 0, 3 ]
mch.fcisolver.DoRDM = True
mch.fcisolver.sweep_epsilon = [ 5e-3, 1e-3 ]
e_tot, e_cas, fcivec, mo, mo_energy =  mch.kernel()
print(type(fcivec),fcivec)

It turns out that the 'fcivec' object is a scalar integer - <class 'int'> 0. However, if the mcscf.CASCI class is used then it returns float array - <class 'pyscf.fci.direct_spin1.FCIvector'> [[ ... ]]

The CI coefficients are needed to proceed further with fci.addons.large_ci addon.

Thank you in advance!

With best regards,
Victor Vysotskiy

@hungpham2017
Copy link
Contributor

Maybe you already figured out but I leave it here in case someone may find this usefull:

  • This keyword needs to be included in input.dat: writebestdeterminants numer_of_best_determinants to generate dets.bin. My last PR has also included this so that it can be included directly from the interface:
    mch.fcisolver.writebestdeterminants = 1000000
  • The following function read_dice_wavefunction can be used to obtain ci coefficients from dets.bin:
    ci, occa, occb = read_dice_wavefunction('dets.bin')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants