• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisão403c5717f5ef269805fe703550b7328c2a52957f (tree)
Hora2012-07-04 19:13:29
AutorMikiya Fujii <mikiya.fujii@gmai...>
CommiterMikiya Fujii

Mensagem de Log

Mndo::Calchessian is partially implemented. #28554

git-svn-id: https://svn.sourceforge.jp/svnroot/molds/trunk@865 1136aad2-a195-0410-b898-f5ea1d11b9d8

Mudança Sumário

Diff

--- a/src/base/MallocerFreer.h
+++ b/src/base/MallocerFreer.h
@@ -479,6 +479,146 @@ public:
479479 MallocerFreer::SubtCurrentMalloced(static_cast<double>(size1*size2*size3*size4*size5*size6*sizeof(T)));
480480 *matrix = NULL;
481481 }
482+
483+ //7d
484+ template<typename T> void Malloc(T******** matrix, int size1, int size2, int size3, int size4, int size5, int size6, int size7) const{
485+ if(*matrix!=NULL){
486+ return;
487+ }
488+ double wannaMalloc = static_cast<double>(size1*size2*size3*size4*size5*size6*size7*sizeof(T));
489+ this->CheckLimitHeap(wannaMalloc);
490+
491+ T *p1d=NULL, **p2d=NULL, ***p3d=NULL, ****p4d=NULL, *****p5d=NULL, ******p6d=NULL, *******p7d=NULL;
492+ try{
493+ p1d = new T[size1*size2*size3*size4*size5*size6*size7];
494+ if(p1d==NULL){
495+ throw MolDSException(this->errorMessageMallocFailure);
496+ }
497+ p2d = new T*[size1*size2*size3*size4*size5*size6];
498+ if(p2d==NULL){
499+ throw MolDSException(this->errorMessageMallocFailure);
500+ }
501+ p3d = new T**[size1*size2*size3*size4*size5];
502+ if(p3d==NULL){
503+ throw MolDSException(this->errorMessageMallocFailure);
504+ }
505+ p4d = new T***[size1*size2*size3*size4];
506+ if(p4d==NULL){
507+ throw MolDSException(this->errorMessageMallocFailure);
508+ }
509+ p5d = new T****[size1*size2*size3];
510+ if(p5d==NULL){
511+ throw MolDSException(this->errorMessageMallocFailure);
512+ }
513+ p6d = new T*****[size1*size2];
514+ if(p6d==NULL){
515+ throw MolDSException(this->errorMessageMallocFailure);
516+ }
517+ p7d = new T******[size1];
518+ if(p6d==NULL){
519+ throw MolDSException(this->errorMessageMallocFailure);
520+ }
521+
522+ for(int i=0;i<size1;i++){
523+ p7d[i] = &p6d[i*size2];
524+ for(int j=0;j<size2;j++){
525+ p7d[i][j] = &p5d[i*size2*size3+j*size3];
526+ for(int k=0;k<size3;k++){
527+ p7d[i][j][k] = &p4d[i*size2*size3*size4+j*size3*size4+k*size4];
528+ for(int l=0;l<size4;l++){
529+ p7d[i][j][k][l] = &p3d[i*size2*size3*size4*size5+
530+ j*size3*size4*size5+
531+ k*size4*size5+
532+ l*size5];
533+ for(int m=0;m<size5;m++){
534+ p7d[i][j][k][l][m] = &p2d[i*size2*size3*size4*size5*size6+
535+ j*size3*size4*size5*size6+
536+ k*size4*size5*size6+
537+ l*size5*size6+
538+ m*size6];
539+ for(int n=0;n<size6;n++){
540+ p7d[i][j][k][l][m][n] = &p1d[i*size2*size3*size4*size5*size6*size7+
541+ j*size3*size4*size5*size6*size7+
542+ k*size4*size5*size6*size7+
543+ l*size5*size6*size7+
544+ m*size6*size7+
545+ n*size7];
546+ }
547+ }
548+ }
549+ }
550+ }
551+ }
552+ *matrix = p7d;
553+ MallocerFreer::AddCurrentMalloced(wannaMalloc);
554+ this->Initialize<T>(*matrix, size1, size2, size3, size4, size5, size6, size7);
555+ }
556+ catch(MolDSException ex){
557+ if(p1d!=NULL){
558+ delete[] p1d;
559+ }
560+ if(p2d!=NULL){
561+ delete[] p2d;
562+ }
563+ if(p3d!=NULL){
564+ delete[] p3d;
565+ }
566+ if(p4d!=NULL){
567+ delete[] p4d;
568+ }
569+ if(p5d!=NULL){
570+ delete[] p5d;
571+ }
572+ if(p6d!=NULL){
573+ delete[] p6d;
574+ }
575+ if(p7d!=NULL){
576+ delete[] p7d;
577+ }
578+ throw ex;
579+ }
580+ }
581+
582+ template<typename T> void Initialize(T******* matrix, int size1, int size2, int size3, int size4, int size5, int size6, int size7) const{
583+ for(int i=0;i<size1;i++) {
584+ for(int j=0;j<size2;j++){
585+ for(int k=0;k<size3;k++){
586+ for(int l=0;l<size4;l++){
587+ for(int m=0;m<size5;m++){
588+ for(int n=0;n<size6;n++){
589+ for(int o=0;o<size7;o++){
590+ matrix[i][j][k][l][m][n][o] = 0.0;
591+ }
592+ }
593+ }
594+ }
595+ }
596+ }
597+ }
598+ }
599+
600+ template<typename T> void Free(T******** matrix, int size1, int size2, int size3, int size4, int size5, int size6, int size7) const{
601+ if(*matrix==NULL){
602+ return;
603+ }
604+ T *p1d=NULL, **p2d=NULL, ***p3d=NULL,****p4d=NULL, *****p5d=NULL, ******p6d=NULL, *******p7d=NULL;
605+ p7d = *matrix;
606+ p6d = p7d[0];
607+ p5d = p6d[0];
608+ p4d = p5d[0];
609+ p3d = p4d[0];
610+ p2d = p3d[0];
611+ p1d = p2d[0];
612+ delete [] p7d;
613+ delete [] p6d;
614+ delete [] p5d;
615+ delete [] p4d;
616+ delete [] p3d;
617+ delete [] p2d;
618+ delete [] p1d;
619+ MallocerFreer::SubtCurrentMalloced(static_cast<double>(size1*size2*size3*size4*size5*size6*size7*sizeof(T)));
620+ *matrix = NULL;
621+ }
482622 private:
483623 MallocerFreer();
484624 ~MallocerFreer();
--- a/src/mndo/Mndo.cpp
+++ b/src/mndo/Mndo.cpp
@@ -1817,7 +1817,6 @@ void Mndo::CalcHessianSCF(double** hessianSCF) const{
18171817 totalNumberAOs,
18181818 this->molecule->GetNumberAtoms(),
18191819 CartesianType_end);
1820-
18211820 this->CalcOrbitalElectronPopulationFirstDerivatives(orbitalElectronPopulationFirstDerivatives);
18221821
18231822
@@ -1828,6 +1827,7 @@ void Mndo::CalcHessianSCF(double** hessianSCF) const{
18281827 // atomA == atomB
18291828 for(int axisA2 = axisA; axisA2<CartesianType_end; axisA2++){
18301829 int l = atomAIndex*CartesianType_end + axisA2;
1830+ hessianSCF[k][l] = 0.0;
18311831 for(int atomCIndex=0; atomCIndex<this->molecule->GetNumberAtoms(); atomCIndex++){
18321832 // second derivatives of the nuclear repulsions
18331833 hessianSCF[k][l] += this->GetDiatomCoreRepulsionSecondDerivative(atomAIndex,
@@ -1849,6 +1849,7 @@ void Mndo::CalcHessianSCF(double** hessianSCF) const{
18491849 for(int atomBIndex=atomAIndex+1; atomBIndex<this->molecule->GetNumberAtoms(); atomBIndex++){
18501850 for(int axisB = XAxis; axisB<CartesianType_end; axisB++){
18511851 int l = atomAIndex*CartesianType_end + axisB;
1852+ hessianSCF[k][l] = 0.0;
18521853
18531854 // second derivatives of the nuclear repulsions
18541855 hessianSCF[k][l] -= this->GetDiatomCoreRepulsionSecondDerivative(atomAIndex,