28 #include "DMRGSCFmatrix.h" 39 Isizes =
new int[ num_irreps ];
40 molden =
new double*[ num_irreps ];
41 unitary =
new double*[ num_irreps ];
42 product =
new double*[ num_irreps ];
44 for (
int irrep = 0; irrep < num_irreps; irrep++ ){
45 Isizes [ irrep ] = irrep_sizes[ irrep ];
46 molden [ irrep ] =
new double[ Isizes[ irrep ] * L ];
47 unitary[ irrep ] =
new double[ Isizes[ irrep ] * Isizes[ irrep ] ];
48 product[ irrep ] =
new double[ Isizes[ irrep ] * L ];
55 for (
int irrep = 0; irrep < num_irreps; irrep++ ){
56 delete [] molden[ irrep ];
57 delete [] unitary[ irrep ];
58 delete [] product[ irrep ];
70 int * Icounter =
new int[ num_irreps ];
71 for (
int irrep = 0; irrep < num_irreps; irrep++ ){ Icounter[ irrep ] = 0; }
73 int * psi2molpro =
new int[ num_irreps ];
78 std::ifstream inputfile( filename.c_str() );
81 string start =
"[MO]";
83 getline( inputfile, line );
84 const int pos = line.find( start );
85 if ( pos != string::npos ){ stop =
true; }
86 }
while ( stop ==
false );
88 int total_num_orbs = 0;
89 for (
int irrep = 0; irrep < num_irreps; irrep++ ){ total_num_orbs += Isizes[ irrep ]; }
91 for (
int orbs = 0; orbs < total_num_orbs; orbs++ ){
94 getline( inputfile, line );
95 const int pos_equal = line.find(
'=' );
96 const int pos_dot = line.find(
'.', pos_equal + 1 );
98 if ( pos_dot != string::npos ){
99 part = line.substr( pos_dot + 1, line.size() - 1 - pos_dot );
100 const int molpro_irrep = atoi( part.c_str() );
101 for (
int irrep = 0; irrep < num_irreps; irrep++ ){
102 if ( psi2molpro[ irrep ] == molpro_irrep ){ psi4_irrep = irrep; }
106 part = line.substr( pos_equal + 1, line.size() - 1 - pos_equal );
107 for (
int irrep = 0; irrep < num_irreps; irrep++ ){
108 if ( part.find( SymmInfo.
getIrrepName( irrep ) ) != string::npos ){ psi4_irrep = irrep; }
111 if ( part.find(
"A'" ) != string::npos ){ psi4_irrep = 0; }
112 if ( part.find(
"A\"" ) != string::npos ){ psi4_irrep = 1; }
116 assert( psi4_irrep != -1 );
119 for (
int cnt = 0; cnt < 3; cnt++ ){ getline( inputfile, line ); }
121 for (
int cnt = 0; cnt < L; cnt++ ){
122 getline( inputfile, line );
123 const int pos_number = line.find_first_not_of(
' ' );
124 const int pos_gap = line.find(
' ', pos_number );
125 part = line.substr( pos_gap + 1, line.size() - 1 - pos_gap );
126 const double value = atof( part.c_str() );
127 molden[ psi4_irrep ][ cnt + L * Icounter[ psi4_irrep ] ] = value;
131 Icounter[ psi4_irrep ] += 1;
135 for (
int irrep = 0; irrep < num_irreps; irrep++ ){
136 assert( Icounter[ irrep ] == Isizes[ irrep ] );
140 delete [] psi2molpro;
158 for (
int irrep = 0; irrep < num_irreps; irrep++ ){
159 if ( Isizes[ irrep ] > 0 ){
160 dgemm_( ¬rans, &trans, &L, Isizes + irrep, Isizes + irrep, &one, molden[ irrep ], &L, unitary[ irrep ], Isizes + irrep, &
set, product[ irrep ], &L );
166 std::ifstream inputfile( original.c_str() );
167 std::ofstream outputfile( output.c_str(), std::ofstream::trunc );
171 string start =
"[MO]";
173 getline( inputfile,line );
174 outputfile << line << std::endl;
175 const int pos = line.find( start );
176 if ( pos != string::npos ){ stop =
true; }
177 }
while ( stop ==
false );
181 for (
int irrep = 0; irrep < num_irreps; irrep++ ){
182 for (
int orb = 0; orb < Isizes[ irrep ]; orb++ ){
183 outputfile <<
" Sym= " << SymmInfo.
getIrrepName( irrep ) << std::endl;
184 outputfile <<
" Ene= N/A" << std::endl;
185 outputfile <<
" Spin= Restricted" << std::endl;
186 outputfile <<
" Occup= N/A" << std::endl;
187 for (
int cnt = 0; cnt < L; cnt++ ){
188 outputfile << cnt + 1 <<
" " << product[ irrep ][ cnt + L * orb ] << std::endl;
void print(const string original, const string output)
Multiply and print the new molden file.
bool setGroup(const int nGroup)
Set the group.
void read_molden(const string filename)
Read a molden file.
int getNumberOfIrreps() const
Get the number of irreps for the currently activated group.
void read_unitary(const string filename)
Read a unitary matrix.
static void read(const string filename, const int n_irreps, double **storage)
Read the DMRGSCFmatrix from disk.
void symm_psi2molpro(int *psi2molpro) const
Fill the array psi2molpro with the irrep conventions of molpro for the currently activated group...
int getGroupNumber() const
Get the group number.
string getGroupName() const
Get the name of the group.
Molden(const int L, const int group, int *irrep_sizes)
Constructor.
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 ...