Skip to content

Commit

Permalink
Fix order
Browse files Browse the repository at this point in the history
  • Loading branch information
brianz98 committed Nov 26, 2024
1 parent f870761 commit 6e7ec6d
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions forte/sparse_ci/sparse_hamiltonian.cc
Original file line number Diff line number Diff line change
Expand Up @@ -347,30 +347,30 @@ SparseOperator SparseHamiltonian::to_sparse_operator() const {
SparseOperator H;
size_t nmo = as_ints_->nmo();

H.add_term_from_str("[]", as_ints_->nuclear_repulsion_energy() + as_ints_->scalar_energy());
for (size_t i = 0; i < nmo; i++) {
for (size_t j = 0; j < nmo; j++) {
H.add_term_from_str(fmt::format("{}a+ {}a-", i, j), as_ints_->oei_a(i, j));
H.add_term_from_str(fmt::format("{}b+ {}b-", i, j), as_ints_->oei_b(i, j));
H.add_term_from_str("[]", as_ints_->nuclear_repulsion_energy() + as_ints_->scalar_energy() + as_ints_->frozen_core_energy());
for (size_t p = 0; p < nmo; p++) {
for (size_t p = 0; p < nmo; p++) {
H.add_term_from_str(fmt::format("{}a+ {}a-", p, q), as_ints_->oei_a(p, q));
H.add_term_from_str(fmt::format("{}b+ {}b-", p, q), as_ints_->oei_b(p, q));
}
}

for (size_t i = 0; i < nmo; i++){
for (size_t j = i + 1; j < nmo; j++){
for (size_t a = 0; a < nmo; a++){
for (size_t b = a + 1; b < nmo; b++){
H.add_term_from_str(fmt::format("{}a+ {}a+ {}a- {}a-", i, j, a, b), as_ints_->tei_aa(i, j, a, b));
H.add_term_from_str(fmt::format("{}b+ {}b+ {}b- {}b-", i, j, a, b), as_ints_->tei_bb(i, j, a, b));
for (size_t p = 0; p < nmo; p++){
for (size_t q = p + 1; q < nmo; q++){
for (size_t r = 0; r < nmo; r++){
for (size_t s = r + 1; s < nmo; s++){
H.add_term_from_str(fmt::format("{}a+ {}a+ {}a- {}a-", p, q, s, r), as_ints_->tei_aa(p, q, r, s));
H.add_term_from_str(fmt::format("{}b+ {}b+ {}b- {}b-", p, q, s, r), as_ints_->tei_bb(p, q, r, s));
}
}
}
}

for (size_t i = 0; i < nmo; i++){
for (size_t j = 0; j < nmo; j++){
for (size_t a = 0; a < nmo; a++){
for (size_t b = 0; b < nmo; b++){
H.add_term_from_str(fmt::format("{}a+ {}b+ {}b- {}a-", i, j, a, b), as_ints_->tei_ab(i, j, a, b));
for (size_t p = 0; p < nmo; p++){
for (size_t q = 0; q < nmo; q++){
for (size_t r = 0; r < nmo; r++){
for (size_t s = 0; s < nmo; s++){
H.add_term_from_str(fmt::format("{}a+ {}b+ {}b- {}a-", p, q, s, r), as_ints_->tei_ab(p, q, r, s));
}
}
}
Expand Down

0 comments on commit 6e7ec6d

Please sign in to comment.