CheMPS2
CASSCFdebug.cpp
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 #include <stdlib.h>
21 #include <assert.h>
22 #include <iostream>
23 #include <math.h>
24 
25 #include "CASSCF.h"
26 
27 using std::cout;
28 using std::endl;
29 
30 void CheMPS2::CASSCF::checkHF( int * docc, int * socc ){
31 
32  double EnergyHF = NUCL_ORIG;
33 
34  cout << "Single particle energy levels : " << endl;
35  for ( int irrep = 0; irrep < num_irreps; irrep++ ){
36  for ( int orb = 0; orb < iHandler->getNORB( irrep ); orb++ ){
37 
38  double SPenergy = TMAT_ORIG->get( irrep, orb, orb );
39 
40  const int num_beta = (( orb < docc[ irrep ] ) ? 1 : 0 );
41  const int num_alpha = (( orb < docc[ irrep ] + socc[ irrep ] ) ? 1 : 0 );
42  const int num_total = num_alpha + num_beta;
43 
44  EnergyHF += num_total * TMAT_ORIG->get( irrep, orb, orb );
45 
46  for ( int irrep2 = 0; irrep2 < num_irreps; irrep2++ ){
47  for ( int orb2 = 0; orb2 < iHandler->getNORB( irrep2 ); orb2++ ){
48 
49  const int num_beta2 = (( orb2 < docc[ irrep2 ] ) ? 1 : 0 );
50  const int num_alpha2 = (( orb2 < docc[ irrep2 ] + socc[ irrep2 ] ) ? 1 : 0 );
51  const int num_total2 = num_alpha2 + num_beta2;
52 
53  SPenergy += ( num_total2 * VMAT_ORIG->get( irrep, irrep2, irrep, irrep2, orb, orb2, orb, orb2 )
54  - num_alpha2 * VMAT_ORIG->get( irrep, irrep, irrep2, irrep2, orb, orb, orb2, orb2 ) );
55 
56  EnergyHF += 0.5 * num_total * num_total2 * VMAT_ORIG->get( irrep, irrep2, irrep, irrep2, orb, orb2, orb, orb2 );
57  EnergyHF -= 0.5 * ( num_alpha * num_alpha2 + num_beta * num_beta2 ) * VMAT_ORIG->get( irrep, irrep, irrep2, irrep2, orb, orb, orb2, orb2 );
58 
59  }
60  }
61  cout << " Orb " << iHandler->getOrigNOCCstart( irrep ) + orb << " : "<< orb + 1 << SymmInfo.getIrrepName(irrep) << " = " << SPenergy << endl;
62  }
63  }
64  cout << "HF energy = " << EnergyHF << endl;
65 
66 }
67 
68 void CheMPS2::CASSCF::coeff_fe2( DMRG * theDMRG ){
69 
70  /*
71  For the iron dimer:
72  int NOCC[] = { 5, 0, 2, 2, 0, 5, 2, 2 }; // 36 core electrons
73  int NDMRG[] = { 6, 2, 3, 3, 2, 6, 3, 3 }; // 16 active space electrons, 28 active space orbitals
74  */
75 
76  assert( nOrbDMRG == 28 );
77 
78  // Ag B1g B2g B3g Au B1u B2u B3u
79  int coeff0[] = { 2, 2, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 2, 0, 0, 2, 0, 0 };
80  int coeff1[] = { 2, 1, 1, 0, 0, 0, 1, 0, 2, 0, 0, 1, 0, 0, 1, 0, 2, 1, 1, 0, 0, 0, 2, 0, 0, 1, 0, 0 };
81  int coeff2[] = { 2, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 2, 0, 0, 1, 0, 2, 1, 1, 0, 0, 0, 1, 0, 0, 2, 0, 0 };
82 
83  int coeff3[] = { 2, 2, 1, 0, 0, 0, 2, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 2, 0, 0, 2, 0, 0 };
84  int coeff4[] = { 2, 1, 1, 0, 0, 0, 2, 0, 2, 0, 0, 1, 0, 0, 1, 0, 2, 1, 0, 0, 0, 0, 2, 0, 0, 1, 0, 0 };
85  int coeff5[] = { 2, 1, 1, 0, 0, 0, 2, 0, 1, 0, 0, 2, 0, 0, 1, 0, 2, 1, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0 };
86 
87  int coeff6[] = { 2, 2, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 2, 1, 1, 0, 0, 0, 2, 0, 0, 2, 0, 0 };
88  int coeff7[] = { 2, 2, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 2, 0, 0, 2, 0, 0 };
89 
90  const double value0 = theDMRG->getSpecificCoefficient( coeff0 );
91  const double value1 = theDMRG->getSpecificCoefficient( coeff1 );
92  const double value2 = theDMRG->getSpecificCoefficient( coeff2 );
93  cout << "Coeff of main contribution ^9 Sigma_g^- = " << value0 << endl;
94  cout << "Coeff of | pi_x > excitation ^9 Sigma_g^- = " << value1 << endl;
95  cout << "Coeff of | pi_y > excitation ^9 Sigma_g^- = " << value2 << endl;
96  const double value3 = theDMRG->getSpecificCoefficient( coeff3 );
97  const double value4 = theDMRG->getSpecificCoefficient( coeff4 );
98  const double value5 = theDMRG->getSpecificCoefficient( coeff5 );
99  cout << "Coeff of main contribution ^7 Delta_u = " << value3 << endl;
100  cout << "Coeff of | pi_x > excitation ^7 Delta_u = " << value4 << endl;
101  cout << "Coeff of | pi_y > excitation ^7 Delta_u = " << value5 << endl;
102  const double value6 = theDMRG->getSpecificCoefficient( coeff6 );
103  const double value7 = theDMRG->getSpecificCoefficient( coeff7 );
104  cout << "Coeff of main contrib anion ^8 Sigma_u^- = " << value6 << endl;
105  cout << "Coeff of main contrib cation ^8 Sigma_u^- = " << value7 << endl;
106 
107 }
108 
int getNORB(const int irrep) const
Get the number of orbitals for an irrep.
double get(const int irrep_i, const int irrep_j, const int irrep_k, const int irrep_l, const int i, const int j, const int k, const int l) const
Get an element.
Definition: FourIndex.cpp:175
double get(const int irrep, const int i, const int j) const
Get an element.
Definition: TwoIndex.cpp:71
int getOrigNOCCstart(const int irrep) const
Get in the original Hamiltonian index the start orbital for the occupied orbitals with a certain irre...
string getIrrepName(const int irrepNumber) const
Get the name of the irrep with number irrepNumber of the activated group. The irrep with number 0 is ...
Definition: Irreps.cpp:110