pyscf / shciscf

An interface to SHCI program Dice developed by Sharma group
Apache License 2.0
7 stars 11 forks source link

CI Vector is empty #11

Open NastaMauger opened 1 week ago

NastaMauger commented 1 week ago

Hello,

I would like to access the CI vector after a DICE calculation (and not just the CI coefficients). However, when I try the following:

my_dice = shci.SHCISCF(rhf, norb, nelec)
my_dice.verbose = 9
my_dice.fcisolver.stochastic = True
my_dice.fcisolver.DoRDM = True
my_dice.fcisolver.mpiprefix = 'mpirun -np 1'
my_dice.fcisolver.nPTiter = 0
my_dice.fcisolver.sweep_iter = [0, 3]
my_dice.fcisolver.sweep_epsilon = [9e-1, 1.1e-1]
my_dice.fcisolver.writebestdeterminants = 1000000
e_shci = casci.mc1step()[0]
ci_vector = my_dice.ci
print(ci_vector)  # This returns 0

I am unable to access the CI vector, as my_dice.ci returns 0.

Is there a way to access the CI vector, please?

I also tried to build the CI vector manually using the CI coefficients with a shape of num_det x num_det, but I encounter size mismatches when attempting to use it in:

rdm1 = mcscf.addons.make_rdm1(my_dice, ci=new_ci_vector)

Where new_ci_vector is my manually constructed matrix. For some reason, I always get this error:

Traceback (most recent call last):
  File "/home/shci.py", line 220, in <module>
    rdm1, rdm2 = mcscf.addons.make_rdm12(casci, ci=new_ci_vector)
  File "/opt/pyscf/pyscf/mcscf/addons.py", line 761, in make_rdm12
    casdm1, casdm2 = casscf.fcisolver.make_rdm12(ci, ncas, nelecas)
  File "/opt/shciscf/pyscf/shciscf/shci.py", line 410, in make_rdm12
    file2pdm = "spatialRDM.%d.%d.txt" % (state, state)
TypeError: %d format: a real number is required, not numpy.ndarray

Could you please advise on how to resolve this?

Best

sanshar commented 1 week ago

The difference is related to the bais set. Dice gives RDM in mo basis and pyscf gives it in ao basis. you can interconvert the two as follows

[image: image.png]

On Tue, Nov 12, 2024 at 5:44 PM Mauger Nastasia @.***> wrote:

Hello,

I would like to access the CI vector after a DICE calculation (and not just the CI coefficients). However, when I try the following:

my_dice = shci.SHCISCF(rhf, norb, nelec) my_dice.verbose = 9 my_dice.fcisolver.stochastic = True my_dice.fcisolver.DoRDM = True my_dice.fcisolver.mpiprefix = 'mpirun -np 1' my_dice.fcisolver.nPTiter = 0 my_dice.fcisolver.sweep_iter = [0, 3] my_dice.fcisolver.sweep_epsilon = [9e-1, 1.1e-1] my_dice.fcisolver.writebestdeterminants = 1000000 e_shci = casci.mc1step()[0] ci_vector = my_dice.ci print(ci_vector) # This returns 0

I am unable to access the CI vector, as my_dice.ci returns 0.

Is there a way to access the CI vector, please?

I also tried to build the CI vector manually using the CI coefficients with a shape of num_det x num_det, but I encounter size mismatches when attempting to use it in:

rdm1 = mcscf.addons.make_rdm1(my_dice, ci=new_ci_vector)

Where new_ci_vector is my manually constructed matrix. For some reason, I always get an error related to size.

Could you please advise on how to resolve this?

Best

— Reply to this email directly, view it on GitHub https://github.com/pyscf/shciscf/issues/11, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABVW4G45BKP6WNWADLDUIL2AKOFRAVCNFSM6AAAAABRVIT2SSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGY2TGNZWGA3TGOI . You are receiving this because you are subscribed to this thread.Message ID: @.***>