28 #if defined ( __GNUC__ )
29 #pragma GCC diagnostic push
30 #pragma GCC diagnostic ignored "-Wpedantic"
31 #pragma GCC diagnostic ignored "-Wshadow"
32 #pragma GCC diagnostic ignored "-Wall"
33 #pragma GCC diagnostic ignored "-Wextra"
34 #pragma GCC diagnostic ignored "-Wdouble-promotion"
35 #pragma GCC diagnostic ignored "-Wconversion"
39 #if defined ( __clang__ )
40 #pragma clang diagnostic push
41 #pragma clang diagnostic ignored "-Wpedantic"
42 #pragma clang diagnostic ignored "-Wshadow"
43 #pragma clang diagnostic ignored "-Wall"
44 #pragma clang diagnostic ignored "-Wextra"
45 #pragma clang diagnostic ignored "-Wdouble-promotion"
46 #pragma clang diagnostic ignored "-Weverything"
50 #if defined ( _MSC_VER )
51 #pragma warning ( disable:4996 )
55 #define GEMMI_WRITE_IMPLEMENTATION
56 #include <gemmi/to_pdb.hpp>
59 #if defined ( _MSC_VER )
60 #pragma warning ( default:4996 )
64 #if defined ( __GNUC__ )
65 #pragma GCC diagnostic pop
69 #if defined ( __clang__ )
70 #pragma clang diagnostic pop
76 proshade_signed
addAxisUnlessSame ( proshade_unsign fold, proshade_double axX, proshade_double axY, proshade_double axZ, proshade_double axHeight, proshade_double averageFSC, std::vector< proshade_double* >* prosp, proshade_double axErr );
81 bool checkElementAlreadyExists ( std::vector<std::vector< proshade_double > >* elements, std::vector< proshade_double >* elem, proshade_double matrixTolerance );
82 bool checkElementsFormGroup ( std::vector<std::vector< proshade_double > >* elements, proshade_double matrixTolerance );
98 this->
fileType = ProSHADE_internal_io::UNKNOWN;
163 this->
spherePos = std::vector<proshade_single> ( );
214 ProSHADE_internal_data::ProSHADE_data::ProSHADE_data ( std::string strName,
double *mapVals,
int len, proshade_single xDmSz, proshade_single yDmSz, proshade_single zDmSz, proshade_unsign xDmInd, proshade_unsign yDmInd, proshade_unsign zDmInd, proshade_signed xFr, proshade_signed yFr, proshade_signed zFr, proshade_signed xT, proshade_signed yT, proshade_signed zT, proshade_unsign inputO )
218 this->fileName = strName;
219 this->fileType = ProSHADE_internal_io::MAP;
222 this->internalMap =
nullptr;
225 this->xDimSize = xDmSz;
226 this->yDimSize = yDmSz;
227 this->zDimSize = zDmSz;
231 this->xDimIndices = xDmInd;
232 this->yDimIndices = yDmInd;
233 this->zDimIndices = zDmInd;
234 this->xGridIndices = xDmInd;
235 this->yGridIndices = yDmInd;
236 this->zGridIndices = zDmInd;
237 this->xAxisOrder = 1;
238 this->yAxisOrder = 2;
239 this->zAxisOrder = 3;
240 this->xAxisOrigin = xFr;
241 this->yAxisOrigin = yFr;
242 this->zAxisOrigin = zFr;
248 this->xDimSizeOriginal = 0.0;
249 this->yDimSizeOriginal = 0.0;
250 this->zDimSizeOriginal = 0.0;
251 this->xDimIndicesOriginal = 0;
252 this->yDimIndicesOriginal = 0;
253 this->zDimIndicesOriginal = 0;
254 this->xAxisOriginOriginal = 0;
255 this->yAxisOriginOriginal = 0;
256 this->zAxisOriginOriginal = 0;
257 this->originalMapXCom = 0.0;
258 this->originalMapYCom = 0.0;
259 this->originalMapZCom = 0.0;
260 this->mapMovFromsChangeX = 0.0;
261 this->mapMovFromsChangeY = 0.0;
262 this->mapMovFromsChangeZ = 0.0;
263 this->mapCOMProcessChangeX = 0.0;
264 this->mapCOMProcessChangeY = 0.0;
265 this->mapCOMProcessChangeZ = 0.0;
268 this->originalPdbRotCenX = 0.0;
269 this->originalPdbRotCenY = 0.0;
270 this->originalPdbRotCenZ = 0.0;
271 this->originalPdbTransX = 0.0;
272 this->originalPdbTransY = 0.0;
273 this->originalPdbTransZ = 0.0;
284 this->spherePos = std::vector<proshade_single> ( );
286 this->spheres =
nullptr;
287 this->sphericalHarmonics =
nullptr;
288 this->rotSphericalHarmonics =
nullptr;
289 this->maxShellBand = 0;
292 this->rrpMatrices =
nullptr;
293 this->eMatrices =
nullptr;
294 this->so3Coeffs =
nullptr;
295 this->so3CoeffsInverse =
nullptr;
296 this->wignerMatrices =
nullptr;
297 this->integrationWeight = 0.0;
298 this->maxCompBand = 0;
299 this->translationMap =
nullptr;
302 this->isEmpty =
false;
303 this->inputOrder = inputO;
306 if (
static_cast<proshade_unsign
> ( len ) != ( xDmInd * yDmInd * zDmInd ) )
308 throw ProSHADE_exception (
"Structure class input map has wrong dimensions.",
"EP00044", __FILE__, __LINE__, __func__,
"The supplied map array size has different dimensions to\n : the required map dimensions." );
311 if ( (
static_cast<proshade_signed
> ( xT - xFr ) !=
static_cast<proshade_signed
> ( xDmInd - 1 ) ) ||
312 (
static_cast<proshade_signed
> ( yT - yFr ) !=
static_cast<proshade_signed
> ( yDmInd - 1 ) ) ||
313 (
static_cast<proshade_signed
> ( zT - zFr ) !=
static_cast<proshade_signed
> ( zDmInd - 1 ) ) )
315 throw ProSHADE_exception (
"Structure class input dimensions not in line with map\n : to/from indices.",
"EP00045", __FILE__, __LINE__, __func__,
"The supplied map information does not add up. The\n : dimensions are not in line with the indexing start/stop\n : position distances and therefore proper map indexing\n : cannot be done. Please check the input values." );
319 this->internalMap =
new proshade_double [this->xDimIndices * this->yDimIndices * this->zDimIndices];
323 proshade_unsign arrPos = 0;
324 for ( proshade_unsign xIt = 0; xIt < this->xDimIndices; xIt++ )
326 for ( proshade_unsign yIt = 0; yIt < this->yDimIndices; yIt++ )
328 for ( proshade_unsign zIt = 0; zIt < this->zDimIndices; zIt++ )
330 arrPos = zIt + this->zDimIndices * ( yIt + this->yDimIndices * xIt );
331 this->internalMap[arrPos] =
static_cast<proshade_double
> ( mapVals[arrPos] );
352 if ( this->internalMap !=
nullptr )
354 delete[] this->internalMap;
358 if ( this->spheres !=
nullptr )
360 for ( proshade_unsign iter = 0; iter < this->noSpheres; iter++ )
362 if ( this->spheres[iter] !=
nullptr )
364 delete this->spheres[iter];
365 this->spheres[iter] =
nullptr;
368 delete[] this->spheres;
372 if ( this->sphericalHarmonics !=
nullptr )
374 for ( proshade_unsign iter = 0; iter < this->noSpheres; iter++ )
376 if ( this->sphericalHarmonics[iter] !=
nullptr )
378 delete[] this->sphericalHarmonics[iter];
379 this->sphericalHarmonics[iter] =
nullptr;
382 delete[] this->sphericalHarmonics;
386 if ( this->rotSphericalHarmonics !=
nullptr )
388 for ( proshade_unsign iter = 0; iter < this->noSpheres; iter++ )
390 if ( this->rotSphericalHarmonics[iter] !=
nullptr )
392 delete[] this->rotSphericalHarmonics[iter];
393 this->rotSphericalHarmonics[iter] =
nullptr;
396 delete[] this->rotSphericalHarmonics;
400 if ( this->rrpMatrices !=
nullptr )
402 for ( proshade_unsign bwIt = 0; bwIt < this->maxShellBand; bwIt++ )
404 if ( this->rrpMatrices[bwIt] !=
nullptr )
406 for ( proshade_unsign shIt = 0; shIt < this->noSpheres; shIt++ )
408 if ( this->rrpMatrices[bwIt][shIt] !=
nullptr )
410 delete[] this->rrpMatrices[bwIt][shIt];
414 delete[] this->rrpMatrices[bwIt];
418 delete[] this->rrpMatrices;
422 if ( this->eMatrices !=
nullptr )
424 for ( proshade_unsign bandIter = 0; bandIter < this->maxCompBand; bandIter++ )
426 if ( this->eMatrices[bandIter] !=
nullptr )
428 for ( proshade_unsign band2Iter = 0; band2Iter < static_cast<proshade_unsign> ( ( bandIter * 2 ) + 1 ); band2Iter++ )
430 if ( this->eMatrices[bandIter][band2Iter] !=
nullptr )
432 delete[] this->eMatrices[bandIter][band2Iter];
436 delete[] this->eMatrices[bandIter];
440 delete[] this->eMatrices;
444 if ( this->so3Coeffs !=
nullptr )
446 delete[] this->so3Coeffs;
448 if ( this->so3CoeffsInverse !=
nullptr )
450 delete[] this->so3CoeffsInverse;
454 if ( this->wignerMatrices !=
nullptr )
456 for ( proshade_unsign bandIter = 1; bandIter < this->maxCompBand; bandIter++ )
458 if ( this->wignerMatrices[bandIter] !=
nullptr )
460 for ( proshade_unsign order1Iter = 0; order1Iter < ( (bandIter * 2) + 1 ); order1Iter++ )
462 if ( this->wignerMatrices[bandIter][order1Iter] !=
nullptr )
464 delete[] this->wignerMatrices[bandIter][order1Iter];
467 delete[] this->wignerMatrices[bandIter];
470 delete[] wignerMatrices;
474 if ( this->translationMap !=
nullptr )
476 delete[] this->translationMap;
480 if ( this->sphereMappedRotFun.size() > 0 )
482 for ( proshade_unsign spIt = 0; spIt < static_cast<proshade_unsign> ( this->sphereMappedRotFun.size() ); spIt++ )
484 delete this->sphereMappedRotFun.at(spIt);
509 void ProSHADE_internal_data::ProSHADE_data::readInStructure ( std::string fName, proshade_unsign inputO,
ProSHADE_settings* settings, proshade_double* maskArr, proshade_unsign maskXDim, proshade_unsign maskYDim, proshade_unsign maskZDim, proshade_double* weightsArr, proshade_unsign weigXDim, proshade_unsign weigYDim, proshade_unsign weigZDim )
515 if ( !this->isEmpty )
517 throw ProSHADE_exception (
"Structure data class not empty.",
"E000005", __FILE__, __LINE__, __func__,
"Attempted to read in structure into a ProSHADE_data\n : object which already does have structure read in\n : i.e. " + this->fileName );
521 this->fileName = fName;
527 this->inputOrder = inputO;
530 switch ( this->fileType )
532 case ProSHADE_internal_io::UNKNOWN:
533 throw ProSHADE_exception (
"Unknown file type.",
"E000006", __FILE__, __LINE__, __func__,
"When attempting to read the file\n : " + this->fileName +
"\n : the file extension was determined as unknown. This could\n : mean either that the file does not exist, or that it is\n : not one of the supported extensions." );
535 case ProSHADE_internal_io::GEMMI:
536 throw ProSHADE_exception (
"Unknown file type.",
"E000006", __FILE__, __LINE__, __func__,
"When attempting to read the file\n : " + this->fileName +
"\n : the file extension was determined as unknown. This could\n : mean either that the file does not exist, or that it is\n : not one of the supported extensions." );
538 case ProSHADE_internal_io::PDB:
539 this->readInPDB ( settings );
542 case ProSHADE_internal_io::MAP:
543 this->readInMAP ( settings, maskArr, maskXDim, maskYDim, maskZDim, weightsArr, weigXDim, weigYDim, weigZDim );
548 this->isEmpty =
false;
570 std::stringstream ss;
571 ss <<
"Starting to load the structure from Gemmi object " << inputO;
575 if ( !this->isEmpty )
577 throw ProSHADE_exception (
"Structure data class not empty.",
"E000005", __FILE__, __LINE__, __func__,
"Attempted to read in structure into a ProSHADE_data\n : object which already does have structure read in\n : i.e. " + this->fileName );
581 this->fileName = gemmiStruct.name;
584 this->fileType = ProSHADE_internal_io::GEMMI;
587 this->inputOrder = inputO;
590 this->readInGemmi ( gemmiStruct, settings );
593 this->isEmpty =
false;
622 gemmi::Ccp4<float> map;
623 map.read_ccp4 ( gemmi::MaybeGzipped ( this->fileName.c_str() ) );
626 map.setup ( gemmi::GridSetup::ReorderOnly, NAN );
630 &this->xDimIndices, &this->yDimIndices, &this->zDimIndices,
631 &this->xDimSize, &this->yDimSize, &this->zDimSize,
632 &this->aAngle, &this->bAngle, &this->cAngle,
633 &this->xFrom, &this->yFrom, &this->zFrom,
634 &this->xAxisOrigin, &this->yAxisOrigin, &this->zAxisOrigin,
635 &this->xAxisOrder, &this->yAxisOrder, &this->zAxisOrder,
636 &this->xGridIndices, &this->yGridIndices, &this->zGridIndices );
639 ProSHADE_internal_io::readInMapData ( &map, this->internalMap, this->xDimIndices, this->yDimIndices, this->zDimIndices, this->xAxisOrder, this->yAxisOrder, this->zAxisOrder );
643 maskArr, maskXDim, maskYDim, maskZDim );
647 weightsArr, weigXDim, weigYDim, weigZDim );
650 if ( settings->
removeNegativeDensity ) {
for (
size_t iter = 0; iter < static_cast< size_t > ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ ) {
if ( this->internalMap[iter] < 0.0 ) { this->internalMap[iter] = 0.0; } } }
655 settings->
setResolution ( std::min (
static_cast<proshade_single
> ( this->xDimSize ) /
static_cast<proshade_single
> ( this->xDimIndices ),
656 std::min (
static_cast<proshade_single
> ( this->yDimSize ) /
static_cast<proshade_single
> ( this->yDimIndices ),
657 static_cast<proshade_single
> ( this->zDimSize ) /
static_cast<proshade_single
> ( this->zDimIndices ) ) ) * 2.0f );
661 this->figureIndexStartStop ( );
664 this->reSampleMap ( settings );
667 this->xDimSizeOriginal = this->xDimSize;
668 this->yDimSizeOriginal = this->yDimSize;
669 this->zDimSizeOriginal = this->zDimSize;
672 this->xDimIndicesOriginal = this->xDimIndices;
673 this->yDimIndicesOriginal = this->yDimIndices;
674 this->zDimIndicesOriginal = this->zDimIndices;
677 this->xAxisOriginOriginal = this->xAxisOrigin;
678 this->yAxisOriginOriginal = this->yAxisOrigin;
679 this->zAxisOriginOriginal = this->zAxisOrigin;
682 this->findMapCOM ( );
683 this->originalMapXCom = this->xCom;
684 this->originalMapYCom = this->yCom;
685 this->originalMapZCom = this->zCom;
709 gemmi::Structure pdbFile = gemmi::read_structure ( gemmi::MaybeGzipped ( this->fileName ) );
712 this->readInGemmi ( pdbFile, settings );
756 proshade_double xCOMPdb, yCOMPdb, zCOMPdb;
760 proshade_single xF = 0.0f, xT = 0.0f, yF = 0.0f, yT = 0.0f, zF = 0.0f, zT = 0.0f;
764 proshade_single xMov =
static_cast< proshade_single
> ( settings->
coOrdsExtraSpace - xF );
765 proshade_single yMov =
static_cast< proshade_single
> ( settings->
coOrdsExtraSpace - yF );
766 proshade_single zMov =
static_cast< proshade_single
> ( settings->
coOrdsExtraSpace - zF );
770 this->xDimSize =
static_cast< proshade_single
> ( xT - xF + ( 2.0f * settings->
coOrdsExtraSpace ) );
771 this->yDimSize =
static_cast< proshade_single
> ( yT - yF + ( 2.0f * settings->
coOrdsExtraSpace ) );
772 this->zDimSize =
static_cast< proshade_single
> ( zT - zF + ( 2.0f * settings->
coOrdsExtraSpace ) );
775 ProSHADE_internal_mapManip::generateMapFromPDB ( gemmiStruct, this->internalMap, settings->
requestedResolution, this->xDimSize, this->yDimSize, this->zDimSize, &this->xTo, &this->yTo, &this->zTo, settings->
forceP1, settings->
firstModelOnly );
778 if ( settings->
removeNegativeDensity ) {
for (
size_t iter = 0; iter < static_cast< size_t > ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ ) {
if ( this->internalMap[iter] < 0.0 ) { this->internalMap[iter] = 0.0; } } }
781 this->setPDBMapValues ( );
785 &this->xFrom, &this->xTo, &this->yFrom, &this->yTo, &this->zFrom, &this->zTo,
786 &this->xAxisOrigin, &this->yAxisOrigin, &this->zAxisOrigin );
788 static_cast< proshade_signed
> ( this->xDimIndices ),
static_cast< proshade_signed
> ( this->yDimIndices ),
789 static_cast< proshade_signed
> ( this->zDimIndices ) );
792 this->reSampleMap ( settings );
795 this->xDimSizeOriginal = this->xDimSize;
796 this->yDimSizeOriginal = this->yDimSize;
797 this->zDimSizeOriginal = this->zDimSize;
800 this->xDimIndicesOriginal = this->xDimIndices;
801 this->yDimIndicesOriginal = this->yDimIndices;
802 this->zDimIndicesOriginal = this->zDimIndices;
805 this->xAxisOriginOriginal = this->xAxisOrigin;
806 this->yAxisOriginOriginal = this->yAxisOrigin;
807 this->zAxisOriginOriginal = this->zAxisOrigin;
810 this->findMapCOM ( );
811 this->originalMapXCom = this->xCom;
812 this->originalMapYCom = this->yCom;
813 this->originalMapZCom = this->zCom;
837 this->xDimIndices =
static_cast< proshade_unsign
> ( this->xTo );
838 this->yDimIndices =
static_cast< proshade_unsign
> ( this->yTo );
839 this->zDimIndices =
static_cast< proshade_unsign
> ( this->zTo );
847 this->xGridIndices = this->xDimIndices;
848 this->yGridIndices = this->yDimIndices;
849 this->zGridIndices = this->zDimIndices;
852 this->xAxisOrder = 1;
853 this->yAxisOrder = 2;
854 this->zAxisOrder = 3;
857 this->xAxisOrigin = this->xFrom;
858 this->yAxisOrigin = this->yFrom;
859 this->zAxisOrigin = this->zFrom;
873 this->xTo = this->xFrom +
static_cast< proshade_signed
> ( this->xDimIndices ) - 1;
874 this->yTo = this->yFrom +
static_cast< proshade_signed
> ( this->yDimIndices ) - 1;
875 this->zTo = this->zFrom +
static_cast< proshade_signed
> ( this->zDimIndices ) - 1;
895 gemmi::Grid<float> mapData;
896 mapData.set_unit_cell (
static_cast< double > ( this->xDimSize ),
static_cast< double > ( this->yDimSize ),
static_cast< double > ( this->zDimSize ),
static_cast< double > ( this->aAngle ),
static_cast< double > ( this->bAngle ),
static_cast< double > ( this->cAngle ) );
897 mapData.set_size_without_checking (
static_cast< int > ( this->xDimIndices ),
static_cast< int > ( this->yDimIndices ),
static_cast< int > ( this->zDimIndices ) );
898 mapData.axis_order = gemmi::AxisOrder::XYZ;
899 mapData.spacegroup = &gemmi::get_spacegroup_p1();
902 gemmi::Ccp4<float> map;
904 map.update_ccp4_header ( mode );
908 this->xDimIndices, this->yDimIndices, this->zDimIndices,
909 this->xDimSize, this->yDimSize, this->zDimSize,
910 this->aAngle, this->bAngle, this->cAngle,
911 this->xFrom, this->yFrom, this->zFrom,
912 this->xAxisOrigin, this->yAxisOrigin, this->zAxisOrigin,
913 this->xAxisOrder, this->yAxisOrder, this->zAxisOrder,
914 this->xGridIndices, this->yGridIndices, this->zGridIndices,
918 proshade_unsign arrPos = 0;
919 for ( proshade_unsign uIt = 0; uIt < this->xDimIndices; uIt++ )
921 for ( proshade_unsign vIt = 0; vIt < this->yDimIndices; vIt++ )
923 for ( proshade_unsign wIt = 0; wIt < this->zDimIndices; wIt++ )
925 arrPos = wIt + this->zDimIndices * ( vIt + this->yDimIndices * uIt );
926 map.grid.set_value (
static_cast< int > ( uIt ),
static_cast< int > ( vIt ),
static_cast< int > ( wIt ),
static_cast<float> ( this->internalMap[arrPos] ) );
932 map.update_ccp4_header ( mode,
true );
935 map.write_ccp4_map ( fName );
959 void ProSHADE_internal_data::ProSHADE_data::writePdb ( std::string fName, proshade_double euA, proshade_double euB, proshade_double euG, proshade_double trsX, proshade_double trsY, proshade_double trsZ, proshade_double rotX, proshade_double rotY, proshade_double rotZ,
bool firstModel )
964 throw ProSHADE_exception (
"Cannot write co-ordinate file if the input file did not contain co-ordinates.",
"EP00047", __FILE__, __LINE__, __func__,
"You have called the WritePDB function on structure which\n : was created by reading in a map. This is not allowed as\n : ProSHADE cannot create co-ordinates from map file." );
968 gemmi::Structure pdbFile = gemmi::read_structure ( gemmi::MaybeGzipped ( this->fileName ) );
971 this->writeGemmi ( fName, pdbFile, euA, euB, euG, trsX, trsY, trsZ, rotX, rotY, rotZ, firstModel );
996 void ProSHADE_internal_data::ProSHADE_data::writeGemmi ( std::string fName, gemmi::Structure gemmiStruct, proshade_double euA, proshade_double euB, proshade_double euG, proshade_double trsX, proshade_double trsY, proshade_double trsZ, proshade_double rotX, proshade_double rotY, proshade_double rotZ,
bool firstModel )
999 if ( ( euA != 0.0 ) || ( euB != 0.0 ) || ( euG != 0.0 ) )
1009 std::ofstream outCoOrdFile;
1010 outCoOrdFile.open ( fName.c_str() );
1012 if ( outCoOrdFile.is_open() )
1014 gemmi::PdbWriteOptions opt;
1015 write_pdb ( gemmiStruct, outCoOrdFile, opt );
1019 std::stringstream hlpMessage;
1020 hlpMessage <<
"Failed to open the PDB file " << fName <<
" for output.";
1021 throw ProSHADE_exception ( hlpMessage.str().c_str(),
"EP00048", __FILE__, __LINE__, __func__,
"ProSHADE has failed to open the PDB output file. This is\n : likely caused by either not having the write privileges\n : to the required output path, or by making a mistake in\n : the path." );
1024 outCoOrdFile.close ( );
1041 proshade_double* hlpMap =
new proshade_double[this->xDimIndices * this->yDimIndices * this->zDimIndices];
1045 for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
1047 hlpMap[iter] = this->internalMap[iter];
1048 this->internalMap[iter] = mask[iter];
1052 this->writeMap ( fName );
1055 for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
1057 this->internalMap[iter] = hlpMap[iter];
1078 std::stringstream ss;
1079 ss <<
"Moving map box centre to " << settings->
boxCentre.at(0) <<
"; " << settings->
boxCentre.at(1) <<
"; " << settings->
boxCentre.at(2) <<
" .";
1083 proshade_double xSamplingRate =
static_cast<proshade_double
> ( this->xDimSize ) /
static_cast<proshade_double
> ( this->xDimIndices );
1084 proshade_double ySamplingRate =
static_cast<proshade_double
> ( this->yDimSize ) /
static_cast<proshade_double
> ( this->yDimIndices );
1085 proshade_double zSamplingRate =
static_cast<proshade_double
> ( this->zDimSize ) /
static_cast<proshade_double
> ( this->zDimIndices );
1088 proshade_double startCentreX = ( ( (
static_cast<proshade_double
> ( this->xTo ) -
static_cast<proshade_double
> ( this->xFrom ) ) / 2.0 ) * xSamplingRate );
1089 proshade_double startCentreY = ( ( (
static_cast<proshade_double
> ( this->yTo ) -
static_cast<proshade_double
> ( this->yFrom ) ) / 2.0 ) * ySamplingRate );
1090 proshade_double startCentreZ = ( ( (
static_cast<proshade_double
> ( this->zTo ) -
static_cast<proshade_double
> ( this->zFrom ) ) / 2.0 ) * zSamplingRate );
1093 proshade_double boxStartX = settings->
boxCentre.at(0) - (
static_cast<proshade_double
> ( this->xFrom ) * xSamplingRate );
1094 proshade_double boxStartY = settings->
boxCentre.at(1) - (
static_cast<proshade_double
> ( this->yFrom ) * ySamplingRate );
1095 proshade_double boxStartZ = settings->
boxCentre.at(2) - (
static_cast<proshade_double
> ( this->zFrom ) * zSamplingRate );
1098 proshade_double xShift = startCentreX - boxStartX;
1099 proshade_double yShift = startCentreY - boxStartY;
1100 proshade_double zShift = startCentreZ - boxStartZ;
1103 if ( ( ( settings->
boxCentre.at(0) < (
static_cast<proshade_double
> ( this->xFrom ) * xSamplingRate ) ) ||
1104 ( settings->
boxCentre.at(0) > (
static_cast<proshade_double
> ( this->xFrom ) * xSamplingRate +
static_cast<proshade_double
> ( this->xDimSize ) ) ) ) ||
1105 ( ( settings->
boxCentre.at(1) < (
static_cast<proshade_double
> ( this->yFrom ) * ySamplingRate ) ) ||
1106 ( settings->
boxCentre.at(1) > (
static_cast<proshade_double
> ( this->yFrom ) * ySamplingRate +
static_cast<proshade_double
> ( this->yDimSize ) ) ) ) ||
1107 ( ( settings->
boxCentre.at(2) < (
static_cast<proshade_double
> ( this->zFrom ) * zSamplingRate ) ) ||
1108 ( settings->
boxCentre.at(2) > (
static_cast<proshade_double
> ( this->zFrom ) * zSamplingRate +
static_cast<proshade_double
> ( this->zDimSize ) ) ) ) )
1115 static_cast< proshade_single
> ( xShift ),
1116 static_cast< proshade_single
> ( yShift ),
1117 static_cast< proshade_single
> ( zShift ),
1118 this->xDimSize, this->yDimSize, this->zDimSize,
1119 static_cast< proshade_signed
> ( this->xDimIndices ),
1120 static_cast< proshade_signed
> ( this->yDimIndices ),
1121 static_cast< proshade_signed
> ( this->zDimIndices ) );
1124 std::stringstream ss2;
1125 ss2 <<
"Position " << settings->
boxCentre.at(0) <<
"; " << settings->
boxCentre.at(1) <<
"; " << settings->
boxCentre.at(2) <<
" set at the centre of the map box.";
1143 std::stringstream ss;
1149 static_cast< proshade_single
> ( -settings->
centrePosition.at(0) ),
1150 static_cast< proshade_single
> ( -settings->
centrePosition.at(1) ),
1151 static_cast< proshade_single
> ( -settings->
centrePosition.at(2) ),
1152 this->xDimSize, this->yDimSize, this->zDimSize,
1153 static_cast< proshade_signed
> ( this->xDimIndices ),
1154 static_cast< proshade_signed
> ( this->yDimIndices ),
1155 static_cast< proshade_signed
> ( this->zDimIndices ) );
1158 std::stringstream ss2;
1181 proshade_signed arrayPos, invPos;
1184 proshade_double* hlpMap =
new proshade_double [this->xDimIndices * this->yDimIndices * this->zDimIndices];
1188 for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
1190 hlpMap[iter] = this->internalMap[iter];
1194 for ( proshade_signed xIt = 0; xIt < static_cast<proshade_signed> ( this->xDimIndices ); xIt++ )
1196 for ( proshade_signed yIt = 0; yIt < static_cast<proshade_signed> ( this->yDimIndices ); yIt++ )
1198 for ( proshade_signed zIt = 0; zIt < static_cast<proshade_signed> ( this->zDimIndices ); zIt++ )
1201 arrayPos = zIt +
static_cast< proshade_signed
> ( this->zDimIndices ) * ( yIt +
static_cast< proshade_signed
> ( this->yDimIndices ) * xIt );
1202 invPos = (
static_cast< proshade_signed
> ( this->zDimIndices - 1 ) - zIt ) +
static_cast< proshade_signed
> ( this->zDimIndices ) * ( (
static_cast< proshade_signed
> ( this->yDimIndices - 1 ) - yIt ) +
static_cast< proshade_signed
> ( this->yDimIndices ) * (
static_cast< proshade_signed
> ( this->xDimIndices - 1 ) - xIt ) );
1205 this->internalMap[invPos] = hlpMap[arrayPos];
1235 std::vector<proshade_double> mapVals ( this->xDimIndices * this->yDimIndices * this->zDimIndices, 0.0 );
1238 for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
1240 mapVals.at(iter) = this->internalMap[iter];
1244 proshade_double* meanSD =
new proshade_double[2];
1248 for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
1250 this->internalMap[iter] = ( this->internalMap[iter] - meanSD[0] ) / meanSD[1];
1282 proshade_double* blurredMap =
new proshade_double[this->xDimIndices * this->yDimIndices * this->zDimIndices];
1287 this->xDimSize, this->yDimSize, this->zDimSize, settings->
blurFactor );
1293 if ( settings->
saveMask ) {
if ( settings->
maskFileName ==
"" ) { this->writeMask (
"proshade_mask.map", blurredMap ); }
else { std::stringstream ss; ss << settings->
maskFileName <<
"_" << this->inputOrder <<
".map"; this->writeMask ( ss.str(), blurredMap ); } }
1296 delete[] blurredMap;
1324 for ( proshade_unsign iter = 0; iter < 6; iter++ ) { ret[iter] = settings->
forceBounds[iter]; }
1331 static_cast< proshade_signed
> ( this->xDimIndices ),
1332 static_cast< proshade_signed
> ( this->yDimIndices ),
1333 static_cast< proshade_signed
> ( this->zDimIndices ),
1338 this->xDimSize, this->yDimSize, this->zDimSize, ret, settings->
boundsExtraSpace );
1344 std::stringstream ssHlp;
1345 ssHlp <<
"New boundaries are: " << ret[1] - ret[0] + 1 <<
" x " << ret[3] - ret[2] + 1 <<
" x " << ret[5] - ret[4] + 1;
1351 for ( proshade_unsign iter = 0; iter < 6; iter++ ) { settings->
forceBounds[iter] = ret[iter]; }
1381 newStr->
fileType = ProSHADE_internal_io::MAP;
1384 newStr->
xDimIndices =
static_cast< proshade_unsign
> ( newBounds[1] ) -
static_cast< proshade_unsign
> ( newBounds[0] ) + 1;
1385 newStr->
yDimIndices =
static_cast< proshade_unsign
> ( newBounds[3] ) -
static_cast< proshade_unsign
> ( newBounds[2] ) + 1;
1386 newStr->
zDimIndices =
static_cast< proshade_unsign
> ( newBounds[5] ) -
static_cast< proshade_unsign
> ( newBounds[4] ) + 1;
1388 newStr->
aAngle = this->aAngle;
1389 newStr->
bAngle = this->aAngle;
1390 newStr->
cAngle = this->aAngle;
1392 newStr->
xDimSize =
static_cast<proshade_single
> ( newStr->
xDimIndices ) * ( this->xDimSize /
static_cast<proshade_single
> ( this->xDimIndices ) );
1393 newStr->
yDimSize =
static_cast<proshade_single
> ( newStr->
yDimIndices ) * ( this->yDimSize /
static_cast<proshade_single
> ( this->yDimIndices ) );
1394 newStr->
zDimSize =
static_cast<proshade_single
> ( newStr->
zDimIndices ) * ( this->zDimSize /
static_cast<proshade_single
> ( this->zDimIndices ) );
1404 newStr->
xAxisOrigin = this->xAxisOrigin + newBounds[0];
1405 newStr->
yAxisOrigin = this->yAxisOrigin + newBounds[2];
1406 newStr->
zAxisOrigin = this->zAxisOrigin + newBounds[4];
1408 newStr->
xFrom = this->xFrom + newBounds[0];
1409 newStr->
yFrom = this->yFrom + newBounds[2];
1410 newStr->
zFrom = this->zFrom + newBounds[4];
1412 newStr->
xTo = this->xTo - (
static_cast< proshade_signed
> ( this->xDimIndices - 1 ) - newBounds[1] );
1413 newStr->
yTo = this->yTo - (
static_cast< proshade_signed
> ( this->yDimIndices - 1 ) - newBounds[3] );
1414 newStr->
zTo = this->zTo - (
static_cast< proshade_signed
> ( this->zDimIndices - 1 ) - newBounds[5] );
1423 this->xDimIndices, this->yDimIndices, this->zDimIndices, newStr->
internalMap, this->internalMap );
1446 proshade_single* changeVals =
new proshade_single[6];
1449 proshade_double xMapCOMPreReSampl = 0.0, yMapCOMPreReSampl = 0.0, zMapCOMPreReSampl = 0.0;
1450 ProSHADE_internal_mapManip::findMAPCOMValues ( this->internalMap, &xMapCOMPreReSampl, &yMapCOMPreReSampl, &zMapCOMPreReSampl, this->xDimSize, this->yDimSize, this->zDimSize, this->xFrom, this->xTo, this->yFrom, this->yTo, this->zFrom, this->zTo );
1456 this->xDimSize, this->yDimSize, this->zDimSize, changeVals );
1466 this->xDimSize, this->yDimSize, this->zDimSize, changeVals );
1471 this->xDimIndices +=
static_cast<proshade_unsign
> ( changeVals[0] );
1472 this->yDimIndices +=
static_cast<proshade_unsign
> ( changeVals[1] );
1473 this->zDimIndices +=
static_cast<proshade_unsign
> ( changeVals[2] );
1475 this->xGridIndices = this->xDimIndices;
1476 this->yGridIndices = this->yDimIndices;
1477 this->zGridIndices = this->zDimIndices;
1479 this->xTo +=
static_cast<proshade_unsign
> ( changeVals[0] );
1480 this->yTo +=
static_cast<proshade_unsign
> ( changeVals[1] );
1481 this->zTo +=
static_cast<proshade_unsign
> ( changeVals[2] );
1483 this->xDimSize = changeVals[3];
1484 this->yDimSize = changeVals[4];
1485 this->zDimSize = changeVals[5];
1488 proshade_double xMapCOMPostReSampl = 0.0, yMapCOMPostReSampl = 0.0, zMapCOMPostReSampl = 0.0;
1489 ProSHADE_internal_mapManip::findMAPCOMValues ( this->internalMap, &xMapCOMPostReSampl, &yMapCOMPostReSampl, &zMapCOMPostReSampl, this->xDimSize, this->yDimSize, this->zDimSize, this->xFrom, this->xTo, this->yFrom, this->yTo, this->zFrom, this->zTo );
1492 proshade_single xMov =
static_cast< proshade_single
> ( xMapCOMPostReSampl - xMapCOMPreReSampl );
1493 proshade_single yMov =
static_cast< proshade_single
> ( yMapCOMPostReSampl - yMapCOMPreReSampl );
1494 proshade_single zMov =
static_cast< proshade_single
> ( zMapCOMPostReSampl - zMapCOMPreReSampl );
1498 &this->yFrom, &this->yTo, &this->zFrom, &this->zTo, &this->xAxisOrigin, &this->yAxisOrigin, &this->zAxisOrigin );
1501 static_cast< proshade_signed
> ( this->xDimIndices ),
static_cast< proshade_signed
> ( this->yDimIndices ),
static_cast< proshade_signed
> ( this->zDimIndices ) );
1504 delete[] changeVals;
1526 proshade_double xCOM = 0.0;
1527 proshade_double yCOM = 0.0;
1528 proshade_double zCOM = 0.0;
1532 this->xDimSize, this->yDimSize, this->xDimSize, this->xFrom,
1533 this->xTo, this->yFrom, this->yTo, this->zFrom, this->zTo );
1536 proshade_single xSampRate =
static_cast< proshade_single
> ( this->xDimSize ) /
static_cast< proshade_single
> ( this->xTo - this->xFrom );
1537 proshade_single ySampRate =
static_cast< proshade_single
> ( this->yDimSize ) /
static_cast< proshade_single
> ( this->yTo - this->yFrom );
1538 proshade_single zSampRate =
static_cast< proshade_single
> ( this->zDimSize ) /
static_cast< proshade_single
> ( this->zTo - this->zFrom );
1541 xCOM /=
static_cast< proshade_double
> ( xSampRate );
1542 yCOM /=
static_cast< proshade_double
> ( ySampRate );
1543 zCOM /=
static_cast< proshade_double
> ( zSampRate );
1545 xCOM -=
static_cast< proshade_double
> ( this->xFrom );
1546 yCOM -=
static_cast< proshade_double
> ( this->yFrom );
1547 zCOM -=
static_cast< proshade_double
> ( this->zFrom );
1550 proshade_double xDist = ( (
static_cast<proshade_double
> ( this->xDimIndices ) / 2.0 ) - xCOM ) *
static_cast<proshade_double
> ( this->xDimSize ) /
static_cast<proshade_double
> ( this->xDimIndices );
1551 proshade_double yDist = ( (
static_cast<proshade_double
> ( this->yDimIndices ) / 2.0 ) - yCOM ) *
static_cast<proshade_double
> ( this->yDimSize ) /
static_cast<proshade_double
> ( this->yDimIndices );
1552 proshade_double zDist = ( (
static_cast<proshade_double
> ( this->zDimIndices ) / 2.0 ) - zCOM ) *
static_cast<proshade_double
> ( this->zDimSize ) /
static_cast<proshade_double
> ( this->zDimIndices );
1556 static_cast< proshade_single
> ( xDist ),
1557 static_cast< proshade_single
> ( yDist ),
1558 static_cast< proshade_single
> ( zDist ),
1559 this->xDimSize, this->yDimSize, this->zDimSize,
1560 static_cast< proshade_signed
> ( this->xDimIndices ),
1561 static_cast< proshade_signed
> ( this->yDimIndices ),
1562 static_cast< proshade_signed
> ( this->zDimIndices ) );
1565 this->mapCOMProcessChangeX -= xDist;
1566 this->mapCOMProcessChangeY -= yDist;
1567 this->mapCOMProcessChangeZ -= zDist;
1588 std::stringstream hlpSS;
1589 hlpSS <<
"Adding extra " << settings->
addExtraSpace <<
" angstroms.";
1598 this->xDimSize += 2 *
static_cast<proshade_single
> ( xAddIndices ) * this->xDimSize /
static_cast<proshade_single
> ( this->xDimIndices );
1599 this->yDimSize += 2 *
static_cast<proshade_single
> ( yAddIndices ) * this->yDimSize /
static_cast<proshade_single
> ( this->yDimIndices );
1600 this->zDimSize += 2 *
static_cast<proshade_single
> ( zAddIndices ) * this->zDimSize /
static_cast<proshade_single
> ( this->zDimIndices );
1602 this->xDimIndices += 2 * xAddIndices;
1603 this->yDimIndices += 2 * yAddIndices;
1604 this->zDimIndices += 2 * zAddIndices;
1606 this->xGridIndices = this->xDimIndices;
1607 this->yGridIndices = this->yDimIndices;
1608 this->zGridIndices = this->zDimIndices;
1610 this->xAxisOrigin -= xAddIndices;
1611 this->yAxisOrigin -= yAddIndices;
1612 this->zAxisOrigin -= zAddIndices;
1614 this->xFrom -= xAddIndices;
1615 this->yFrom -= yAddIndices;
1616 this->zFrom -= zAddIndices;
1618 this->xTo += xAddIndices;
1619 this->yTo += yAddIndices;
1620 this->zTo += zAddIndices;
1623 proshade_double* newMap =
new proshade_double[this->xDimIndices * this->yDimIndices * this->zDimIndices];
1627 for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
1633 proshade_unsign newMapIndex, oldMapIndex;
1634 for ( proshade_unsign xIt = 0; xIt < (this->xDimIndices - xAddIndices); xIt++ )
1637 if ( xIt < xAddIndices ) {
continue; }
1639 for ( proshade_unsign yIt = 0; yIt < (this->yDimIndices - yAddIndices); yIt++ )
1642 if ( yIt < yAddIndices ) {
continue; }
1644 for ( proshade_unsign zIt = 0; zIt < (this->zDimIndices - zAddIndices); zIt++ )
1647 if ( zIt < zAddIndices ) {
continue; }
1650 newMapIndex = zIt + this->zDimIndices * ( yIt + this->yDimIndices * xIt );
1651 oldMapIndex = (zIt - zAddIndices) + (this->zDimIndices - ( 2 * zAddIndices ) ) * ( (yIt - yAddIndices) + (this->yDimIndices - ( 2 * yAddIndices ) ) * (xIt - xAddIndices) );
1653 newMap[newMapIndex] = this->internalMap[oldMapIndex];
1659 delete[] this->internalMap;
1661 this->internalMap =
new proshade_double[this->xDimIndices * this->yDimIndices * this->zDimIndices];
1664 for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
1666 this->internalMap[iter] = newMap[iter];
1698 if ( !( ( std::isinf ( settings->
boxCentre.at(0) ) ) || ( std::isinf ( settings->
boxCentre.at(1) ) ) || ( std::isinf ( settings->
boxCentre.at(2) ) ) ) ) { this->shiftToBoxCentre ( settings ); }
1702 if ( !( ( std::isinf ( settings->
centrePosition.at(0) ) ) || ( std::isinf ( settings->
centrePosition.at(1) ) ) || ( std::isinf ( settings->
centrePosition.at(2) ) ) ) ) { this->shiftToRotationCentre ( settings ); }
1706 if ( settings->
invertMap ) { this->invertMirrorMap ( settings ); }
1710 if ( settings->
normaliseMap ) { this->normaliseMap ( settings ); }
1714 if ( settings->
maskMap ) { this->maskMap ( settings ); }
1718 if ( settings->
moveToCOM ) { this->centreMapOnCOM ( settings ); }
1726 if ( settings->
addExtraSpace != 0.0f ) { this->addExtraSpace ( settings ); }
1749 if ( this->spherePos.size() != 0 )
1751 std::stringstream hlpSS;
1752 hlpSS <<
"The sphere distances were determined as " << this->spherePos.at(0);
1753 for ( proshade_unsign iter = 1; iter < static_cast<proshade_unsign> ( this->spherePos.size() ); iter++ ) { hlpSS <<
"; " << this->spherePos.at(iter); }
1754 hlpSS <<
" Angstroms.";
1760 proshade_unsign maxDim =
static_cast< proshade_unsign
> ( std::max ( this->xDimSize, std::max ( this->yDimSize, this->zDimSize ) ) );
1761 proshade_unsign minDim =
static_cast< proshade_unsign
> ( std::min ( this->xDimSize, std::min ( this->yDimSize, this->zDimSize ) ) );
1762 proshade_unsign midDim =
static_cast< proshade_unsign
> ( 0 );
1763 if ( ( this->xDimSize <
static_cast< proshade_single
> ( maxDim ) ) && ( this->xDimSize >
static_cast< proshade_single
> ( minDim ) ) ) { midDim =
static_cast< proshade_unsign
> ( this->xDimSize ); }
1764 else if ( ( this->yDimSize <
static_cast< proshade_single
> ( maxDim ) ) && ( this->yDimSize >
static_cast< proshade_single
> ( minDim ) ) ) { midDim =
static_cast< proshade_unsign
> ( this->yDimSize ); }
1765 else { midDim =
static_cast< proshade_unsign
> ( this->zDimSize ); }
1767 proshade_single maxDiag =
static_cast< proshade_single
> ( std::sqrt ( std::pow (
static_cast<proshade_single
> ( maxDim ), 2.0 ) +
1768 std::pow (
static_cast<proshade_single
> ( midDim ), 2.0 ) ) );
1771 for ( proshade_single iter = 0.5f; ( iter * settings->
maxSphereDists ) < ( maxDiag / 2.0f ); iter += 1.0f )
1777 this->noSpheres =
static_cast<proshade_unsign
> ( this->spherePos.size() );
1780 std::stringstream hlpSS;
1781 hlpSS <<
"The sphere distances were determined as " << this->spherePos.at(0);
1782 for ( proshade_unsign iter = 1; iter < static_cast<proshade_unsign> ( this->spherePos.size() ); iter++ ) { hlpSS <<
"; " << this->spherePos.at(iter); }
1783 hlpSS <<
" Angstroms.";
1810 this->xDimSize, this->yDimSize, this->zDimSize );
1814 this->getSpherePositions ( settings );
1819 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( this->spherePos.size() ); iter++ )
1821 std::stringstream ss;
1822 ss <<
"Now mapping sphere " << iter <<
" .";
1826 this->xDimSize, this->yDimSize, this->zDimSize, iter,
1828 this->internalMap, &this->maxShellBand );
1853 this->sphericalHarmonics =
new proshade_complex* [this->noSpheres];
1855 for ( proshade_unsign iter = 0; iter < this->noSpheres; iter++ )
1857 this->sphericalHarmonics[iter] =
new proshade_complex [(this->spheres[iter]->getLocalBandwidth() * 2) * (this->spheres[iter]->getLocalBandwidth() * 2)];
1862 for ( proshade_unsign iter = 0; iter < this->noSpheres; iter++ )
1865 std::stringstream ss;
1866 ss <<
"Now decomposing sphere " << iter <<
". " <<
"( Band is: " << this->spheres[iter]->getLocalBandwidth() <<
").";
1890 return ( a[6] > b[6] );
1910 if ( settings->axisErrToleranceDefault )
1912 settings->
axisErrTolerance = std::min ( std::max ( 0.01, ( ( 2.0 * M_PI ) /
static_cast< proshade_double
> ( this->maxShellBand ) ) / 2.0 ), 0.05 );
1916 fftw_complex *mapData, *origCoeffs, *fCoeffs;
1917 fftw_plan planForwardFourier;
1918 proshade_double **bindata, *fscByBin;
1919 proshade_signed *binIndexing, *binCounts, noBins;
1920 this->prepareFSCFourierMemory ( mapData, origCoeffs, fCoeffs, binIndexing, &noBins, bindata, binCounts, &planForwardFourier, fscByBin );
1926 std::stringstream hlpSS;
1931 proshade_double symThres = 0.0;
1932 std::vector< proshade_double* > CSyms = this->findRequestedCSymmetryFromAngleAxis ( settings, settings->
requestedSymmetryFold, &symThres );
1935 bool possible010PIIssue =
false;
1937 if ( possible010PIIssue )
1939 proshade_double* addAxis =
new proshade_double[7];
1940 addAxis[0] = 2.0; addAxis[1] = 0.0; addAxis[2] = 1.0; addAxis[3] = 0.0; addAxis[4] = M_PI; addAxis[5] = -999.9; addAxis[6] = -std::numeric_limits < proshade_double >::infinity();
1946 for (
size_t cIt = 0; cIt < CSyms.size(); cIt++ ) {
const FloatingPoint< proshade_double > lhs ( CSyms.at(cIt)[5] ), rhs ( -999.9 );
if ( ( CSyms.at(cIt)[5] > settings->
peakThresholdMin ) || ( lhs.AlmostEquals ( rhs ) ) ) { this->
computeFSC ( settings, &CSyms, cIt, mapData, fCoeffs, origCoeffs, &planForwardFourier, noBins, binIndexing, bindata, binCounts, fscByBin ); } }
1953 if ( CSyms.size() > 0 )
1955 bool passedTests =
false;
1956 for (
size_t cIt = 0; cIt < CSyms.size(); cIt++ )
1964 this->saveDetectedSymmetries ( settings, &CSyms, allCs );
1985 delete[] origCoeffs;
1987 fftw_destroy_plan ( planForwardFourier );
1988 delete[] binIndexing;
1989 for (
size_t binIt = 0; binIt < static_cast< size_t > ( noBins ); binIt++ ) {
delete[] bindata[binIt]; }
2002 std::vector< proshade_double* > CSyms = getCyclicSymmetriesListFromAngleAxis ( settings );
2005 std::stringstream ss;
2006 ss <<
"Detected " << CSyms.size() <<
" C symmetries.";
2010 if ( this->sphereMappedRotFun.size() < 1 )
2012 throw ProSHADE_exception (
"Rotation function was not converted into angle-axis space.",
"ES00062", __FILE__, __LINE__, __func__,
"It seems that the convertRotationFunction() function was\n : not yet called. Therefore, there are no data to detect the\n : symmetry from; please call the convertRotationFunction()\n : function before the detectSymmetryFromAngleAxisSpace()\n : function." );
2023 for (
size_t cIt = 0; cIt < CSyms.size(); cIt++ )
2026 if ( CSyms.at(cIt)[5] < bestHistPeakStart ) {
continue; }
2029 if ( cIt > 15 ) {
break; }
2032 this->
computeFSC ( settings, &CSyms, cIt, mapData, fCoeffs, origCoeffs, &planForwardFourier, noBins, binIndexing, bindata, binCounts, fscByBin );
2036 this->saveDetectedSymmetries ( settings, &CSyms, allCs );
2045 throw ProSHADE_exception (
"Requested symmetry supplied, but not recognised.",
"ES00032", __FILE__, __LINE__, __func__,
"There are only the following value allowed for the\n : symmetry type request: \"C\", \"D\", \"T\", \"O\" and \"I\". Any\n : other value will result in this error." );
2052 std::vector< proshade_double* > DSyms = this->getDihedralSymmetriesList ( settings, &CSyms );
2053 std::vector< proshade_double* > ISyms;
2054 std::vector < std::vector< proshade_double* > > ISymsHlp = this->getPredictedIcosahedralSymmetriesList ( settings, &CSyms );
2055 std::vector< proshade_double* > OSyms = this->getPredictedOctahedralSymmetriesList ( settings, &CSyms );
2056 std::vector< proshade_double* > TSyms = this->getPredictedTetrahedralSymmetriesList ( settings, &CSyms );
2059 proshade_double fscMax = 0.0;
2060 size_t fscMaxInd = 0;
2062 for (
size_t icoIt = 0; icoIt < ISymsHlp.size(); icoIt++ )
2065 if ( ISymsHlp.at(icoIt).size() != 31 ) {
continue; }
2068 proshade_double fscVal = 0.0;
2069 proshade_double fscValAvg = 0.0;
2072 for (
size_t aIt = 0; aIt < ISymsHlp.at(icoIt).size(); aIt++ )
2075 proshade_signed matchedPos =
ProSHADE_internal_symmetry::addAxisUnlessSame (
static_cast< proshade_unsign
> ( ISymsHlp.at(icoIt).at(aIt)[0] ), ISymsHlp.at(icoIt).at(aIt)[1], ISymsHlp.at(icoIt).at(aIt)[2], ISymsHlp.at(icoIt).at(aIt)[3], ISymsHlp.at(icoIt).at(aIt)[5], ISymsHlp.at(icoIt).at(aIt)[6], &CSyms, settings->
axisErrTolerance );
2078 fscVal = this->
computeFSC ( settings, &CSyms,
static_cast< size_t > ( matchedPos ), mapData, fCoeffs, origCoeffs, &planForwardFourier, noBins, binIndexing, bindata, binCounts, fscByBin );
2079 ISymsHlp.at(fscMaxInd).at(aIt)[6] = fscVal;
2080 fscValAvg += fscVal;
2087 if ( fscValAvg > fscMax )
2093 if ( settings->
fastISearch ) { fscMaxInd = 0;
break; }
2100 for ( proshade_unsign retIt = 0; retIt < static_cast < proshade_unsign > ( ISymsHlp.at(fscMaxInd).size() ); retIt++ )
2103 proshade_signed matchedPos =
ProSHADE_internal_symmetry::addAxisUnlessSame (
static_cast< proshade_unsign
> ( ISymsHlp.at(fscMaxInd).at(retIt)[0] ), ISymsHlp.at(fscMaxInd).at(retIt)[1], ISymsHlp.at(fscMaxInd).at(retIt)[2], ISymsHlp.at(fscMaxInd).at(retIt)[3], ISymsHlp.at(fscMaxInd).at(retIt)[5], ISymsHlp.at(fscMaxInd).at(retIt)[6], &CSyms, settings->
axisErrTolerance );
2112 this->saveRecommendedSymmetry ( settings, &CSyms, &DSyms, &TSyms, &OSyms, &ISyms, axes, mapData, fCoeffs, origCoeffs, &planForwardFourier, noBins, binIndexing, bindata, binCounts, fscByBin );
2118 std::vector< proshade_double* > DSyms = this->getDihedralSymmetriesList ( settings, &CSyms );
2119 this->saveRequestedSymmetryD ( settings, &DSyms, axes, mapData, fCoeffs, origCoeffs, &planForwardFourier, noBins, binIndexing, bindata, binCounts, fscByBin );
2125 std::vector< proshade_double* > TSyms = this->getPredictedTetrahedralSymmetriesList ( settings, &CSyms );
2127 if ( TSyms.size() == 7 )
2130 proshade_double fscVal = 0.0;
2131 proshade_double fscValAvg = 0.0;
2134 for (
size_t tIt = 0; tIt < 7; tIt++ ) {
if ( CSyms.at(settings->
allDetectedTAxes.at(tIt))[5] > settings->
peakThresholdMin ) { fscVal = this->
computeFSC ( settings, &CSyms, settings->
allDetectedTAxes.at(tIt), mapData, fCoeffs, origCoeffs, &planForwardFourier, noBins, binIndexing, bindata, binCounts, fscByBin ); fscValAvg += fscVal; } }
2152 std::vector< proshade_double* > OSyms = this->getPredictedOctahedralSymmetriesList ( settings, &CSyms );
2154 if ( OSyms.size() == 13 )
2157 proshade_double fscVal = 0.0;
2158 proshade_double fscValAvg = 0.0;
2161 for (
size_t oIt = 0; oIt < 13; oIt++ ) {
if ( CSyms.at(settings->
allDetectedOAxes.at(oIt))[5] > settings->
peakThresholdMin ) { fscVal = this->
computeFSC ( settings, &CSyms, settings->
allDetectedOAxes.at(oIt), mapData, fCoeffs, origCoeffs, &planForwardFourier, noBins, binIndexing, bindata, binCounts, fscByBin ); fscValAvg += fscVal; } }
2179 proshade_double fscMax = 0.0;
2180 size_t fscMaxInd = 0;
2181 std::vector < std::vector< proshade_double* > > ISymsHlp = this->getPredictedIcosahedralSymmetriesList ( settings, &CSyms );
2182 std::vector< proshade_double* > ISyms;
2184 for (
size_t icoIt = 0; icoIt < ISymsHlp.size(); icoIt++ )
2187 if ( ISymsHlp.at(icoIt).size() != 31 ) {
continue; }
2190 proshade_double fscVal = 0.0;
2191 proshade_double fscValAvg = 0.0;
2194 for (
size_t aIt = 0; aIt < ISymsHlp.at(icoIt).size(); aIt++ )
2197 proshade_signed matchedPos =
ProSHADE_internal_symmetry::addAxisUnlessSame (
static_cast< proshade_unsign
> ( ISymsHlp.at(icoIt).at(aIt)[0] ), ISymsHlp.at(icoIt).at(aIt)[1], ISymsHlp.at(icoIt).at(aIt)[2], ISymsHlp.at(icoIt).at(aIt)[3], ISymsHlp.at(icoIt).at(aIt)[5], ISymsHlp.at(icoIt).at(aIt)[6], &CSyms, settings->
axisErrTolerance );
2200 fscVal = this->
computeFSC ( settings, &CSyms,
static_cast< size_t > ( matchedPos ), mapData, fCoeffs, origCoeffs, &planForwardFourier, noBins, binIndexing, bindata, binCounts, fscByBin );
2201 ISymsHlp.at(fscMaxInd).at(aIt)[6] = fscVal;
2202 fscValAvg += fscVal;
2209 if ( fscValAvg > fscMax )
2220 for ( proshade_unsign retIt = 0; retIt < static_cast < proshade_unsign > ( ISymsHlp.at(fscMaxInd).size() ); retIt++ )
2223 proshade_signed matchedPos =
ProSHADE_internal_symmetry::addAxisUnlessSame (
static_cast< proshade_unsign
> ( ISymsHlp.at(fscMaxInd).at(retIt)[0] ), ISymsHlp.at(fscMaxInd).at(retIt)[1], ISymsHlp.at(fscMaxInd).at(retIt)[2], ISymsHlp.at(fscMaxInd).at(retIt)[3], ISymsHlp.at(fscMaxInd).at(retIt)[5], ISymsHlp.at(fscMaxInd).at(retIt)[6], &CSyms, settings->
axisErrTolerance );
2232 for (
size_t gIt = 0; gIt < ISymsHlp.size(); gIt++ ) {
for (
size_t aIt = 0; aIt < ISymsHlp.at(gIt).size(); aIt++ ) {
delete[] ISymsHlp.at(gIt).at(aIt); } }
2246 this->saveDetectedSymmetries ( settings, &CSyms, allCs );
2250 delete[] origCoeffs;
2252 fftw_destroy_plan ( planForwardFourier );
2253 delete[] binIndexing;
2254 for (
size_t binIt = 0; binIt < static_cast< size_t > ( noBins ); binIt++ ) {
delete[] bindata[binIt]; }
2279 bool isArgSameAsSettings =
true;
2282 for ( proshade_unsign cIt = 0; cIt < static_cast<proshade_unsign> ( CSyms->size() ); cIt++ )
2285 std::vector< proshade_double > nextSym;
2296 if ( ( cIt == 0 ) && ( settings->
allDetectedCAxes.size() == 0 ) ) { isArgSameAsSettings =
false; }
2301 delete[] CSyms->at(cIt);
2326 bindata =
new proshade_double*[*noBins];
2327 binCounts =
new proshade_signed [*noBins];
2328 fscByBin =
new proshade_double [*noBins];
2331 for (
size_t binIt = 0; binIt < static_cast< size_t > ( *noBins ); binIt++ )
2333 bindata[binIt] =
new proshade_double[12];
2338 mapData =
new fftw_complex [this->xDimIndices * this->yDimIndices * this->zDimIndices];
2339 origCoeffs =
new fftw_complex [this->xDimIndices * this->yDimIndices * this->zDimIndices];
2340 fCoeffs =
new fftw_complex [this->xDimIndices * this->yDimIndices * this->zDimIndices];
2351 *planForwardFourier = fftw_plan_dft_3d (
static_cast< int > ( this->xDimIndices ),
static_cast< int > ( this->yDimIndices ),
static_cast< int > ( this->zDimIndices ), mapData, fCoeffs, FFTW_FORWARD, FFTW_ESTIMATE );
2354 for (
size_t iter = 0; iter < static_cast< size_t > ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ ) { mapData[iter][0] = this->internalMap[iter]; mapData[iter][1] = 0.0; }
2355 fftw_execute ( *planForwardFourier );
2356 for (
size_t iter = 0; iter < static_cast< size_t > ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ ) { origCoeffs[iter][0] = fCoeffs[iter][0]; origCoeffs[iter][1] = fCoeffs[iter][1]; }
2391 proshade_double
ProSHADE_internal_data::ProSHADE_data::computeFSC (
ProSHADE_settings* settings, std::vector< proshade_double* >* CSym,
size_t symIndex, fftw_complex* mapData, fftw_complex* fCoeffs, fftw_complex* origCoeffs, fftw_plan* planForwardFourier, proshade_signed noBins, proshade_signed *binIndexing, proshade_double**& bindata, proshade_signed*& binCounts, proshade_double*& fscByBin )
2394 if ( symIndex >= CSym->size() )
2396 std::cerr <<
"The supplied symmetry axes vector does not contain element number " << symIndex <<
". Returning FSC 0.0." << std::endl;
2401 if ( CSym->at(symIndex)[6] > -2.0 ) {
return ( CSym->at(symIndex)[6] ); }
2404 std::stringstream ss2;
2405 ss2 <<
"Computing FSC for symmetry C" << CSym->at(symIndex)[0] <<
" ( " << CSym->at(symIndex)[1] <<
" ; " << CSym->at(symIndex)[2] <<
" ; " << CSym->at(symIndex)[3] <<
" ) with peak height " << CSym->at(symIndex)[5];
2409 proshade_double *rotMap;
2412 proshade_double averageFSC = 0.0;
2413 for ( proshade_double rotIter = 1.0; rotIter < CSym->at(symIndex)[0]; rotIter += 1.0 )
2416 this->rotateMapRealSpace ( CSym->at(symIndex)[1], CSym->at(symIndex)[2], CSym->at(symIndex)[3], ( ( 2.0 * M_PI ) / CSym->at(symIndex)[0] ) * rotIter, rotMap );
2419 for (
size_t iter = 0; iter < static_cast< size_t > ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ ) { mapData[iter][0] = rotMap[iter]; mapData[iter][1] = 0.0; }
2420 fftw_execute ( *planForwardFourier );
2423 averageFSC +=
ProSHADE_internal_maths::computeFSC ( origCoeffs, fCoeffs, this->xDimIndices, this->yDimIndices, this->zDimIndices, noBins, binIndexing, bindata, binCounts, fscByBin );
2430 averageFSC /= ( CSym->at(symIndex)[0] - 1.0 );
2433 CSym->at(symIndex)[6] = averageFSC;
2436 std::stringstream ss3;
2437 ss3 <<
"FSC value is " << averageFSC <<
" .";
2441 return ( averageFSC );
2472 proshade_double
ProSHADE_internal_data::ProSHADE_data::computeFSC (
ProSHADE_settings* settings, proshade_double* sym, fftw_complex* mapData, fftw_complex* fCoeffs, fftw_complex* origCoeffs, fftw_plan* planForwardFourier, proshade_signed noBins, proshade_signed *binIndexing, proshade_double**& bindata, proshade_signed*& binCounts, proshade_double*& fscByBin )
2475 if ( sym[6] > -2.0 ) {
return ( sym[6] ); }
2478 std::stringstream ss2;
2479 ss2 <<
"Computing FSC for symmetry C" << sym[0] <<
" ( " << sym[1] <<
" ; " << sym[2] <<
" ; " << sym[3] <<
" ) with peak height " << sym[5];
2483 proshade_double *rotMap;
2486 proshade_double averageFSC = 0.0;
2487 for ( proshade_double rotIter = 1.0; rotIter < sym[0]; rotIter += 1.0 )
2490 this->rotateMapRealSpace ( sym[1], sym[2], sym[3], ( ( 2.0 * M_PI ) / sym[0] ) * rotIter, rotMap );
2493 for (
size_t iter = 0; iter < static_cast< size_t > ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ ) { mapData[iter][0] = rotMap[iter]; mapData[iter][1] = 0.0; }
2494 fftw_execute ( *planForwardFourier );
2497 for (
size_t binIt = 0; binIt < static_cast< size_t > ( noBins ); binIt++ ) {
for (
size_t valIt = 0; valIt < 12; valIt++ ) { bindata[binIt][valIt] = 0.0; } }
2498 for (
size_t binIt = 0; binIt < static_cast< size_t > ( noBins ); binIt++ ) { binCounts[binIt] = 0; }
2501 averageFSC +=
ProSHADE_internal_maths::computeFSC ( origCoeffs, fCoeffs, this->xDimIndices, this->yDimIndices, this->zDimIndices, noBins, binIndexing, bindata, binCounts, fscByBin );
2508 averageFSC /= ( sym[0] - 1.0 );
2511 sym[6] = averageFSC;
2514 std::stringstream ss3;
2515 ss3 <<
"FSC value is " << averageFSC <<
" .";
2519 return ( averageFSC );
2558 void ProSHADE_internal_data::ProSHADE_data::saveRecommendedSymmetry (
ProSHADE_settings* settings, std::vector< proshade_double* >* CSym, std::vector< proshade_double* >* DSym, std::vector< proshade_double* >* TSym, std::vector< proshade_double* >* OSym, std::vector< proshade_double* >* ISym, std::vector< proshade_double* >* axes, fftw_complex* mapData, fftw_complex* origCoeffs, fftw_complex* fCoeffs, fftw_plan* planForwardFourier, proshade_signed noBins, proshade_signed* binIndexing, proshade_double** bindata, proshade_signed* binCounts, proshade_double*& fscByBin )
2564 if ( CSym->size() == 0 )
2572 proshade_double step = 0.01;
2573 proshade_double sigma = 0.03;
2574 proshade_signed windowSize = 9;
2575 proshade_double IFSCAverage = 0.0, OFSCAverage = 0.0, TFSCAverage = 0.0;
2576 bool IIsBest =
false, OIsBest =
false, TIsBest =
false;
2583 proshade_unsign noPassed = 0;
for (
size_t cIt = 0; cIt < CSym->size(); cIt++ ) {
if ( CSym->at(cIt)[5] > bestHistPeakStart ) { noPassed += 1; } }
2584 std::stringstream ss;
2585 ss <<
"Smoothening has resolved in " << noPassed <<
" C symmetries.";
2590 bool alreadyDecided =
false;
2591 if ( ISym->size() == 31 )
2594 proshade_double fscVal = 0.0;
2595 proshade_double fscValAvg = 0.0;
2598 for (
size_t iIt = 0; iIt < 31; iIt++ ) { fscVal = this->
computeFSC ( settings, CSym, settings->
allDetectedIAxes.at(iIt), mapData, fCoeffs, origCoeffs, planForwardFourier, noBins, binIndexing, bindata, binCounts, fscByBin ); fscValAvg += fscVal;
if ( fscVal < settings->fscThreshold ) { fscValAvg = 0.0;
break; } }
2600 IFSCAverage = fscValAvg;
2604 if ( ( OSym->size() == 13 ) && !alreadyDecided )
2607 proshade_double fscVal = 0.0;
2608 proshade_double fscValAvg = 0.0;
2611 for (
size_t oIt = 0; oIt < 13; oIt++ ) { fscVal = this->
computeFSC ( settings, CSym, settings->
allDetectedOAxes.at(oIt), mapData, fCoeffs, origCoeffs, planForwardFourier, noBins, binIndexing, bindata, binCounts, fscByBin ); fscValAvg += fscVal;
if ( fscVal < settings->fscThreshold ) { fscValAvg = 0.0;
break; } }
2613 OFSCAverage = fscValAvg;
2617 if ( ( TSym->size() == 7 ) && !alreadyDecided )
2620 proshade_double fscVal = 0.0;
2621 proshade_double fscValAvg = 0.0;
2624 for (
size_t tIt = 0; tIt < 7; tIt++ ) { fscVal = this->
computeFSC ( settings, CSym, settings->
allDetectedTAxes.at(tIt), mapData, fCoeffs, origCoeffs, planForwardFourier, noBins, binIndexing, bindata, binCounts, fscByBin ); fscValAvg += fscVal;
if ( fscVal < settings->fscThreshold ) { fscValAvg = 0.0;
break; } }
2626 TFSCAverage = fscValAvg;
2633 proshade_double phaselessStep = 0.01;
2634 proshade_double phaselessSigma = 0.005;
2635 proshade_signed phaselessWSize = 5;
2640 if ( ( IFSCAverage > std::max( OFSCAverage * 0.9, TFSCAverage * 0.8 ) ) && ( IFSCAverage > newThres ) ) { IIsBest =
true; }
2641 if ( ( OFSCAverage > std::max( IFSCAverage * 1.1, TFSCAverage * 0.9 ) ) && ( OFSCAverage > newThres ) ) { OIsBest =
true; }
2642 if ( ( TFSCAverage > std::max( IFSCAverage * 1.2, OFSCAverage * 1.1 ) ) && ( TFSCAverage > newThres ) ) { TIsBest =
true; }
2643 if ( !IIsBest && !OIsBest && !TIsBest && ( std::max( IFSCAverage, std::max( OFSCAverage, TFSCAverage ) ) > newThres ) )
2645 const FloatingPoint< proshade_double > lhsPolyI ( IFSCAverage ), lhsPolyO ( OFSCAverage ), lhsPolyT ( TFSCAverage ), rhsPolyMax ( std::max( IFSCAverage, std::max( OFSCAverage, TFSCAverage ) ) );
2646 if ( lhsPolyI.AlmostEquals( rhsPolyMax ) ) { IIsBest =
true; }
2647 if ( lhsPolyO.AlmostEquals( rhsPolyMax ) ) { OIsBest =
true; }
2648 if ( lhsPolyT.AlmostEquals( rhsPolyMax ) ) { TIsBest =
true; }
2661 alreadyDecided =
true;
2665 if ( OIsBest && !alreadyDecided )
2674 alreadyDecided =
true;
2678 if ( TIsBest && !alreadyDecided )
2686 alreadyDecided =
true;
2690 if ( ( settings->
allDetectedDAxes.size() > 0 ) && ( DSym->size() > 0 ) && !alreadyDecided )
2693 proshade_signed bestD = -1;
2694 proshade_unsign bestFold = 0;
2700 if ( dIt > 20 ) {
continue; }
2703 const FloatingPoint< proshade_double > lhs999a ( CSym->at(settings->
allDetectedDAxes.at(dIt).at(0))[5] ), lhs999b ( CSym->at(settings->
allDetectedDAxes.at(dIt).at(1))[5] ), rhs999 (
static_cast< proshade_double
> ( -999.9 ) );
2704 if ( ( CSym->at(settings->
allDetectedDAxes.at(dIt).at(0))[5] < bestHistPeakStart ) && !( lhs999a.AlmostEquals( rhs999 ) ) ) {
continue; }
2705 if ( ( CSym->at(settings->
allDetectedDAxes.at(dIt).at(1))[5] < bestHistPeakStart ) && !( lhs999b.AlmostEquals( rhs999 ) ) ) {
continue; }
2708 this->
computeFSC ( settings, CSym, settings->
allDetectedDAxes.at(dIt).at(0), mapData, fCoeffs, origCoeffs, planForwardFourier, noBins, binIndexing, bindata, binCounts, fscByBin );
2709 this->
computeFSC ( settings, CSym, settings->
allDetectedDAxes.at(dIt).at(1), mapData, fCoeffs, origCoeffs, planForwardFourier, noBins, binIndexing, bindata, binCounts, fscByBin );
2719 const FloatingPoint< proshade_double > lhs999a2 ( CSym->at(settings->
allDetectedDAxes.at(dIt).at(0))[5] ), lhs999b2 ( CSym->at(settings->
allDetectedDAxes.at(dIt).at(1))[5] ), rhs999 (
static_cast< proshade_double
> ( -999.9 ) );
2720 if ( ( CSym->at(settings->
allDetectedDAxes.at(dIt).at(0))[5] < bestHistPeakStart ) && !( lhs999a2.AlmostEquals( rhs999 ) ) ) {
continue; }
2721 if ( ( CSym->at(settings->
allDetectedDAxes.at(dIt).at(1))[5] < bestHistPeakStart ) && !( lhs999b2.AlmostEquals( rhs999 ) ) ) {
continue; }
2724 if ( ( CSym->at(settings->
allDetectedDAxes.at(dIt).at(0))[0] >
static_cast< proshade_double
> ( bestFold ) ) || ( CSym->at(settings->
allDetectedDAxes.at(dIt).at(1))[0] >
static_cast< proshade_double
> ( bestFold ) ) )
2727 if ( CSym->at(settings->
allDetectedDAxes.at(dIt).at(0))[6] < newThres ) {
continue; }
2728 if ( CSym->at(settings->
allDetectedDAxes.at(dIt).at(1))[6] < newThres ) {
continue; }
2729 if ( std::max ( CSym->at(settings->
allDetectedDAxes.at(dIt).at(0))[6], CSym->at(settings->
allDetectedDAxes.at(dIt).at(1))[6] ) < bestHistFSCStart ) {
continue; }
2732 bestFold =
static_cast< proshade_unsign
> ( std::max ( CSym->at(settings->
allDetectedDAxes.at(dIt).at(0))[0], CSym->at(settings->
allDetectedDAxes.at(dIt).at(1))[0] ) );
2733 bestD =
static_cast< proshade_signed
> ( dIt );
2742 settings->
setRecommendedFold (
static_cast< proshade_unsign
> ( std::max ( CSym->at(settings->
allDetectedDAxes.at(
static_cast< size_t > ( bestD ) ).at(0))[0], CSym->at(settings->
allDetectedDAxes.at(
static_cast< size_t > ( bestD ) ).at(1))[0] ) ) );
2752 alreadyDecided =
true;
2757 if ( ( CSym->size() > 0 ) && !alreadyDecided )
2760 proshade_signed bestC = -1;
2761 proshade_unsign bestFold = 0;
2764 for (
size_t cIt = 0; cIt < CSym->size(); cIt++ )
2767 if ( cIt > 15 ) {
break; }
2770 if ( CSym->at(cIt)[5] < bestHistPeakStart ) {
continue; }
2773 this->
computeFSC ( settings, CSym, cIt, mapData, fCoeffs, origCoeffs, planForwardFourier, noBins, binIndexing, bindata, binCounts, fscByBin );
2780 for (
size_t cIt = 0; cIt < CSym->size(); cIt++ )
2783 if ( CSym->at(cIt)[0] >
static_cast< proshade_double
> ( bestFold ) )
2786 if ( ( CSym->at(cIt)[6] > newThres ) && ( CSym->at(cIt)[6] >= bestHistFSCStart ) )
2788 bestFold =
static_cast< proshade_unsign
> ( CSym->at(cIt)[0] );
2789 bestC =
static_cast< proshade_signed
> ( cIt );
2799 settings->
setRecommendedFold (
static_cast< proshade_unsign
> ( CSym->at(
static_cast< size_t > ( bestC ) )[0] ) );
2804 alreadyDecided =
true;
2827 proshade_unsign bestIndex = 0;
2828 proshade_double highestSym = 0.0;
2831 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( CSym->size() ); iter++ )
2834 const FloatingPoint< proshade_double > lhs1 ( CSym->at(iter)[0] ), rhs1 (
static_cast< proshade_double
> ( settings->
requestedSymmetryFold ) );
2835 if ( !lhs1.AlmostEquals ( rhs1 ) ) {
continue; }
2838 if ( CSym->at(iter)[5] > highestSym )
2840 highestSym = CSym->at(iter)[5];
2846 if ( highestSym > 0.0 )
2849 settings->
setRecommendedFold (
static_cast< proshade_unsign
> ( CSym->at(bestIndex)[0] ) );
2876 void ProSHADE_internal_data::ProSHADE_data::saveRequestedSymmetryD (
ProSHADE_settings* settings, std::vector< proshade_double* >* DSym, std::vector< proshade_double* >* axes, fftw_complex* mapData, fftw_complex* origCoeffs, fftw_complex* fCoeffs, fftw_plan* planForwardFourier, proshade_signed noBins, proshade_signed* binIndexing, proshade_double** bindata, proshade_signed* binCounts, proshade_double*& fscByBin )
2879 proshade_unsign bestIndex = 0;
2880 proshade_double highestSym = 0.0;
2883 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( DSym->size() ); iter++ )
2886 const FloatingPoint< proshade_double > lhs1 ( std::max ( DSym->at(iter)[0], DSym->at(iter)[7] ) ), rhs1 (
static_cast< proshade_double
> ( settings->
requestedSymmetryFold ) );
2887 if ( !lhs1.AlmostEquals ( rhs1 ) ) {
continue; }
2890 const FloatingPoint< proshade_double > lhs999a ( DSym->at(iter)[5] ), lhs999b ( DSym->at(iter)[12] ), rhs999 (
static_cast< proshade_double
> ( -999.9 ) );
2891 if ( ( DSym->at(iter)[5] < settings->
peakThresholdMin ) && !( lhs999a.AlmostEquals( rhs999 ) ) ) {
continue; }
2892 if ( ( DSym->at(iter)[12] < settings->
peakThresholdMin ) && !( lhs999b.AlmostEquals( rhs999 ) ) ) {
continue; }
2895 this->
computeFSC ( settings, &DSym->at(iter)[0], mapData, fCoeffs, origCoeffs, planForwardFourier, noBins, binIndexing, bindata, binCounts, fscByBin );
2896 this->
computeFSC ( settings, &DSym->at(iter)[7], mapData, fCoeffs, origCoeffs, planForwardFourier, noBins, binIndexing, bindata, binCounts, fscByBin );
2899 if ( ( DSym->at(iter)[6] + DSym->at(iter)[13] ) > highestSym )
2901 highestSym = ( DSym->at(iter)[6] + DSym->at(iter)[13] );
2907 if ( highestSym > 0.0 )
2910 settings->
setRecommendedFold (
static_cast< proshade_unsign
> ( std::max ( DSym->at(bestIndex)[0], DSym->at(bestIndex)[7] ) ) );
2942 std::vector< proshade_double > angList;
2943 std::vector<std::vector< proshade_double > > ret;
2946 proshade_double* rotMat =
new proshade_double[9];
2951 proshade_double normF = std::sqrt( std::pow ( xAx, 2.0 ) + std::pow ( yAx, 2.0 ) + std::pow ( zAx, 2.0 ) );
2957 if ( fold % 2 == 0 )
2960 for ( proshade_double iter =
static_cast < proshade_double
> ( -( ( fold / 2 ) - 1 ) ); iter <= static_cast < proshade_double > ( fold / 2 ); iter++ )
2968 for ( proshade_double iter =
static_cast < proshade_double
> ( -fold / 2 ); iter <= static_cast < proshade_double > ( fold / 2 ); iter++ )
2975 for ( proshade_unsign iter = 0; iter < static_cast < proshade_unsign > ( angList.size() ); iter++ )
2981 std::vector < proshade_double > retEl;
2982 for ( proshade_unsign matIt = 0; matIt < 9; matIt++ )
3006 if ( obtainedAxes != requiredAxes )
3008 std::stringstream hlpSS;
3009 hlpSS <<
"The supplied number of axes for group element\n : detection ( >" << obtainedAxes <<
"< ) does not match the group type ( >" << groupType <<
"< ).";
3010 throw ProSHADE_exception (
"Mismatch between supplied number of axes and\n : symmetry type.",
"ES00059", __FILE__, __LINE__, __func__, hlpSS.str() );
3025 bool checkElementAlreadyExists ( std::vector<std::vector< proshade_double > >* elements, std::vector< proshade_double >* elem, proshade_double matrixTolerance )
3028 bool elementFound =
false;
3031 for ( proshade_unsign elIt = 0; elIt < static_cast<proshade_unsign> ( elements->size() ); elIt++ )
3035 elementFound =
true;
3041 return ( elementFound );
3054 bool isGroup =
true;
3057 for ( proshade_unsign gr1 = 0; gr1 < static_cast<proshade_unsign> ( elements->size() ); gr1++ )
3059 for ( proshade_unsign gr2 = 1; gr2 < static_cast<proshade_unsign> ( elements->size() ); gr2++ )
3062 if ( gr1 >= gr2 ) {
continue; }
3076 if ( !isGroup ) {
break; }
3095 std::vector< std::vector< proshade_double > > ret;
3098 for ( proshade_unsign elIt = 0; elIt < static_cast<proshade_unsign> ( first->size() ); elIt++ )
3107 for ( proshade_unsign elIt = 0; elIt < static_cast<proshade_unsign> ( second->size() ); elIt++ )
3118 for ( proshade_unsign gr1 = 0; gr1 < static_cast<proshade_unsign> ( first->size() ); gr1++ )
3120 for ( proshade_unsign gr2 = 0; gr2 < static_cast<proshade_unsign> ( second->size() ); gr2++ )
3154 std::vector<std::vector< proshade_double > > ret = this->getAllGroupElements ( &settings->
allDetectedCAxes, axesList, groupType, matrixTolerance );
3182 std::vector<std::vector< proshade_double > > ret;
3185 if ( groupType ==
"C" )
3192 allCs->at(axesList.at(0)).at(2),
3193 allCs->at(axesList.at(0)).at(3),
3194 static_cast< proshade_signed
> ( allCs->at(axesList.at(0)).at(0) ) );
3200 throw ProSHADE_exception (
"Computed point group elements do not form a group.",
"ES00060", __FILE__, __LINE__, __func__,
"The supplied cyclic groups list does not form a group and\n : therefore such group's elements cannot be obtained. Please\n : check the cyclic groups list supplied to the\n : getAllGroupElements() function." );
3203 else if ( groupType ==
"D" )
3210 allCs->at(axesList.at(0)).at(2),
3211 allCs->at(axesList.at(0)).at(3),
3212 static_cast< proshade_signed
> ( allCs->at(axesList.at(0)).at(0) ) );
3215 allCs->at(axesList.at(1)).at(2),
3216 allCs->at(axesList.at(1)).at(3),
3217 static_cast< proshade_signed
> ( allCs->at(axesList.at(1)).at(0) ) );
3226 throw ProSHADE_exception (
"Computed point group elements do not form a group.",
"ES00060", __FILE__, __LINE__, __func__,
"The supplied cyclic groups list does not form a group and\n : therefore such group's elements cannot be obtained. Please\n : check the cyclic groups list supplied to the\n : getAllGroupElements() function." );
3229 else if ( groupType ==
"T" )
3235 for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
3238 const FloatingPoint< proshade_double > lhs1 ( allCs->at(axesList.at(grIt)).at(0) ), rhs1 ( 3.0 );
3239 if ( lhs1.AlmostEquals ( rhs1 ) )
3243 allCs->at(axesList.at(grIt)).at(2),
3244 allCs->at(axesList.at(grIt)).at(3),
3245 static_cast< proshade_signed
> ( allCs->at(axesList.at(grIt)).at(0) ) );
3253 for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
3256 const FloatingPoint< proshade_double > lhs1 ( allCs->at(axesList.at(grIt)).at(0) ), rhs1 ( 2.0 );
3257 if ( lhs1.AlmostEquals ( rhs1 ) )
3261 allCs->at(axesList.at(grIt)).at(2),
3262 allCs->at(axesList.at(grIt)).at(3),
3263 static_cast< proshade_signed
> ( allCs->at(axesList.at(grIt)).at(0) ) );
3274 throw ProSHADE_exception (
"Computed point group elements do not form a group.",
"ES00060", __FILE__, __LINE__, __func__,
"The supplied cyclic groups list does not form a group and\n : therefore such group's elements cannot be obtained. Please\n : check the cyclic groups list supplied to the\n : getAllGroupElements() function." );
3277 else if ( groupType ==
"O" )
3283 for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
3286 const FloatingPoint< proshade_double > lhs1 ( allCs->at(axesList.at(grIt)).at(0) ), rhs1 ( 4.0 );
3287 if ( lhs1.AlmostEquals ( rhs1 ) )
3291 allCs->at(axesList.at(grIt)).at(2),
3292 allCs->at(axesList.at(grIt)).at(3),
3293 static_cast< proshade_signed
> ( allCs->at(axesList.at(grIt)).at(0) ) );
3301 for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
3304 const FloatingPoint< proshade_double > lhs1 ( allCs->at(axesList.at(grIt)).at(0) ), rhs1 ( 3.0 );
3305 if ( lhs1.AlmostEquals ( rhs1 ) )
3309 allCs->at(axesList.at(grIt)).at(2),
3310 allCs->at(axesList.at(grIt)).at(3),
3311 static_cast< proshade_signed
> ( allCs->at(axesList.at(grIt)).at(0) ) );
3319 for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
3322 const FloatingPoint< proshade_double > lhs1 ( allCs->at(axesList.at(grIt)).at(0) ), rhs1 ( 2.0 );
3323 if ( lhs1.AlmostEquals ( rhs1 ) )
3327 allCs->at(axesList.at(grIt)).at(2),
3328 allCs->at(axesList.at(grIt)).at(3),
3329 static_cast< proshade_signed
> ( allCs->at(axesList.at(grIt)).at(0) ) );
3340 throw ProSHADE_exception (
"Computed point group elements do not form a group.",
"ES00060", __FILE__, __LINE__, __func__,
"The supplied cyclic groups list does not form a group and\n : therefore such group's elements cannot be obtained. Please\n : check the cyclic groups list supplied to the\n : getAllGroupElements() function." );
3343 else if ( groupType ==
"I" )
3349 for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
3352 const FloatingPoint< proshade_double > lhs1 ( allCs->at(axesList.at(grIt)).at(0) ), rhs1 ( 5.0 );
3353 if ( lhs1.AlmostEquals ( rhs1 ) )
3357 allCs->at(axesList.at(grIt)).at(2),
3358 allCs->at(axesList.at(grIt)).at(3),
3359 static_cast< proshade_signed
> ( allCs->at(axesList.at(grIt)).at(0) ) );
3367 for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
3370 const FloatingPoint< proshade_double > lhs1 ( allCs->at(axesList.at(grIt)).at(0) ), rhs1 ( 3.0 );
3371 if ( lhs1.AlmostEquals ( rhs1 ) )
3375 allCs->at(axesList.at(grIt)).at(2),
3376 allCs->at(axesList.at(grIt)).at(3),
3377 static_cast< proshade_signed
> ( allCs->at(axesList.at(grIt)).at(0) ) );
3385 for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
3388 const FloatingPoint< proshade_double > lhs1 ( allCs->at(axesList.at(grIt)).at(0) ), rhs1 ( 2.0 );
3389 if ( lhs1.AlmostEquals ( rhs1 ) )
3393 allCs->at(axesList.at(grIt)).at(2),
3394 allCs->at(axesList.at(grIt)).at(3),
3395 static_cast< proshade_signed
> ( allCs->at(axesList.at(grIt)).at(0) ) );
3406 throw ProSHADE_exception (
"Computed point group elements do not form a group.",
"ES00060", __FILE__, __LINE__, __func__,
"The supplied cyclic groups list does not form a group and\n : therefore such group's elements cannot be obtained. Please\n : check the cyclic groups list supplied to the\n : getAllGroupElements() function." );
3409 else if ( groupType ==
"X" )
3412 for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
3416 allCs->at(axesList.at(grIt)).at(2),
3417 allCs->at(axesList.at(grIt)).at(3),
3418 static_cast< proshade_signed
> ( allCs->at(axesList.at(grIt)).at(0) ) );
3428 throw ProSHADE_exception (
"Computed point group elements do not form a group.",
"ES00060", __FILE__, __LINE__, __func__,
"The supplied cyclic groups list does not form a group and\n : therefore such group's elements cannot be obtained. Please\n : check the cyclic groups list supplied to the\n : getAllGroupElements() function." );
3433 std::stringstream hlpSS;
3434 hlpSS <<
"Unknown symmetry type: >" << groupType <<
"<";
3435 throw ProSHADE_exception ( hlpSS.str().c_str(),
"ES00058", __FILE__, __LINE__, __func__,
"Function getAllGroupElements was called with symmetry type\n : value outside of the allowed values C, D, T, O, I\n : or empty for using all supplied axes." );
3450 if ( saveTo !=
nullptr )
3457 saveTo =
new proshade_double[this->xDimIndices * this->yDimIndices * this->zDimIndices];
3463 for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
3465 saveTo[iter] = this->internalMap[iter];
3488 std::stringstream ssHlp;
3489 std::vector< proshade_double > comMove = this->getMapCOMProcessChange ( );
3490 ssHlp << std::endl <<
"Detected " << settings->
recommendedSymmetryType <<
" symmetry with fold " << settings->
recommendedSymmetryFold <<
" about point [" << comMove.at(0) <<
" , " << comMove.at(1) <<
" , " << comMove.at(2) <<
"] away from centre of mass .";
3495 ssHlp.clear(); ssHlp.str (
"" );
3496 ssHlp <<
" Fold X Y Z Angle Height Average FSC";
3499 for ( proshade_unsign symIt = 0; symIt < static_cast<proshade_unsign> ( settings->
detectedSymmetry.size() ); symIt++ )
3501 ssHlp.clear(); ssHlp.str (
"" );
3506 std::stringstream hlpSS3;
3507 ssHlp.clear(); ssHlp.str (
"" );
3508 hlpSS3 << std::endl <<
"To facilitate manual checking for symmetries, the following is a list of all detected C symmetries:";
3513 ssHlp.clear(); ssHlp.str (
"" );
3514 ssHlp <<
" Fold X Y Z Angle Height Average FSC";
3517 for ( proshade_unsign symIt = 0; symIt < static_cast<proshade_unsign> ( settings->
allDetectedCAxes.size() ); symIt++ )
3519 ssHlp.clear(); ssHlp.str (
"" );
3541 proshade_double totNonZeroPoints = 0.0;
3542 proshade_signed mapIt = 0;
3545 for ( proshade_signed xIt = 0; xIt < static_cast<proshade_signed> ( this->xDimIndices ); xIt++ )
3547 for ( proshade_signed yIt = 0; yIt < static_cast<proshade_signed> ( this->yDimIndices ); yIt++ )
3549 for ( proshade_signed zIt = 0; zIt < static_cast<proshade_signed> ( this->zDimIndices ); zIt++ )
3552 mapIt = zIt +
static_cast< proshade_signed
> ( this->zDimIndices ) * ( yIt +
static_cast< proshade_signed
> ( this->yDimIndices ) * xIt );
3555 if ( this->internalMap[mapIt] <= 0.0 ) {
continue; }
3558 this->xCom += this->internalMap[mapIt] *
static_cast<proshade_double
> ( xIt + this->xFrom );
3559 this->yCom += this->internalMap[mapIt] *
static_cast<proshade_double
> ( yIt + this->yFrom );
3560 this->zCom += this->internalMap[mapIt] *
static_cast<proshade_double
> ( zIt + this->zFrom );
3561 totNonZeroPoints += this->internalMap[mapIt];
3566 this->xCom /= totNonZeroPoints;
3567 this->yCom /= totNonZeroPoints;
3568 this->zCom /= totNonZeroPoints;
3571 this->xCom =
static_cast< proshade_double
> ( (
static_cast< proshade_single
> ( this->xFrom ) * ( this->xDimSizeOriginal /
static_cast< proshade_single
> ( this->xDimIndicesOriginal ) ) ) +
3572 ( (
static_cast< proshade_single
> ( this->xCom ) -
static_cast< proshade_single
> ( this->xFrom ) ) *
3573 (
static_cast< proshade_single
> ( this->xDimSizeOriginal ) /
static_cast< proshade_single
> ( this->xDimIndicesOriginal ) ) ) );
3574 this->yCom =
static_cast< proshade_double
> ( (
static_cast< proshade_single
> ( this->yFrom ) * ( this->yDimSizeOriginal /
static_cast< proshade_single
> ( this->yDimIndicesOriginal ) ) ) +
3575 ( (
static_cast< proshade_single
> ( this->yCom ) -
static_cast< proshade_single
> ( this->yFrom ) ) *
3576 (
static_cast< proshade_single
> ( this->yDimSizeOriginal ) /
static_cast< proshade_single
> ( this->yDimIndicesOriginal ) ) ) );
3577 this->zCom =
static_cast< proshade_double
> ( (
static_cast< proshade_single
> ( this->zFrom ) * ( this->zDimSizeOriginal /
static_cast< proshade_single
> ( this->zDimIndicesOriginal ) ) ) +
3578 ( (
static_cast< proshade_single
> ( this->zCom ) -
static_cast< proshade_single
> ( this->zFrom ) ) *
3579 (
static_cast< proshade_single
> ( this->zDimSizeOriginal ) /
static_cast< proshade_single
> ( this->zDimIndicesOriginal ) ) ) );
3593 return ( this->noSpheres );
3604 return ( this->internalMap[pos] );
3614 return ( this->maxShellBand );
3624 return ( this->rrpMatrices[band][sh1][sh2] );
3639 if ( this->spheres[shell]->getLocalBandwidth( ) >= bandVal )
3663 fftw_complex* mapCoeffs =
new fftw_complex[this->xDimIndices * this->yDimIndices * this->zDimIndices];
3664 fftw_complex* pattersonMap =
new fftw_complex[this->xDimIndices * this->yDimIndices * this->zDimIndices];
3671 for ( proshade_unsign iter = 0; iter < (this->xDimIndices * this->yDimIndices * this->zDimIndices); iter++ )
3673 pattersonMap[iter][0] = this->internalMap[iter];
3674 pattersonMap[iter][1] = 0.0;
3678 fftw_plan forward = fftw_plan_dft_3d (
static_cast< int > ( this->xDimIndices ),
static_cast< int > ( this->yDimIndices ),
static_cast< int > ( this->zDimIndices ),
3679 pattersonMap, mapCoeffs, FFTW_FORWARD, FFTW_ESTIMATE );
3680 fftw_plan inverse = fftw_plan_dft_3d (
static_cast< int > ( this->xDimIndices ),
static_cast< int > ( this->yDimIndices ),
static_cast< int > ( this->zDimIndices ),
3681 mapCoeffs, pattersonMap, FFTW_BACKWARD, FFTW_ESTIMATE );
3684 fftw_execute ( forward );
3690 fftw_execute ( inverse );
3693 proshade_signed mapIt, patIt, patX, patY, patZ;
3694 for ( proshade_signed xIt = 0; xIt < static_cast<proshade_signed> ( this->xDimIndices ); xIt++ )
3696 for ( proshade_signed yIt = 0; yIt < static_cast<proshade_signed> ( this->yDimIndices ); yIt++ )
3698 for ( proshade_signed zIt = 0; zIt < static_cast<proshade_signed> ( this->zDimIndices ); zIt++ )
3701 patX = xIt - (
static_cast<proshade_signed
> ( this->xDimIndices ) / 2 );
if ( patX < 0 ) { patX += this->xDimIndices; }
3702 patY = yIt - (
static_cast<proshade_signed
> ( this->yDimIndices ) / 2 );
if ( patY < 0 ) { patY += this->yDimIndices; }
3703 patZ = zIt - (
static_cast<proshade_signed
> ( this->zDimIndices ) / 2 );
if ( patZ < 0 ) { patZ += this->zDimIndices; }
3706 mapIt = zIt +
static_cast< proshade_signed
> ( this->zDimIndices ) * ( yIt +
static_cast< proshade_signed
> ( this->yDimIndices ) * xIt );
3707 patIt = patZ +
static_cast< proshade_signed
> ( this->zDimIndices ) * ( patY +
static_cast< proshade_signed
> ( this->yDimIndices ) * patX );
3710 this->internalMap[mapIt] = pattersonMap[patIt][0];
3716 delete[] pattersonMap;
3720 fftw_destroy_plan ( forward );
3721 fftw_destroy_plan ( inverse );
3726 this->xDimSize *= 2.0f;
3727 this->yDimSize *= 2.0f;
3728 this->zDimSize *= 2.0f;
3747 return ( &this->sphericalHarmonics[shell][seanindex (
static_cast< int > ( order ) -
static_cast< int > ( band ),
3748 static_cast< int > ( band ),
3749 static_cast< int > ( this->spheres[shell]->getLocalBandwidth() ) )][0] );
3760 return ( &this->sphericalHarmonics[shell][seanindex (
static_cast< int > ( order ) -
static_cast< int > ( band ),
3761 static_cast< int > ( band ),
3762 static_cast< int > ( this->spheres[shell]->getLocalBandwidth() ) )][1] );
3773 return ( this->spheres[shell]->getShellRadius() );
3784 return ( this->integrationWeight );
3796 return ( this->spheres[shell]->getLocalBandwidth ( ) );
3808 return ( this->spherePos.at(shell) );
3820 return ( this->eMatrices[band] );
3835 *valueReal = this->eMatrices[band][order1][order2][0];
3836 *valueImag = this->eMatrices[band][order1][order2][1];
3850 return ( this->so3CoeffsInverse );
3861 return ( this->so3Coeffs );
3872 return ( this->maxCompBand );
3887 *valueReal = this->wignerMatrices[band][order1][order2][0];
3888 *valueImag = this->wignerMatrices[band][order1][order2][1];
3902 return ( this->xDimSize );
3912 return ( this->yDimSize );
3922 return ( this->zDimSize );
3932 return ( this->xDimIndices );
3942 return ( this->yDimIndices );
3952 return ( this->zDimIndices );
3962 return ( &this->xFrom );
3972 return ( &this->yFrom );
3982 return ( &this->zFrom );
3992 return ( &this->xTo );
4002 return ( &this->yTo );
4012 return ( &this->zTo );
4022 return ( &this->xAxisOrigin );
4032 return ( &this->yAxisOrigin );
4042 return ( &this->zAxisOrigin );
4052 return ( this->internalMap );
4062 return ( this->translationMap );
4072 std::vector< proshade_double > ret;
4090 this->integrationWeight = intW;
4104 this->integrationWeight += intW;
4121 this->eMatrices[band][order1][order2][0] = val[0];
4122 this->eMatrices[band][order1][order2][1] = val[1];
4139 this->eMatrices[band][order1][order2][0] /= normF;
4140 this->eMatrices[band][order1][order2][1] /= normF;
4155 this->so3Coeffs[position][0] = val[0];
4156 this->so3Coeffs[position][1] = val[1];
4173 this->wignerMatrices[band][order1][order2][0] = val[0];
4174 this->wignerMatrices[band][order1][order2][1] = val[1];
4191 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
4193 eMatsLMReal[iter] =
static_cast<double> ( this->eMatrices[band][order1][iter][0] );
4211 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
4213 eMatsLMImag[iter] =
static_cast<double> ( this->eMatrices[band][order1][iter][1] );
4229 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
4231 so3CoefsReal[iter] =
static_cast<double> ( this->so3Coeffs[iter][0] );
4247 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
4249 so3CoefsImag[iter] =
static_cast<double> ( this->so3Coeffs[iter][1] );
4269 return (
static_cast<int> ( so3CoefLoc (
static_cast< int > ( order1 ),
static_cast< int > ( order2 ),
static_cast< int > ( band ),
static_cast< int > ( this->getMaxBand() ) ) ) );
4280 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
4282 rotFunReal[iter] =
static_cast<double> ( this->so3CoeffsInverse[iter][0] );
4298 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
4300 rotFunImag[iter] =
static_cast<double> ( this->so3CoeffsInverse[iter][1] );
4316 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
4318 trsFunReal[iter] =
static_cast<double> ( this->translationMap[iter][0] );
4334 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
4336 trsFunImag[iter] =
static_cast<double> ( this->translationMap[iter][1] );
4355 proshade_double eA, eB, eG;
4359 proshade_double* rMat =
nullptr;
4360 rMat =
new proshade_double[9];
4367 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
4369 rotMat[iter] =
static_cast<double> ( rMat[iter] );
4410 return (
static_cast<proshade_unsign
> ( settings->
detectedSymmetry.size() ) );
4422 if (
static_cast<proshade_unsign
> ( settings->
detectedSymmetry.size() ) <= axisNo )
4425 return ( std::vector< std::string > ( ) );
4429 std::vector< std::string > ret;
4432 std::stringstream ssHlp;
4481 std::stringstream fNameHlp;
4483 this->writeMap ( fNameHlp.str() );
4490 this->writePdb ( fNameHlp.str(), eulA, eulB, eulG, ultimateTranslation->at(0), ultimateTranslation->at(1), ultimateTranslation->at(2), rotCentre->at(0), rotCentre->at(1), rotCentre->at(2), settings->
firstModelOnly );
4496 ultimateTranslation->at(0), ultimateTranslation->at(1), ultimateTranslation->at(2),
4518 std::stringstream rotCen; rotCen << std::setprecision (3) << std::showpos <<
"The rotation centre to origin translation vector is: " << -rotationCentre->at(0) <<
" " << -rotationCentre->at(1) <<
" " << -rotationCentre->at(2);
4522 proshade_double* rotMat =
new proshade_double[9];
4526 std::stringstream rotMatSS;
4527 rotMatSS << std::setprecision (3) << std::showpos <<
"The rotation matrix about origin is : " << rotMat[0] <<
" " << rotMat[1] <<
" " << rotMat[2] << std::endl;
4528 rotMatSS << std::setprecision (3) << std::showpos <<
" : " << rotMat[3] <<
" " << rotMat[4] <<
" " << rotMat[5] << std::endl;
4529 rotMatSS << std::setprecision (3) << std::showpos <<
" : " << rotMat[6] <<
" " << rotMat[7] <<
" " << rotMat[8];
4535 std::stringstream finTrs; finTrs << std::setprecision (3) << std::showpos <<
"The rotation centre to overlay translation vector is: " << finalTranslation->at(0) <<
" " << finalTranslation->at(1) <<
" " << finalTranslation->at(2);