7
$\begingroup$

I am trying to run a SHCI calculation in PYSCF with DICE; however, I want to freeze the first two core orbitals and the highest 3 virtual orbitals in a calculation.

In other parts of PySCF this can normally be accomplished with the frozen argument. Here, I am not sure how the frozen argument is implemented.

The following is example code taken from: https://sanshar.github.io/Dice/usingincasscf.html?highlight=shciscf

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

# Initialize C2 molecule
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.mpiprefix = 'mpirun -np 2'
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_shci = mch.mc1step()[0]
$\endgroup$
9
$\begingroup$

Freezing can have two meanings: either freezing the occupation (doubly occupied core orbitals and inactive virtual orbitals), or freezing the spatial orbital in orbital optimization (here: in SHCI-SCF).

In the former case, figuring out the number of frozen core orbitals and inactive virtual orbitals is easy: since you are specifying the number of electrons and number of orbitals, you don't need to specify the number of frozen core or frozen virtual orbitals. The number of active occupied orbitals can be determined by counting the electrons, whereas the number of active virtual orbitals is simply the number of active orbitals minus the number of active occupied orbitals.

The latter case is also quite simple: you just zero out the update for the frozen orbitals, so that they aren't changed.

In PySCF, the frozen argument appears to refer to the latter case, see e.g. https://github.com/pyscf/pyscf/blob/a75bfbbc940f9d0a7ec047468a675221a05111a8/pyscf/mcscf/mc1step.py#L882

This option does not appear to be implemented in the SHCI code https://github.com/pyscf/pyscf/blob/master/pyscf/shciscf/shci.py. It should, however, be quite simple to hack the SHCI code to add support for a frozen argument by e.g. copy-pasting the freezing code from other methods. You can fork PySCF, make the relevant changes and file a pull request so that the feature becomes available to everyone.

$\endgroup$
5
  • $\begingroup$ +1 for such a fast answer, which helped this become a Hot Network Question. DICE interacts with PySCF through an FCIDUMP. Does the user not just need the FCIDUMP to not include the highest 3 virtual orbitals and to reflect the desire to have 2 core orbitals frozen? $\endgroup$ Sep 30 '20 at 20:03
  • $\begingroup$ @NikeDattani the FCIDUMP file only has information within the active space. The issue here is that you want to disable orbital optimization for the frozen orbitals, which aren't in the active space (usually). $\endgroup$ Oct 1 '20 at 20:39
  • $\begingroup$ I'm very doubtful that the user wishes to do orbital optimization. $\endgroup$ Oct 2 '20 at 15:14
  • $\begingroup$ For SHCI, orbital optimization can be done within the active space, but the user is talking about freezing two core electrons and 3 virtuals: If they were going to do CASSCF with SHCI as the CI solver, they might as well include the 2 core electrons and the 3 virtuals, because that difference in active space size is nothing for SHCI. They are likely just trying to get a good approximation to the FCI energy with the 2 core electrons frozen, and the highest 3 virtuals also frozen (the latter being for more mysterious reasons). $\endgroup$ Oct 2 '20 at 15:43
  • $\begingroup$ @NikeDattani that's not true in general - the problem is exponential scaling. 2 electrons and 3 virtuals more can make all the difference. I'm aware of active space optimization in SHCI-SCF; ASCI-SCF has the same feature since the methods are very similar. I already discussed the case of having inactive core and inactive virtual orbitals above. The OP explicitly asked about the frozen argument which freezes the orbitals in the orbital optimization, as you can see in the code I linked. $\endgroup$ Oct 3 '20 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.