CheMPS2
DMRGSCFintegrals.h
1 /*
2  CheMPS2: a spin-adapted implementation of DMRG for ab initio quantum chemistry
3  Copyright (C) 2013-2016 Sebastian Wouters
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License along
16  with this program; if not, write to the Free Software Foundation, Inc.,
17  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19 
20 #ifndef DMRGSCFINTEGRALS_CHEMPS2_H
21 #define DMRGSCFINTEGRALS_CHEMPS2_H
22 
23 #include "DMRGSCFindices.h"
24 
25 namespace CheMPS2{
40 
41  public:
42 
44 
45  DMRGSCFintegrals(DMRGSCFindices * iHandler);
46 
48  virtual ~DMRGSCFintegrals();
49 
51  void clear();
52 
54 
63  void set_coulomb(const int Ic1, const int Ic2, const int Ia1, const int Ia2, const int c1, const int c2, const int a1, const int a2, const double val);
64 
66 
75  void add_coulomb(const int Ic1, const int Ic2, const int Ia1, const int Ia2, const int c1, const int c2, const int a1, const int a2, const double val);
76 
78 
87  double get_coulomb(const int Ic1, const int Ic2, const int Ia1, const int Ia2, const int c1, const int c2, const int a1, const int a2) const;
88 
90 
99  void set_exchange(const int Ic1, const int Ic2, const int Iv1, const int Iv2, const int c1, const int c2, const int v1, const int v2, const double val);
100 
102 
111  void add_exchange(const int Ic1, const int Ic2, const int Iv1, const int Iv2, const int c1, const int c2, const int v1, const int v2, const double val);
112 
114 
123  double get_exchange(const int Ic1, const int Ic2, const int Iv1, const int Iv2, const int c1, const int c2, const int v1, const int v2) const;
124 
126 
135  double FourIndexAPI(const int I1, const int I2, const int I3, const int I4, const int index1, const int index2, const int index3, const int index4) const;
136 
137  private:
138 
139  // The number of irreps
140  int numberOfIrreps;
141 
142  // The number of core orbitals per irrep
143  int * NCORE;
144 
145  // The number of virtual orbitals per irrep
146  int * NVIRTUAL;
147 
148  // The total number of orbitals per irrep
149  int * NTOTAL;
150 
151  // Pointers to the Coulomb array:
152  // - coulomb_ptr[ Ic1 x Ic2 != 0 ][ I_c1 ][ I_a1 ][ c1 + size(c1) * c2 ] points to the relevant part of coulomb_array
153  // - coulomb_ptr[ Ic1 x Ic2 == 0 ][ I_c1 ][ I_a1 ][ c1 + (c2*(c2+1))/2 ] points to the relevant part of coulomb_array
154  long long **** coulomb_ptr;
155  long long coulomb_size;
156  double * coulomb_array;
157  long long calcNumCoulombElements(const bool allocate);
158  long long get_coulomb_ptr( const int Ic1, const int Ic2, const int Ia1, const int Ia2, const int c1, const int c2, const int a1, const int a2 ) const;
159 
160  // Pointers to the Exchange array:
161  // - exchange_ptr[ Ic1 x Ic2 != 0 ][ I_c1 ][ I_v1 ][ c1 + size(c1) * c2 ] points to the relevant part of exchange_array
162  // - exchange_ptr[ Ic1 x Ic2 == 0 ][ I_c1 ][ I_v1 ][ c1 + (c2*(c2+1))/2 ] points to the relevant part of exchange_array
163  long long **** exchange_ptr;
164  long long exchange_size;
165  double * exchange_array;
166  long long calcNumExchangeElements(const bool allocate);
167  long long get_exchange_ptr( const int Ic1, const int Ic2, const int Iv1, const int Iv2, const int c1, const int c2, const int v1, const int v2 ) const;
168 
169  };
170 }
171 
172 #endif
173 
double get_coulomb(const int Ic1, const int Ic2, const int Ia1, const int Ia2, const int c1, const int c2, const int a1, const int a2) const
Get an element of the Coulomb object ( c1 c2 | a1 a2 )
Definition: CASPT2.h:42
virtual ~DMRGSCFintegrals()
Destructor.
void add_coulomb(const int Ic1, const int Ic2, const int Ia1, const int Ia2, const int c1, const int c2, const int a1, const int a2, const double val)
Add a double to an element of the Coulomb object ( c1 c2 | a1 a2 )
double FourIndexAPI(const int I1, const int I2, const int I3, const int I4, const int index1, const int index2, const int index3, const int index4) const
Get a two-body matrix element with at most 2 virtual indices, using the FourIndex API...
void set_exchange(const int Ic1, const int Ic2, const int Iv1, const int Iv2, const int c1, const int c2, const int v1, const int v2, const double val)
Set an element of the Exchange object ( c1 v1 | c2 v2 )
void add_exchange(const int Ic1, const int Ic2, const int Iv1, const int Iv2, const int c1, const int c2, const int v1, const int v2, const double val)
Add a double to an element of the Exchange object ( c1 v1 | c2 v2 )
double get_exchange(const int Ic1, const int Ic2, const int Iv1, const int Iv2, const int c1, const int c2, const int v1, const int v2) const
Get an element of the Exchange object ( c1 v1 | c2 v2 )
DMRGSCFintegrals(DMRGSCFindices *iHandler)
Constructor.
void clear()
Set the storage objects to zero.
void set_coulomb(const int Ic1, const int Ic2, const int Ia1, const int Ia2, const int c1, const int c2, const int a1, const int a2, const double val)
Set an element of the Coulomb object ( c1 c2 | a1 a2 )