theochem/PyCI

Cost function

Closed this issue · 15 comments

The task is to select Slater Determinants based on a given cost function.
There are methods for selecting SDs based on excitation level and seniority are already implemented.
Also, user is able to select SDs based on number of orbital nodes. This is also implemented with GKCI algorithm
We need to implement selection of SD given energy of the orbitals (similar to the number of orbital nodes)
ToDo:

  • #33
  • #32
  • #37
    1. Create almost the same version of odometer_one_spin and odometer_two_spin functions in the cost.py file, but changing the selection criteria by removing smoothness factor.
    2. (Recommended) Implement general version of odometer_one_spin and odometer_two_spin functions in utility.py file that takes selection criteria (probably in the form of another function) as input.

UPD:

Fascinating!

comment

I would like to choose the first task (In the new file cost.py implement function add_energy. The input should be similar to the add_gkci. It should take wavefunction and energies as input.), assuming that the functions from the subtask 2 are already moved to utility.py
Please react for my comment if anyone has something against it (thumb down), or if you say OK (thumb up)

I'd be happy to work on the second task. I'll be familiarizing myself with the material over the next couple days in preparation before I start contributing (should have some results during weekend ideally).

Id like to work on the second task. @alnaba1 we may split it. Would you have time to discuss the task later?

Hi @Pavlo3P, sure no problem. Do you know how you would like to split the work? Would be happy to meet and discuss once I've familiarized myself with it a bit. Maybe sometime Friday?

@alnaba1 yep, let's dive in it before, and on Friday we may discuss how we'd like to distribute the tasks. I'll write you an email for more details.

@PaulWAyers what would be the analogue expression of the selection criteria in GKCI for the energy?

You'd sum the orbital energies.

GKCI is based on the asymptotic convergence of CI coefficients as a function of the number of nodes of the molecular orbitals, which is predicted to be (inversely proportional to)

$$ f(\tau,\mathbf{x}) = ||\mathbf{x}||_{1} + \tau ||\mathbf{x}|| _{\infty} $$

where the $\ell_1$ and $\ell_\infty$ norm are denoted in the obvious way and $-1 \lt \tau \le \infty$.

In the energy case, we need to replace the norms with sum/max because the orbital energies generally have both negative and positive values and because shifting the orbital energies by a constant should not change the results.

$$ f(\tau,\mathbf{\epsilon}) = \sum_{p \in \text{occupied orbitals}} \epsilon_p + \tau \max_{p \in \text{occupied orbitals}} \epsilon_p $$

Evidently, according to @msricher there are some other forms of cost function beyond GKCI that haven't been used but which are implemented. I'm not sure; they are not documented where I have seen them. I think the method she is referring to (if I recall correctly) is method #3 in the attached notes. This gives, as I recall, a different way of assigning orbital cost.

Generically, the idea is that there is an orbital cost. It could be the number of nodes, a user parameter, an estimate for the number of nodes, the assignment in method #3, etc.. Call these orbital costs $c_p$. Sort the orbitals in order of increasing cost. Then one can use the odometer algorithm with the acceptance criterion,

$$ f(\tau,\mathbf{c}) = \sum_{p \in \text{occupied orbitals}} c_p + \tau \max_{p \in \text{occupied orbitals}} c_p $$

Note that assigning any orbitals a very small (i.e., nearly negative infinity) cost ensures they are occupied in every configuration (frozen core orbitals). Assigning any orbitals very large (i.e., nearly positive infinity) cost ensures they are never occupied (inactive orbitals). $\tau \rightarrow \infty$ ensures that all configurations using the low-cost orbitals are included, and corresponds to a "complete active space" calculation. $\tau = 0$ corresponds to a Smolyak-style selection.

Note that there are other choices beyond this special Griebel-Knapek form (e.g., the Bungartz and Griebel form based on the \mathcal{H}^1$ norm), which is based on the smoothness of the (wave)function.

GKCInotes5.pdf

Hello all, I did the part with add_energy, however I need to know what are the changes in the odometer_one_spin and odometer_two_spin, so that I delete them from my file and simply "import yours". Can we discuss it during the call today?
Thank you in advance!

@PaulWAyers There's both method 2 and 3 from your notes, called "gamma" and "interval" respectively in the code. I haven't tested them much.

@msricher do we have tests for add_gkci algorithm or odometer algorithms?

@PaulWAyers what should be the expression for calculating maximum value of the energy that is allowed. It should be an analog of q_max parameter here
Logic for the rest of the code seems to be the same

It's a user parameter. Usually the calculation would be run for several different threshholds and then extrapolated. I'm not sure what the default value should be, but perhaps no default at all is sensible at least for starters.