File: CASSCFdebug.cpp

package info (click to toggle)
chemps2 1.8.12-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 5,432 kB
  • sloc: cpp: 38,521; python: 1,116; f90: 215; makefile: 45; sh: 23
file content (108 lines) | stat: -rw-r--r-- 5,334 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
   CheMPS2: a spin-adapted implementation of DMRG for ab initio quantum chemistry
   Copyright (C) 2013-2018 Sebastian Wouters

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License along
   with this program; if not, write to the Free Software Foundation, Inc.,
   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#include <stdlib.h>
#include <assert.h>
#include <iostream>
#include <math.h>

#include "CASSCF.h"

using std::cout;
using std::endl;

void CheMPS2::CASSCF::checkHF( int * docc, int * socc ){

   double EnergyHF = NUCL_ORIG;

   cout << "Single particle energy levels : " << endl;
   for ( int irrep = 0; irrep < num_irreps; irrep++ ){
      for ( int orb = 0; orb < iHandler->getNORB( irrep ); orb++ ){

         double SPenergy = TMAT_ORIG->get( irrep, orb, orb );

         const int num_beta  = (( orb < docc[ irrep ] ) ? 1 : 0 );
         const int num_alpha = (( orb < docc[ irrep ] + socc[ irrep ] ) ? 1 : 0 );
         const int num_total = num_alpha + num_beta;

         EnergyHF += num_total * TMAT_ORIG->get( irrep, orb, orb );

         for ( int irrep2 = 0; irrep2 < num_irreps; irrep2++ ){
            for ( int orb2 = 0; orb2 < iHandler->getNORB( irrep2 ); orb2++ ){

               const int num_beta2  = (( orb2 < docc[ irrep2 ] ) ? 1 : 0 );
               const int num_alpha2 = (( orb2 < docc[ irrep2 ] + socc[ irrep2 ] ) ? 1 : 0 );
               const int num_total2 = num_alpha2 + num_beta2;

               SPenergy += ( num_total2 * VMAT_ORIG->get( irrep, irrep2, irrep, irrep2, orb, orb2, orb, orb2 )
                           - num_alpha2 * VMAT_ORIG->get( irrep, irrep, irrep2, irrep2, orb, orb, orb2, orb2 ) );

               EnergyHF += 0.5 * num_total * num_total2 * VMAT_ORIG->get( irrep, irrep2, irrep, irrep2, orb, orb2, orb, orb2 );
               EnergyHF -= 0.5 * ( num_alpha * num_alpha2 + num_beta * num_beta2 ) * VMAT_ORIG->get( irrep, irrep, irrep2, irrep2, orb, orb, orb2, orb2 );

            }
         }
         cout << "   Orb " << iHandler->getOrigNOCCstart( irrep ) + orb << " : "<< orb + 1 << SymmInfo.getIrrepName(irrep) << " = " << SPenergy << endl;
      }
   }
   cout << "HF energy = " << EnergyHF << endl;

}

void CheMPS2::CASSCF::coeff_fe2( DMRG * theDMRG ){

   /*
      For the iron dimer:
         int NOCC[]  = {  5,  0,  2,  2,  0,  5,  2,  2 }; // 36 core electrons
         int NDMRG[] = {  6,  2,  3,  3,  2,  6,  3,  3 }; // 16 active space electrons, 28 active space orbitals
   */

   assert( nOrbDMRG == 28 );

   //               Ag                   B1g      B2g         B3g         Au       B1u                  B2u         B3u
   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 };
   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 };
   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 };

   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 };
   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 };
   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 };

   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 };
   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 };

   const double value0 = theDMRG->getSpecificCoefficient( coeff0 );
   const double value1 = theDMRG->getSpecificCoefficient( coeff1 );
   const double value2 = theDMRG->getSpecificCoefficient( coeff2 );
   cout << "Coeff of main contribution   ^9 Sigma_g^- = " << value0 << endl;
   cout << "Coeff of | pi_x > excitation ^9 Sigma_g^- = " << value1 << endl;
   cout << "Coeff of | pi_y > excitation ^9 Sigma_g^- = " << value2 << endl;
   const double value3 = theDMRG->getSpecificCoefficient( coeff3 );
   const double value4 = theDMRG->getSpecificCoefficient( coeff4 );
   const double value5 = theDMRG->getSpecificCoefficient( coeff5 );
   cout << "Coeff of main contribution   ^7 Delta_u   = " << value3 << endl;
   cout << "Coeff of | pi_x > excitation ^7 Delta_u   = " << value4 << endl;
   cout << "Coeff of | pi_y > excitation ^7 Delta_u   = " << value5 << endl;
   const double value6 = theDMRG->getSpecificCoefficient( coeff6 );
   const double value7 = theDMRG->getSpecificCoefficient( coeff7 );
   cout << "Coeff of main contrib  anion ^8 Sigma_u^- = " << value6 << endl;
   cout << "Coeff of main contrib cation ^8 Sigma_u^- = " << value7 << endl;

}