1 #ifndef MPQC_CI_HAMILTONIAN_HPP
2 #define MPQC_CI_HAMILTONIAN_HPP
4 #include "mpqc/ci/string.hpp"
5 #include "mpqc/math/matrix.hpp"
6 #include <boost/foreach.hpp>
15 double diagonal(
const String &alpha,
20 const auto &o = alpha.occ();
21 for (
auto i = o.begin(); i < o.end(); ++i) {
22 size_t ii = index(*i,*i);
24 for (
auto j = o.begin(); j < i; ++j) {
25 size_t jj = index(*j,*j);
26 size_t ij = index(*i,*j);
27 q += V(ii,jj) - V(ij,ij);
34 template<
typename Index>
35 void diagonal2(
const String::List<Index> &alpha,
const String &beta,
38 const auto &b = beta.occ();
39 BOOST_FOREACH (
auto j, b) {
40 size_t jj = index(j,j);
41 auto const &Vj = V.col(jj);
42 for (
int k = 0; k < alpha.size(); ++k) {
44 const auto &a = alpha[k].occ();
45 BOOST_FOREACH (
auto i, a) {
46 size_t ii = index(i,i);
54 double diagonal2(
const String &alpha,
const String &beta,
58 const auto &a = alpha.occ();
59 const auto &b = beta.occ();
60 BOOST_FOREACH (
auto j, b) {
61 size_t jj = index(j,j);
62 auto const &Vj = V.col(jj);
63 BOOST_FOREACH (
auto i, a) {
64 size_t ii = index(i,i);