CheMPS2
EdmistonRuedenberg.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 EDMISTONRUEDENBERG_CHEMPS2_H
21 #define EDMISTONRUEDENBERG_CHEMPS2_H
22 
23 #include "Options.h"
24 #include "DMRGSCFunitary.h"
25 #include "Hamiltonian.h"
26 
27 namespace CheMPS2{
127 
128  public:
129 
131 
134  EdmistonRuedenberg( const FourIndex * Vmat, const int group, const int printLevelIn=1 );
135 
137  virtual ~EdmistonRuedenberg();
138 
140 
146  double Optimize(double * temp1, double * temp2, const bool startFromRandomUnitary, const double gradThreshold=EDMISTONRUED_gradThreshold, const int maxIter=EDMISTONRUED_maxIter);
147 
149 
152  void FiedlerExchange(const int maxlinsize, double * temp1, double * temp2);
153 
155 
156  void FiedlerGlobal( int * dmrg2ham ) const;
157 
159 
161 
162  private:
163 
164  //Pointer to the active space two-electron integrals
165  const FourIndex * VMAT_ORIG;
166 
167  //The print level
168  int printLevel;
169 
170  //The symmetry information object
171  Irreps SymmInfo;
172 
173  //The DMRGSCF index handler (in order to be able to recycle the DMRGSCFunitary object)
174  DMRGSCFindices * iHandler;
175 
176  //DMRGSCF unitary
177  DMRGSCFunitary * unitary;
178 
179  //The rotated two-body matrix elements
180  FourIndex * VmatRotated;
181 
182  //Calculate the gradient, hessian and update
183  double augmentedHessianNewtonRaphson(double * gradient, double * temp1, double * temp2) const;
184  double calcGradientValue(const int irrep, const int p, const int q) const;
185  double calcHessianValue( const int irrep, const int p, const int q, const int r, const int s) const;
186 
187  //Calculate the cost function
188  double costFunction() const;
189 
190  //Fiedler vector helper function
191  double FiedlerExchangeCost() const;
192  static double FiedlerGlobalCost( const DMRGSCFindices * idx, const FourIndex * VMAT_LOCAL, int * dmrg2ham );
193  void Fiedler(const int irrep, int * reorder, double * laplacian, double * temp2);
194 
195  };
196 }
197 
198 #endif
virtual ~EdmistonRuedenberg()
Destructor.
Definition: CASPT2.h:42
EdmistonRuedenberg(const FourIndex *Vmat, const int group, const int printLevelIn=1)
Constructor.
void FiedlerGlobal(int *dmrg2ham) const
Permute the orbitals so that the bandwidth of the exchange matrix is (approximately) minimized...
DMRGSCFunitary * getUnitary()
Get the pointer to the unitary to use in DMRGSCF.
void FiedlerExchange(const int maxlinsize, double *temp1, double *temp2)
Permute the orbitals so that the bandwidth of the exchange matrix is (approximately) minimized (per i...
double Optimize(double *temp1, double *temp2, const bool startFromRandomUnitary, const double gradThreshold=EDMISTONRUED_gradThreshold, const int maxIter=EDMISTONRUED_maxIter)
Maximize the Edmiston-Ruedenberg cost function.