修订版 | 4eb87953851d1a2fece5a9c083838e00add7c458 (tree) |
---|---|
时间 | 2011-01-28 18:23:57 |
作者 | Mikiya Fujii <mikiya.fujii@gmai...> |
Commiter | Mikiya Fujii |
Cndo2::GetTotalEnergy is modified.
git-svn-id: https://svn.sourceforge.jp/svnroot/molds/MolDS/trunk@68 1136aad2-a195-0410-b898-f5ea1d11b9d8
@@ -107,6 +107,10 @@ private: | ||
107 | 107 | void CheckNumberValenceElectrons(Molecule* molecule); |
108 | 108 | void FreeDiatomicOverlapAndRotatingMatrix(double** diatomicOverlap, double** rotatingMatrix); |
109 | 109 | double GetTotalEnergy(Molecule* molecule, double* energiesMO, double** fockMatrix, double** gammaAB); |
110 | + void FreeTotalEnergyMatrices(double** fMatrix, | |
111 | + double** hMatrix, | |
112 | + double** dammyOrbitalElectronPopulation, | |
113 | + double* dammyAtomicElectronPopulation ); | |
110 | 114 | |
111 | 115 | }; |
112 | 116 |
@@ -400,22 +404,112 @@ void Cndo2::OutputResults(double** fockMatrix, double* energiesMO, double* atomi | ||
400 | 404 | } |
401 | 405 | |
402 | 406 | double Cndo2::GetTotalEnergy(Molecule* molecule, double* energiesMO, double** fockMatrix, double** gammaAB){ |
403 | - double totalEnergy = molecule->GetTotalCoreRepulsionEnergy(); | |
407 | + double electronicEnergy = 0.0; | |
408 | + | |
409 | + // use density matrix for electronic energy | |
410 | + int totalNumberAOs = this->molecule->GetTotalNumberAOs(); | |
411 | + double** fMatrix = MallocerFreer::GetInstance()->MallocDoubleMatrix2d | |
412 | + (totalNumberAOs, totalNumberAOs); | |
413 | + double** hMatrix = MallocerFreer::GetInstance()->MallocDoubleMatrix2d | |
414 | + (totalNumberAOs, totalNumberAOs); | |
415 | + double** dammyOrbitalElectronPopulation = MallocerFreer::GetInstance()->MallocDoubleMatrix2d | |
416 | + (totalNumberAOs, totalNumberAOs); | |
417 | + double* dammyAtomicElectronPopulation = MallocerFreer::GetInstance()->MallocDoubleMatrix1d | |
418 | + (molecule->GetAtomVect()->size()); | |
419 | + | |
420 | + try{ | |
421 | + bool isGuess = false; | |
422 | + this->CalcFockMatrix(fMatrix, | |
423 | + this->molecule, | |
424 | + this->overlap, | |
425 | + this->gammaAB, | |
426 | + this->orbitalElectronPopulation, | |
427 | + this->atomicElectronPopulation, | |
428 | + isGuess); | |
429 | + this->CalcFockMatrix(hMatrix, | |
430 | + this->molecule, | |
431 | + this->overlap, | |
432 | + this->gammaAB, | |
433 | + dammyOrbitalElectronPopulation, | |
434 | + dammyAtomicElectronPopulation, | |
435 | + isGuess); | |
436 | + | |
437 | + for(int i=0; i<totalNumberAOs; i++){ | |
438 | + for(int j=i+1; j<totalNumberAOs; j++){ | |
439 | + fMatrix[j][i] = fMatrix[i][j]; | |
440 | + hMatrix[j][i] = hMatrix[i][j]; | |
441 | + } | |
442 | + } | |
443 | + | |
444 | + for(int i=0; i<totalNumberAOs; i++){ | |
445 | + for(int j=0; j<totalNumberAOs; j++){ | |
446 | + electronicEnergy += this->orbitalElectronPopulation[j][i]* | |
447 | + (fMatrix[i][j] + hMatrix[i][j]); | |
448 | + } | |
449 | + } | |
450 | + electronicEnergy *= 0.5; | |
451 | + } | |
452 | + catch(MolDSException ex){ | |
453 | + this->FreeTotalEnergyMatrices(fMatrix, | |
454 | + hMatrix, | |
455 | + dammyOrbitalElectronPopulation, | |
456 | + dammyAtomicElectronPopulation ); | |
457 | + throw ex; | |
458 | + } | |
459 | + this->FreeTotalEnergyMatrices(fMatrix, | |
460 | + hMatrix, | |
461 | + dammyOrbitalElectronPopulation, | |
462 | + dammyAtomicElectronPopulation ); | |
463 | + | |
464 | + | |
465 | + // use two electrons integrals for electronic energy | |
466 | + /* | |
404 | 467 | for(int mo=0; mo<molecule->GetTotalNumberValenceElectrons()/2; mo++){ |
405 | - totalEnergy += 2.0*energiesMO[mo]; | |
468 | + electronicEnergy += 2.0*energiesMO[mo]; | |
406 | 469 | } |
407 | 470 | |
408 | 471 | for(int moA=0; moA<molecule->GetTotalNumberValenceElectrons()/2; moA++){ |
409 | 472 | for(int moB=0; moB<molecule->GetTotalNumberValenceElectrons()/2; moB++){ |
410 | 473 | |
411 | - totalEnergy -= 2.0*this->GetMolecularIntegralElement(moA, moA, moB, moB, | |
474 | + electronicEnergy -= 2.0*this->GetMolecularIntegralElement(moA, moA, moB, moB, | |
412 | 475 | molecule, fockMatrix, gammaAB); |
413 | - totalEnergy += 1.0*this->GetMolecularIntegralElement(moA, moB, moB, moA, | |
476 | + electronicEnergy += 1.0*this->GetMolecularIntegralElement(moA, moB, moB, moA, | |
414 | 477 | molecule, fockMatrix, gammaAB); |
415 | 478 | } |
416 | 479 | } |
480 | + */ | |
481 | + | |
482 | + return electronicEnergy + molecule->GetTotalCoreRepulsionEnergy(); | |
483 | +} | |
484 | + | |
485 | +void Cndo2::FreeTotalEnergyMatrices(double** fMatrix, | |
486 | + double** hMatrix, | |
487 | + double** dammyOrbitalElectronPopulation, | |
488 | + double* dammyAtomicElectronPopulation ){ | |
489 | + | |
490 | + int totalNumberAOs = this->molecule->GetTotalNumberAOs(); | |
491 | + if(fMatrix != NULL){ | |
492 | + MallocerFreer::GetInstance()->FreeDoubleMatrix2d(fMatrix, totalNumberAOs); | |
493 | + fMatrix = NULL; | |
494 | + //cout << "fMatrix deleted\n"; | |
495 | + } | |
496 | + if(hMatrix != NULL){ | |
497 | + MallocerFreer::GetInstance()->FreeDoubleMatrix2d(hMatrix, totalNumberAOs); | |
498 | + hMatrix = NULL; | |
499 | + //cout << "hMatrix deleted\n"; | |
500 | + } | |
501 | + if(dammyOrbitalElectronPopulation != NULL){ | |
502 | + MallocerFreer::GetInstance()->FreeDoubleMatrix2d(dammyOrbitalElectronPopulation, | |
503 | + totalNumberAOs); | |
504 | + dammyOrbitalElectronPopulation = NULL; | |
505 | + //cout << "dammyOrbitalElectronPopulation deleted\n"; | |
506 | + } | |
507 | + if(dammyAtomicElectronPopulation != NULL){ | |
508 | + MallocerFreer::GetInstance()->FreeDoubleMatrix1d(dammyAtomicElectronPopulation); | |
509 | + dammyAtomicElectronPopulation = NULL; | |
510 | + //cout << "dammyAtomicElectronPopulation deleted\n"; | |
511 | + } | |
417 | 512 | |
418 | - return totalEnergy; | |
419 | 513 | } |
420 | 514 | |
421 | 515 | // The order of mol, moJ, moK, moL is consistent with Eq. (9) in [RZ_1973] |
@@ -184,6 +184,11 @@ double Indo::GetMolecularIntegralElement(int moI, int moJ, int moK, int moL, | ||
184 | 184 | *fockMatrix[moJ][nu] |
185 | 185 | *fockMatrix[moK][nu] |
186 | 186 | *fockMatrix[moL][mu]; |
187 | + value += exchange | |
188 | + *fockMatrix[moI][mu] | |
189 | + *fockMatrix[moJ][nu] | |
190 | + *fockMatrix[moK][mu] | |
191 | + *fockMatrix[moL][nu]; | |
187 | 192 | } |
188 | 193 | |
189 | 194 | coulomb = this->GetCoulombInt(orbitalMu, orbitalNu, gammaAB[A][A], atomA); |
@@ -1,7 +1,7 @@ | ||
1 | 1 | THEORY |
2 | 2 | //cndo/2 |
3 | - //indo | |
4 | - zindo/s | |
3 | + indo | |
4 | + //zindo/s | |
5 | 5 | //none |
6 | 6 | //principal_axes |
7 | 7 | //translate |