QMCPACK
ci_configuration2 Struct Reference
+ Collaboration diagram for ci_configuration2:

Public Member Functions

 ci_configuration2 ()
 
 ci_configuration2 (std::vector< size_t > &v)
 
 ci_configuration2 (const ci_configuration2 &c)
 
 ~ci_configuration2 ()
 
bool operator== (const ci_configuration2 &c) const
 
size_t calculateNumOfExcitations (const ci_configuration2 &c) const
 
double calculateExcitations (const ci_configuration2 &c, size_t &n, std::vector< size_t > &pos, std::vector< size_t > &ocp, std::vector< size_t > &uno) const
 

Public Attributes

std::vector< size_t > occup
 

Detailed Description

Definition at line 25 of file ci_configuration2.h.

Constructor & Destructor Documentation

◆ ci_configuration2() [1/3]

ci_configuration2 ( )
inline

Definition at line 30 of file ci_configuration2.h.

30 {}

◆ ci_configuration2() [2/3]

ci_configuration2 ( std::vector< size_t > &  v)
inline

Definition at line 32 of file ci_configuration2.h.

32 : occup(v.begin(), v.end()) {}

◆ ci_configuration2() [3/3]

ci_configuration2 ( const ci_configuration2 c)
inline

Definition at line 33 of file ci_configuration2.h.

33 : occup(c.occup) {}

◆ ~ci_configuration2()

~ci_configuration2 ( )
inline

Definition at line 35 of file ci_configuration2.h.

35 {}

Member Function Documentation

◆ calculateExcitations()

double calculateExcitations ( const ci_configuration2 c,
size_t &  n,
std::vector< size_t > &  pos,
std::vector< size_t > &  ocp,
std::vector< size_t > &  uno 
) const
inline

Definition at line 74 of file ci_configuration2.h.

References qmcplusplus::if(), qmcplusplus::n, and ci_configuration2::occup.

Referenced by qmcplusplus::TEST_CASE().

79  {
80  if (occup.size() != c.occup.size())
81  throw std::runtime_error("ci_configuration2::operator==() - ci_configuration2s are not compatible.");
82 
83  n = 0;
84  for (size_t i = 0; i < occup.size(); i++)
85  if (std::find(c.occup.begin(), c.occup.end(), occup[i]) == c.occup.end())
86  {
87  pos[n] = i;
88  ocp[n++] = occup[i];
89  }
90 
91  if (n == 0)
92  return 1.0;
93 
94  size_t cnt = 0;
95  for (size_t i = 0; i < c.occup.size(); i++)
96  if (std::find(occup.begin(), occup.end(), c.occup[i]) == occup.end())
97  uno[cnt++] = c.occup[i];
98 
99  if (cnt != n)
100  throw std::runtime_error(" Error #1 in ci_configuration2::calculateExcitations() \n");
101 
102  double res = 1.0;
103  // this is needed because ci coefficients are given wrt standard ordering,
104  // but by defining the determinant through excitations from a reference might change
105  // the parity
106  // inefficient but easy, is there a sort routine in STL that gives me the parity too???
107  auto ref0(occup);
108  for (size_t i = 0; i < n; i++)
109  ref0[pos[i]] = uno[i];
110 
111  for (size_t i = 0; i < ref0.size(); i++)
112  for (size_t k = i + 1; k < ref0.size(); k++)
113  if (ref0[i] > ref0[k])
114  {
115  size_t q = ref0[i];
116  ref0[i] = ref0[k];
117  ref0[k] = q;
118  res *= -1.0;
119  }
120  else if (ref0[i] == ref0[k])
121  throw std::runtime_error(" Error #2 in ci_configuration2::calculateExcitations() \n");
122 
123  return res;
124  }
if(c->rank()==0)

◆ calculateNumOfExcitations()

size_t calculateNumOfExcitations ( const ci_configuration2 c) const
inline

Definition at line 52 of file ci_configuration2.h.

References qmcplusplus::n, and ci_configuration2::occup.

Referenced by qmcplusplus::TEST_CASE().

53  {
54  if (occup.size() != c.occup.size())
55  throw std::runtime_error("ci_configuration2::operator==() - ci_configuration2s are not compatible.");
56 
57  size_t n = 0;
58  for (size_t i = 0; i < occup.size(); i++)
59  if (std::find(c.occup.begin(), c.occup.end(), occup[i]) == c.occup.end())
60  n++;
61  return n;
62  }

◆ operator==()

bool operator== ( const ci_configuration2 c) const
inline

Definition at line 37 of file ci_configuration2.h.

References ci_configuration2::occup.

38  {
39  if (occup.size() != c.occup.size())
40  throw std::runtime_error("ci_configuration2::operator==() - ci_configuration2s are not compatible.");
41 
42  for (int i = 0; i < occup.size(); i++)
43  if (occup[i] != c.occup[i])
44  return false;
45  return true;
46  }

Member Data Documentation

◆ occup


The documentation for this struct was generated from the following file: