Revisión | d2edb109b7fa4b21091946202c303ed5bd683627 (tree) |
---|---|
Tiempo | 2012-06-04 12:35:35 |
Autor | Mikiya Fujii <mikiya.fujii@gmai...> |
Commiter | Mikiya Fujii |
Cndo2::CalcDiatomicOverlapFirstDerivative is refactored. #28554
git-svn-id: https://svn.sourceforge.jp/svnroot/molds/trunk@703 1136aad2-a195-0410-b898-f5ea1d11b9d8
@@ -3365,12 +3365,12 @@ void Cndo2::CalcOverlap(double** overlap, const Molecule& molecule) const{ | ||
3365 | 3365 | void Cndo2::CalcDiatomicOverlapFirstDerivative(double*** overlapFirstDeri, |
3366 | 3366 | const Atom& atomA, |
3367 | 3367 | const Atom& atomB) const{ |
3368 | - double Cartesian[CartesianType_end] = {atomA.GetXyz()[XAxis] - atomB.GetXyz()[XAxis], | |
3368 | + double cartesian[CartesianType_end] = {atomA.GetXyz()[XAxis] - atomB.GetXyz()[XAxis], | |
3369 | 3369 | atomA.GetXyz()[YAxis] - atomB.GetXyz()[YAxis], |
3370 | 3370 | atomA.GetXyz()[ZAxis] - atomB.GetXyz()[ZAxis]}; |
3371 | - double R = sqrt( pow(Cartesian[XAxis],2.0) + | |
3372 | - pow(Cartesian[YAxis],2.0) + | |
3373 | - pow(Cartesian[ZAxis],2.0) ); | |
3371 | + double R = sqrt( pow(cartesian[XAxis],2.0) + | |
3372 | + pow(cartesian[YAxis],2.0) + | |
3373 | + pow(cartesian[ZAxis],2.0) ); | |
3374 | 3374 | |
3375 | 3375 | double** diatomicOverlap = NULL; |
3376 | 3376 | double** diaOverlapFirstDeri = NULL; |
@@ -3378,17 +3378,10 @@ void Cndo2::CalcDiatomicOverlapFirstDerivative(double*** overlapFirstDeri, | ||
3378 | 3378 | double*** rotMatFirstDerivatives = NULL; |
3379 | 3379 | |
3380 | 3380 | try{ |
3381 | - MallocerFreer::GetInstance()->Malloc<double>(&diatomicOverlap, | |
3382 | - OrbitalType_end, | |
3383 | - OrbitalType_end); | |
3384 | - MallocerFreer::GetInstance()->Malloc<double>(&diaOverlapFirstDeri, OrbitalType_end, OrbitalType_end); | |
3385 | - MallocerFreer::GetInstance()->Malloc<double>(&rotatingMatrix, | |
3386 | - OrbitalType_end, | |
3387 | - OrbitalType_end); | |
3388 | - MallocerFreer::GetInstance()->Malloc<double>(&rotMatFirstDerivatives, | |
3389 | - OrbitalType_end, | |
3390 | - OrbitalType_end, | |
3391 | - CartesianType_end); | |
3381 | + this->MallocDiatomicOverlapFirstDeriTemps(&diatomicOverlap, | |
3382 | + &diaOverlapFirstDeri, | |
3383 | + &rotatingMatrix, | |
3384 | + &rotMatFirstDerivatives); | |
3392 | 3385 | this->CalcDiatomicOverlapInDiatomicFrame(diatomicOverlap, atomA, atomB); |
3393 | 3386 | this->CalcDiatomicOverlapFirstDerivativeInDiatomicFrame(diaOverlapFirstDeri, atomA, atomB); |
3394 | 3387 | this->CalcRotatingMatrix(rotatingMatrix, atomA, atomB); |
@@ -3407,7 +3400,7 @@ void Cndo2::CalcDiatomicOverlapFirstDerivative(double*** overlapFirstDeri, | ||
3407 | 3400 | for(int l=0; l<OrbitalType_end; l++){ |
3408 | 3401 | temp1 += rotatingMatrix[i][k] |
3409 | 3402 | *rotatingMatrix[j][l] |
3410 | - *(Cartesian[c]/R) | |
3403 | + *(cartesian[c]/R) | |
3411 | 3404 | *diaOverlapFirstDeri[k][l]; |
3412 | 3405 | temp2 += rotMatFirstDerivatives[i][k][c] |
3413 | 3406 | *rotatingMatrix[j][l] |
@@ -3609,6 +3602,16 @@ double Cndo2::GetSecondDerivativeElementFromDistanceDerivatives(double firstDist | ||
3609 | 3602 | return value; |
3610 | 3603 | } |
3611 | 3604 | |
3605 | +void Cndo2::MallocDiatomicOverlapFirstDeriTemps(double*** diatomicOverlap, | |
3606 | + double*** diaOverlapFirstDeri, | |
3607 | + double*** rotatingMatrix, | |
3608 | + double**** rotMatFirstDerivatives) const{ | |
3609 | + MallocerFreer::GetInstance()->Malloc<double>(diatomicOverlap, OrbitalType_end, OrbitalType_end); | |
3610 | + MallocerFreer::GetInstance()->Malloc<double>(diaOverlapFirstDeri, OrbitalType_end, OrbitalType_end); | |
3611 | + MallocerFreer::GetInstance()->Malloc<double>(rotatingMatrix, OrbitalType_end, OrbitalType_end); | |
3612 | + MallocerFreer::GetInstance()->Malloc<double>(rotMatFirstDerivatives, OrbitalType_end, OrbitalType_end, CartesianType_end); | |
3613 | +} | |
3614 | + | |
3612 | 3615 | void Cndo2::MallocDiatomicOverlapSecondDeriTemps(double*** diatomicOverlap, |
3613 | 3616 | double*** diaOverlapFirstDeri, |
3614 | 3617 | double*** diaOverlapSecondDeri, |
@@ -175,6 +175,10 @@ protected: | ||
175 | 175 | MolDS_base::CartesianType axisA2, |
176 | 176 | double* cartesian, |
177 | 177 | double Rab) const; |
178 | + void MallocDiatomicOverlapFirstDeriTemps(double*** diatomicOverlap, | |
179 | + double*** diaOverlapFirstDeri, | |
180 | + double*** rotatingMatrix, | |
181 | + double**** rotMatFirstDerivatives) const; | |
178 | 182 | void MallocDiatomicOverlapSecondDeriTemps(double*** diatomicOverlap, |
179 | 183 | double*** diaOverlapFirstDeri, |
180 | 184 | double*** diaOverlapSecondDeri, |