-
Notifications
You must be signed in to change notification settings - Fork 31
Generate truncated hilbert spaces #448
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can I suggest a slightly different strategy here? Can we have the aufbau determinant passed to the function? That would expand significantly its use case.
Thanks for the suggestion! It is now implemented and tested. |
@fevangelista having thought about it a little more - do we want to enforce the symmetry of the reference determinant to be the symmetry of generated determinants? For example, what if we want to generate all B1u determinants that can be coupled to the Ag aufbau reference by the dipole operator or some other non totally symmetric operators? |
forte/helpers/determinant_helpers.cc
Outdated
|
||
auto strings_a = make_strings(nmo, na, nirrep, mo_symmetry); | ||
auto strings_b = make_strings(nmo, nb, nirrep, mo_symmetry); | ||
for (size_t ha = 0; ha < nirrep; ha++) { | ||
int hb = symmetry ^ ha; | ||
for (const auto& Ia : strings_a[ha]) { | ||
int exc_a = (aufbau_a ^ Ia).count() / 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that here you could use the faster function fast_a_xor_b_count
forte/helpers/determinant_helpers.cc
Outdated
for (const auto& Ib : strings_b[hb]) { | ||
dets.push_back(Determinant(Ia, Ib)); | ||
int exc_b = (aufbau_b ^ Ib).count() / 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
forte/helpers/determinant_helpers.cc
Outdated
|
||
auto strings_a = make_strings(nmo, na, nirrep, mo_symmetry); | ||
auto strings_b = make_strings(nmo, nb, nirrep, mo_symmetry); | ||
for (size_t ha = 0; ha < nirrep; ha++) { | ||
int hb = symmetry ^ ha; | ||
for (const auto& Ia : strings_a[ha]) { | ||
int exc_a = (aufbau_a ^ Ia).count() / 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int exc_a = (aufbau_a ^ Ia).count() / 2; | |
int exc_a = Ia. fast_a_xor_b_count(aufbau_a) / 2; |
forte/helpers/determinant_helpers.cc
Outdated
dets.push_back(Determinant(Ia, Ib)); | ||
int exc_b = (aufbau_b ^ Ib).count() / 2; | ||
if (truncation == -1) { | ||
dets.push_back(Determinant(Ia, Ib)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe here and below we could use:
dets.push_back(Determinant(Ia, Ib)); | |
dets.emplace_back(Ia, Ib); |
forte/helpers/determinant_helpers.h
Outdated
@@ -68,9 +68,10 @@ std::vector<std::vector<String>> make_strings(int n, int k, size_t nirrep, | |||
/// @param nirrep The number of irreps | |||
/// @param mo_symmetry The symmetry of the MOs | |||
/// @param symmetry The symmetry of the determinants | |||
/// @param truncation The excitation level truncation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// @param truncation The excitation level truncation | |
/// @param truncation The excitation level truncation (default = -1, no truncation) |
if (symmetry >= static_cast<int>(nirrep)) { | ||
throw std::runtime_error( | ||
"The symmetry of the determinants is greater than the number of irreps."); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a check that ref
has symmetry equal to symmetry
.
Description
This PR is a small modification on the
make_hilbert_space
function that allows one to truncate the total excitation rank relative to the aufbau determinant.Checklist
output.ref
file