Skip to content

Conversation

@peter-reinholdt
Copy link
Contributor

Some work can be avoided when searching for determinants in the compute_enpt2 and add_hci routines.
Rewrite the criterion

$$ \left|H_{ki} c_{i} \right| > \varepsilon $$

as

$$ \left|H_{ki}\right| > \frac{\varepsilon}{\left|c_{i}\right|} $$

The value of the Hamiltonian matrix element is independent of what happens with, e.g., excite_det - so sometimes work can be skipped.

The performance improvement is system-dependent, but here is an example for water/cc-pVDZ.
Timings are in seconds, single thread. The benefit is most substantial when the majority of the determinants are rejected; when most determinants are accepted, there is almost no benefit.

eps1 eps2 Routine Before After Speedup
1.00E-03 add_hci 0.093 0.042 2.23
5.00E-04 add_hci 0.253 0.168 1.51
2.00E-04 add_hci 0.888 0.416 2.14
1.00E-03 0.0001 compute_enpt2 0.237 0.163 1.45
1.00E-03 1.00E-05 compute_enpt2 0.773 0.613 1.26
1.00E-03 1.00E-06 compute_enpt2 2.167 1.913 1.13
5.00E-04 5.00E-05 compute_enpt2 0.720 0.495 1.46
5.00E-04 5.00E-06 compute_enpt2 2.070 1.731 1.20
5.00E-04 5.00E-07 compute_enpt2 8.462 8.005 1.06
2.00E-04 2.00E-05 compute_enpt2 3.097 2.014 1.54
2.00E-04 2.00E-06 compute_enpt2 9.319 7.954 1.17
2.00E-04 2.00E-07 compute_enpt2 46.647 45.395 1.03

@PaulWAyers PaulWAyers requested a review from msricher December 26, 2025 23:00
@PaulWAyers
Copy link
Member

Thanks @peter-reinholdt . I assigned Michelle to look at this. You should be aware that we are doing a major rewrite of PyCI right now, so we are in "maintenance mode" on the current public version of PyCI right now. That said, to my naive eyes, this should be easy to transfer over to the new back end.

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

Successfully merging this pull request may close these issues.

2 participants