CheMPS2
DMRGSCFrotations.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 DMRGSCFROTATIONS_CHEMPS2_H
21 #define DMRGSCFROTATIONS_CHEMPS2_H
22 
23 #include "Options.h"
24 #include "Hamiltonian.h"
25 #include "DMRGSCFunitary.h"
26 #include "DMRGSCFintegrals.h"
27 #include "MyHDF5.h"
28 
29 namespace CheMPS2{
37 
38  public:
39 
41 
54  static void rotate( const FourIndex * ORIG_VMAT, FourIndex * NEW_VMAT, DMRGSCFintegrals * ROT_TEI, const char space1, const char space2, const char space3, const char space4, DMRGSCFindices * idx, DMRGSCFunitary * umat, double * mem1, double * mem2, const int mem_size, const string filename );
55 
56  private:
57 
58  // Blockwise rotations
59  static void blockwise_first( double * origin, double * target, int orig1, int dim2, const int dim34, double * umat1, int new1, int lda1 );
60  static void blockwise_second( double * origin, double * target, int dim1, int orig2, const int dim34, double * umat2, int new2, int lda2 );
61  static void blockwise_third( double * origin, double * target, const int dim12, int orig3, const int dim4, double * umat3, int new3, int lda3 );
62  static void blockwise_fourth( double * origin, double * target, const int dim12, int dim3, int orig4, double * umat4, int new4, int lda4 );
63 
64  // Space sizes
65  static int dimension( DMRGSCFindices * idx, const int irrep, const char space );
66  static int jump( DMRGSCFindices * idx, const int irrep, const char space );
67 
68  // Copy the required integrals from ORIG_VMAT to eri
69  static void fetch( double * eri, const FourIndex * ORIG_VMAT, const int irrep1, const int irrep2, const int irrep3, const int irrep4, DMRGSCFindices * idx, const int start, const int stop, const bool pack );
70 
71  // Unpack the second coulomb pair
72  static void unpackage_second( double * mem1, double * mem2, const int SIZE, const int ORIG );
73 
74  // Pack the first coulomb pair
75  static void package_first( double * mem1, double * mem2, const int NEW, const int PACKED, const int SIZE );
76 
77  // Copy the rotated integrals from eri to NEW_VMAT or ROT_TEI, depending on 'space'
78  static void write( double * eri, FourIndex * NEW_VMAT, DMRGSCFintegrals * ROT_TEI, const char space1, const char space2, const char space3, const char space4, const int irrep1, const int irrep2, const int irrep3, const int irrep4, DMRGSCFindices * idx, const int start, const int stop, const bool pack );
79 
80  // HDF5 file handling
81  static void open_file( hid_t * file_id, hid_t * dspc_id, hid_t * dset_id, const int first, const int second, const string filename );
82  static void write_file( hid_t dspc_id, hid_t dset_id, double * eri, const int start, const int size, const int first_write );
83  static void read_file( hid_t dspc_id, hid_t dset_id, double * eri, const int start, const int size, const int second_read );
84  static void close_file( hid_t file_id, hid_t dspc_id, hid_t dset_id );
85 
86  };
87 }
88 
89 #endif
static void rotate(const FourIndex *ORIG_VMAT, FourIndex *NEW_VMAT, DMRGSCFintegrals *ROT_TEI, const char space1, const char space2, const char space3, const char space4, DMRGSCFindices *idx, DMRGSCFunitary *umat, double *mem1, double *mem2, const int mem_size, const string filename)
Fill the rotated two-body matrix elements for the space. If the blocks become too large...
Definition: CASPT2.h:42