37 for ( proshade_unsign bwIt = 0; bwIt < this->
maxShellBand; bwIt++ )
43 for ( proshade_unsign shIt = 0; shIt < this->
noSpheres; shIt++ )
65 this->allocateRRPMemory ( );
68 proshade_double descValR = 0.0;
69 proshade_unsign arrPos1, arrPos2;
70 for ( proshade_unsign band = 0; band < this->maxShellBand; band++ )
73 for ( proshade_unsign shell1 = 0; shell1 < this->noSpheres; shell1++ )
78 for ( proshade_unsign shell2 = 0; shell2 < this->noSpheres; shell2++ )
80 this->rrpMatrices[band][shell1][shell2] = 0.0;
81 this->rrpMatrices[band][shell2][shell1] = 0.0;
86 for ( proshade_unsign shell2 = 0; shell2 < this->noSpheres; shell2++ )
89 if ( shell1 > shell2 ) {
continue; }
94 this->rrpMatrices[band][shell1][shell2] = 0.0;
95 this->rrpMatrices[band][shell2][shell1] = 0.0;
103 for ( proshade_unsign order = 0; order < static_cast< proshade_unsign > ( ( 2 * band ) + 1 ); order++ )
105 arrPos1 =
static_cast< proshade_unsign
> ( seanindex (
static_cast< int > ( order ) -
static_cast<int > ( band ),
106 static_cast< int > ( band ),
static_cast< int > ( this->spheres[shell1]->getLocalBandwidth() ) ) );
107 arrPos2 =
static_cast< proshade_unsign
> ( seanindex (
static_cast< int > ( order ) -
static_cast< int > ( band ),
108 static_cast< int > ( band ),
static_cast< int > ( this->spheres[shell2]->getLocalBandwidth() ) ) );
110 &this->sphericalHarmonics[shell1][arrPos1][1],
111 &this->sphericalHarmonics[shell2][arrPos2][0],
112 &this->sphericalHarmonics[shell2][arrPos2][1] );
116 this->rrpMatrices[band][shell1][shell2] = descValR;
117 this->rrpMatrices[band][shell2][shell1] = descValR;
141 if ( bandInQuestion < spheres[shellInQuestion]->getLocalBandwidth() )
167 proshade_double ret = 0.0;
168 std::vector<proshade_double> bandDists;
173 throw ProSHADE_exception (
"Attempted computing energy levels descriptors when it was not required.",
"ED00017", __FILE__, __LINE__, __func__,
"Attempted to pre-compute the RRP matrices, when the user\n : has specifically stated that these should not be computed.\n : Unless you manipulated the code, this error should never\n : occur; if you see this, I made a large blunder. Please let\n : me know!" );
188 ret =
static_cast<proshade_double
> ( std::accumulate ( bandDists.begin(), bandDists.end(), 0.0 ) ) /
189 static_cast<proshade_double
> ( bandDists.size() );
217 proshade_double *str1Vals =
new proshade_double[minCommonShells * minCommonShells];
218 proshade_double *str2Vals =
new proshade_double[minCommonShells * minCommonShells];
221 proshade_unsign arrIter = 0;
224 for ( proshade_unsign band = 0; band < minCommonBands; band++ )
230 for ( proshade_unsign shell1 = 0; shell1 < minCommonShells; shell1++ )
235 for ( proshade_unsign shell2 = 0; shell2 < minCommonShells; shell2++ )
241 str1Vals[arrIter] = obj1->
getRRPValue ( band, shell1, shell2 ) *
244 str2Vals[arrIter] = obj2->
getRRPValue ( band, shell1, shell2 ) *
278 this->maxCompBand = band;
281 this->eMatrices =
new proshade_complex** [this->maxCompBand];
284 for ( proshade_unsign bandIter = 0; bandIter < this->maxCompBand; bandIter++ )
287 this->eMatrices[bandIter] =
new proshade_complex* [
static_cast<proshade_unsign
> ( ( bandIter * 2 ) + 1 )];
290 for ( proshade_unsign band2Iter = 0; band2Iter < static_cast<proshade_unsign> ( ( bandIter * 2 ) + 1 ); band2Iter++ )
292 this->eMatrices[bandIter][band2Iter] =
new proshade_complex [
static_cast<proshade_unsign
> ( ( bandIter * 2 ) + 1 )];
315 obj1Vals =
new proshade_double [minSpheres];
316 obj2Vals =
new proshade_double [minSpheres];
317 radiiVals =
new proshade_complex[minSpheres];
318 GLabscissas =
new proshade_double [intOrder];
319 GLweights =
new proshade_double [intOrder];
350 *result *= pow (
static_cast<proshade_double
> ( obj->
getAnySphereRadius( radius ) ), 2.0 );
373 proshade_unsign objCombValsIter = 0;
374 proshade_double hlpReal, hlpImag;
375 proshade_complex arrVal;
378 for ( proshade_unsign order2Iter = 0; order2Iter < ( ( bandIter * 2 ) + 1 ); order2Iter++ )
395 &hlpReal, &hlpImag );
398 radiiVals[objCombValsIter][0] = hlpReal * pow ( (
static_cast<proshade_double
> ( obj1->
getAnySphereRadius( radiusIter ) ) ), 2.0 );
399 radiiVals[objCombValsIter][1] = hlpImag * pow ( (
static_cast<proshade_double
> ( obj1->
getAnySphereRadius( radiusIter ) ) ), 2.0 );
401 objCombValsIter += 1;
436 proshade_unsign obj1ValsIter = 0;
437 proshade_unsign obj2ValsIter = 0;
441 proshade_unsign maxSphere = 0;
448 minSphere = std::min ( radiusIter, minSphere );
449 maxSphere = std::max ( radiusIter, maxSphere );
459 proshade_single minSphereRad = obj1->
getSpherePosValue ( minSphere ) - ( sphereDist * 0.5f );
460 proshade_single maxSphereRad = obj1->
getSpherePosValue ( maxSphere ) + ( sphereDist * 0.5f );
466 return (
static_cast< proshade_double
> ( maxSphereRad - minSphereRad ) );
484 delete[] GLabscissas;
491 GLabscissas =
nullptr;
519 proshade_double *obj1Vals, *obj2Vals, *GLAbscissas, *GLWeights;
520 proshade_complex* radiiVals;
521 proshade_double integRange;
530 for ( proshade_unsign bandIter = 0; bandIter < std::min ( obj1->
getMaxBand(), obj2->
getMaxBand() ); bandIter++ )
533 for ( proshade_unsign orderIter = 0; orderIter < ( ( bandIter * 2 ) + 1 ); orderIter++ )
545 std::stringstream hlpSS;
546 hlpSS <<
"E matrices computed for band " << bandIter;
581 if ( settings->
task == Symmetry ) { eMatNormFactor /= 2.0; }
583 for ( proshade_unsign bandIter = 0; bandIter < std::min ( obj1->
getMaxBand(), obj2->
getMaxBand() ); bandIter++ )
586 for ( proshade_unsign orderIter = 0; orderIter < ( ( bandIter * 2 ) + 1 ); orderIter++ )
588 for ( proshade_unsign order2Iter = 0; order2Iter < ( ( bandIter * 2 ) + 1 ); order2Iter++ )
622 proshade_double ret = 0.0;
627 throw ProSHADE_exception (
"Attempted computing trace sigma descriptors when it was\n : not required.",
"ED00018", __FILE__, __LINE__, __func__,
"Attempted to pre-compute the E matrices, when the user\n : has specifically stated that these should not be computed.\n : Unless you manipulated the code, this error should never\n : occur; if you see this, I made a large blunder. Please let\n : me know!" );
641 double* singularValues =
new double[( ( std::min ( obj1->
getMaxBand(), obj2->
getMaxBand() ) * 2 ) + 1 )];
645 for ( proshade_unsign lIter = 0; lIter < std::min ( obj1->
getMaxBand(), obj2->
getMaxBand() ); lIter++ )
651 for ( proshade_unsign iter = 0; iter < ( ( lIter * 2 ) + 1 ); iter++ )
653 ret += singularValues[iter];
661 delete[] singularValues;
678 this->so3Coeffs =
new fftw_complex [
static_cast<proshade_unsign
>( ( 4 * pow(
static_cast<proshade_double
> ( band ), 3.0 ) -
static_cast<proshade_double
> ( band ) ) / 3.0 )];
679 this->so3CoeffsInverse =
new fftw_complex [
static_cast<proshade_unsign
>( pow(
static_cast<proshade_double
> ( band ) * 2.0, 3.0 ) )];
710 proshade_double wigNorm, hlpValReal, hlpValImag;
711 proshade_double signValue = 1.0;
712 proshade_unsign indexO;
713 proshade_complex hlpVal;
716 for ( proshade_signed bandIter = 0; bandIter < static_cast<proshade_signed> ( std::min ( obj1->
getMaxBand(), obj2->
getMaxBand() ) ); bandIter++ )
719 wigNorm = 2.0 * M_PI * sqrt ( 2.0 / (2.0 *
static_cast< proshade_double
> ( bandIter ) + 1.0 ) ) ;
722 for ( proshade_signed orderIter = 0; orderIter < ( ( bandIter * 2 ) + 1 ); orderIter++ )
725 if ( ( orderIter - bandIter + bandIter ) % 2 ) { signValue = -1.0 ; }
726 else { signValue = 1.0 ; }
729 for ( proshade_signed order2Iter = 0; order2Iter < ( ( bandIter * 2 ) + 1 ); order2Iter++ )
732 indexO =
static_cast< proshade_unsign
> ( so3CoefLoc (
static_cast< int > ( orderIter - bandIter ),
static_cast< int > ( order2Iter - bandIter ),
static_cast< int > ( bandIter ),
static_cast< int > ( std::min ( obj1->
getMaxBand(), obj2->
getMaxBand() ) ) ) );
735 obj2->
getEMatrixValue (
static_cast< proshade_unsign
> ( bandIter ),
static_cast< proshade_unsign
> ( orderIter ),
static_cast< proshade_unsign
> ( order2Iter ), &hlpValReal, &hlpValImag );
736 hlpVal[0] = hlpValReal * wigNorm * signValue;
737 hlpVal[1] = hlpValImag * wigNorm * signValue;
764 work1 =
new proshade_complex[8 *
static_cast<proshade_unsign
> ( pow(
static_cast<double> ( band ), 3.0 ) )];
765 work2 =
new proshade_complex[14 *
static_cast<proshade_unsign
> ( pow(
static_cast<double> ( band ), 2.0 ) ) + (48 * band)];
766 work3 =
new proshade_double [2 *
static_cast<proshade_unsign
> ( pow(
static_cast<double> ( band ), 2.0 ) ) + (24 * band)];
788 int howmany = 4 * band * band;
789 int idist = 2 * band;
790 int odist = 2 * band;
793 int inembed[2], onembed[2];
794 inembed[0] = 2 * band;
795 inembed[1] = 4 * band * band;
796 onembed[0] = 2 * band;
797 onembed[1] = 4 * band * band;
807 *inverseSO3 = fftw_plan_many_dft ( rank,
860 proshade_complex *workspace1, *workspace2;
861 proshade_double *workspace3;
862 fftw_plan inverseSO3;
871 Inverse_SO3_Naive_fftw (
static_cast< int > ( std::min ( obj1->
getMaxBand(), obj2->
getMaxBand() ) ),
882 fftw_destroy_plan ( inverseSO3 );
912 proshade_double ret = 0.0;
913 proshade_double eulA, eulB, eulG, EMatR, EMatI, WigDR, WigDI;
918 throw ProSHADE_exception (
"Attempted computing rotation function descriptors when it\n : was not required.",
"ED00023", __FILE__, __LINE__, __func__,
"Attempted to compute the SO(3) transform and the rotation \n : function descriptor when the user did not request this. \n : Unless you manipulated the code, this error should never \n : occur; if you see this, I made a large blunder. \n : Please let me know!" );
937 &eulA, &eulB, &eulG, settings );
943 for ( proshade_unsign bandIter = 0; bandIter < obj2->
getComparisonBand(); bandIter++ )
946 for ( proshade_unsign order1 = 0; order1 < ( ( bandIter * 2 ) + 1 ); order1++ )
949 for ( proshade_unsign order2 = 0; order2 < ( ( bandIter * 2 ) + 1 ); order2++ )