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);
507 if ( !this->isEmpty )
509 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 );
513 this->fileName = fName;
519 this->inputOrder = inputO;
522 switch ( this->fileType )
524 case ProSHADE_internal_io::UNKNOWN:
525 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." );
527 case ProSHADE_internal_io::PDB:
528 this->readInPDB ( settings );
531 case ProSHADE_internal_io::MAP:
532 this->readInMAP ( settings );
537 this->isEmpty =
false;
557 gemmi::Ccp4<float> map;
558 map.read_ccp4 ( gemmi::MaybeGzipped ( this->fileName.c_str() ) );
561 map.setup ( gemmi::GridSetup::ReorderOnly, NAN );
565 &this->xDimIndices, &this->yDimIndices, &this->zDimIndices,
566 &this->xDimSize, &this->yDimSize, &this->zDimSize,
567 &this->aAngle, &this->bAngle, &this->cAngle,
568 &this->xFrom, &this->yFrom, &this->zFrom,
569 &this->xAxisOrigin, &this->yAxisOrigin, &this->zAxisOrigin,
570 &this->xAxisOrder, &this->yAxisOrder, &this->zAxisOrder,
571 &this->xGridIndices, &this->yGridIndices, &this->zGridIndices );
574 ProSHADE_internal_io::readInMapData ( &map, this->internalMap, this->xDimIndices, this->yDimIndices, this->zDimIndices, this->xAxisOrder, this->yAxisOrder, this->zAxisOrder );
580 std::stringstream hlpSS;
585 gemmi::Ccp4<float> mask;
589 mask.setup ( gemmi::GridSetup::ReorderOnly, 0 );
592 proshade_unsign xDI, yDI, zDI, xAOR, yAOR, zAOR, xGI, yGI, zGI;
593 proshade_single xDS, yDS, zDS, aA, bA, cA;
594 proshade_signed xF, yF, zF, xAO, yAO, zAO;
605 if ( ( this->xDimIndices != xDI ) || ( this->yDimIndices != yDI ) || ( this->zDimIndices != zDI ) )
607 throw ProSHADE_exception (
"The supplied map mask has different dimensions than the\n : density map.",
"EM00065", __FILE__, __LINE__, __func__,
"Most likely the mask is not the correct mask for this map,\n : as it has different dimensions from the density map.\n : Please review that the supplied map and mask form a pair." );
611 proshade_double* internalMask =
nullptr;
615 for (
size_t iter = 0; iter < static_cast< size_t > ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ ) { this->internalMap[iter] *= internalMask[iter]; }
618 delete[] internalMask;
625 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; } } }
630 settings->
setResolution ( std::min (
static_cast<proshade_single
> ( this->xDimSize ) /
static_cast<proshade_single
> ( this->xDimIndices ),
631 std::min (
static_cast<proshade_single
> ( this->yDimSize ) /
static_cast<proshade_single
> ( this->yDimIndices ),
632 static_cast<proshade_single
> ( this->zDimSize ) /
static_cast<proshade_single
> ( this->zDimIndices ) ) ) * 2.0f );
636 this->figureIndexStartStop ( );
642 proshade_single xSampRate = this->xDimSize /
static_cast< proshade_single
> ( this->xTo - this->xFrom );
643 proshade_single ySampRate = this->yDimSize /
static_cast< proshade_single
> ( this->yTo - this->yFrom );
644 proshade_single zSampRate = this->zDimSize /
static_cast< proshade_single
> ( this->zTo - this->zFrom );
647 proshade_single xStartPosBefore =
static_cast< proshade_single
> ( this->xFrom ) * xSampRate;
648 proshade_single yStartPosBefore =
static_cast< proshade_single
> ( this->yFrom ) * ySampRate;
649 proshade_single zStartPosBefore =
static_cast< proshade_single
> ( this->zFrom ) * zSampRate;
652 proshade_double xMapCOMPreReSampl = 0.0, yMapCOMPreReSampl = 0.0, zMapCOMPreReSampl = 0.0;
653 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 );
656 this->reSampleMap ( settings );
659 xSampRate = this->xDimSize /
static_cast< proshade_single
> ( this->xTo - this->xFrom );
660 ySampRate = this->yDimSize /
static_cast< proshade_single
> ( this->yTo - this->yFrom );
661 zSampRate = this->zDimSize /
static_cast< proshade_single
> ( this->zTo - this->zFrom );
664 proshade_single xStartPosAfter =
static_cast< proshade_single
> ( this->xFrom ) * xSampRate;
665 proshade_single yStartPosAfter =
static_cast< proshade_single
> ( this->yFrom ) * ySampRate;
666 proshade_single zStartPosAfter =
static_cast< proshade_single
> ( this->zFrom ) * zSampRate;
669 proshade_single xMov =
static_cast< proshade_single
> ( xStartPosAfter - xStartPosBefore );
670 proshade_single yMov =
static_cast< proshade_single
> ( yStartPosAfter - yStartPosBefore );
671 proshade_single zMov =
static_cast< proshade_single
> ( zStartPosAfter - zStartPosBefore );
673 &this->xFrom, &this->xTo, &this->yFrom, &this->yTo, &this->zFrom, &this->zTo,
674 &this->xAxisOrigin, &this->yAxisOrigin, &this->zAxisOrigin );
677 proshade_double xMapCOMPostReSampl = 0.0, yMapCOMPostReSampl = 0.0, zMapCOMPostReSampl = 0.0;
678 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 );
682 static_cast< proshade_single
> ( xMapCOMPreReSampl - xMapCOMPostReSampl ),
683 static_cast< proshade_single
> ( yMapCOMPreReSampl - yMapCOMPostReSampl ),
684 static_cast< proshade_single
> ( zMapCOMPreReSampl - zMapCOMPostReSampl ),
685 this->xDimSize, this->yDimSize, this->zDimSize,
686 static_cast< proshade_signed
> ( this->xDimIndices ),
687 static_cast< proshade_signed
> ( this->yDimIndices ),
688 static_cast< proshade_signed
> ( this->zDimIndices ) );
692 this->xDimSizeOriginal = this->xDimSize;
693 this->yDimSizeOriginal = this->yDimSize;
694 this->zDimSizeOriginal = this->zDimSize;
697 this->xDimIndicesOriginal = this->xDimIndices;
698 this->yDimIndicesOriginal = this->yDimIndices;
699 this->zDimIndicesOriginal = this->zDimIndices;
702 this->xAxisOriginOriginal = this->xAxisOrigin;
703 this->yAxisOriginOriginal = this->yAxisOrigin;
704 this->zAxisOriginOriginal = this->zAxisOrigin;
707 this->findMapCOM ( );
708 this->originalMapXCom = this->xCom;
709 this->originalMapYCom = this->yCom;
710 this->originalMapZCom = this->zCom;
734 gemmi::Structure pdbFile = gemmi::read_structure ( gemmi::MaybeGzipped ( this->fileName ) );
749 proshade_double xCOMPdb, yCOMPdb, zCOMPdb;
753 proshade_single xF, xT, yF, yT, zF, zT;
757 proshade_single xMov =
static_cast< proshade_single
> ( 20.0f - xF );
758 proshade_single yMov =
static_cast< proshade_single
> ( 20.0f - yF );
759 proshade_single zMov =
static_cast< proshade_single
> ( 20.0f - zF );
763 this->xDimSize =
static_cast< proshade_single
> ( xT - xF + 40.0f );
764 this->yDimSize =
static_cast< proshade_single
> ( yT - yF + 40.0f );
765 this->zDimSize =
static_cast< proshade_single
> ( zT - zF + 40.0f );
768 ProSHADE_internal_mapManip::generateMapFromPDB ( pdbFile, this->internalMap, settings->
requestedResolution, this->xDimSize, this->yDimSize, this->zDimSize, &this->xTo, &this->yTo, &this->zTo, settings->
forceP1, settings->
firstModelOnly );
771 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; } } }
774 this->setPDBMapValues ( );
777 proshade_double xCOMMap, yCOMMap, zCOMMap;
779 this->xDimSize, this->yDimSize, this->zDimSize,
780 this->xFrom, this->xTo, this->yFrom, this->yTo, this->zFrom, this->zTo );
782 if ( pdbFile.models.size() > 1 )
784 xMov =
static_cast< proshade_single
> ( xCOMMap - xCOMPdb );
785 yMov =
static_cast< proshade_single
> ( yCOMMap - yCOMPdb );
786 zMov =
static_cast< proshade_single
> ( zCOMMap - zCOMPdb );
791 &this->xFrom, &this->xTo, &this->yFrom, &this->yTo, &this->zFrom, &this->zTo,
792 &this->xAxisOrigin, &this->yAxisOrigin, &this->zAxisOrigin );
794 static_cast< proshade_signed
> ( this->xDimIndices ),
static_cast< proshade_signed
> ( this->yDimIndices ),
795 static_cast< proshade_signed
> ( this->zDimIndices ) );
801 proshade_single xSampRate = this->xDimSize /
static_cast< proshade_single
> ( this->xTo - this->xFrom );
802 proshade_single ySampRate = this->yDimSize /
static_cast< proshade_single
> ( this->yTo - this->yFrom );
803 proshade_single zSampRate = this->zDimSize /
static_cast< proshade_single
> ( this->zTo - this->zFrom );
806 proshade_single xStartPosBefore =
static_cast< proshade_single
> ( this->xFrom ) * xSampRate;
807 proshade_single yStartPosBefore =
static_cast< proshade_single
> ( this->yFrom ) * ySampRate;
808 proshade_single zStartPosBefore =
static_cast< proshade_single
> ( this->zFrom ) * zSampRate;
811 proshade_double xMapCOMPreReSampl = 0.0, yMapCOMPreReSampl = 0.0, zMapCOMPreReSampl = 0.0;
812 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 );
815 this->reSampleMap ( settings );
818 xSampRate = this->xDimSize /
static_cast< proshade_single
> ( this->xTo - this->xFrom );
819 ySampRate = this->yDimSize /
static_cast< proshade_single
> ( this->yTo - this->yFrom );
820 zSampRate = this->zDimSize /
static_cast< proshade_single
> ( this->zTo - this->zFrom );
823 proshade_single xStartPosAfter =
static_cast< proshade_single
> ( this->xFrom ) * xSampRate;
824 proshade_single yStartPosAfter =
static_cast< proshade_single
> ( this->yFrom ) * ySampRate;
825 proshade_single zStartPosAfter =
static_cast< proshade_single
> ( this->zFrom ) * zSampRate;
828 proshade_single xMovHlp =
static_cast< proshade_single
> ( xStartPosAfter - xStartPosBefore );
829 proshade_single yMovHlp =
static_cast< proshade_single
> ( yStartPosAfter - yStartPosBefore );
830 proshade_single zMovHlp =
static_cast< proshade_single
> ( zStartPosAfter - zStartPosBefore );
832 &this->xFrom, &this->xTo, &this->yFrom, &this->yTo, &this->zFrom, &this->zTo,
833 &this->xAxisOrigin, &this->yAxisOrigin, &this->zAxisOrigin );
836 proshade_double xMapCOMPostReSampl = 0.0, yMapCOMPostReSampl = 0.0, zMapCOMPostReSampl = 0.0;
837 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 );
841 static_cast< proshade_single
> ( xMapCOMPreReSampl - xMapCOMPostReSampl ),
842 static_cast< proshade_single
> ( yMapCOMPreReSampl - yMapCOMPostReSampl ),
843 static_cast< proshade_single
> ( zMapCOMPreReSampl - zMapCOMPostReSampl ),
844 this->xDimSize, this->yDimSize, this->zDimSize,
845 static_cast< proshade_signed
> ( this->xDimIndices ),
846 static_cast< proshade_signed
> ( this->yDimIndices ),
847 static_cast< proshade_signed
> ( this->zDimIndices ) );
851 this->xDimSizeOriginal = this->xDimSize;
852 this->yDimSizeOriginal = this->yDimSize;
853 this->zDimSizeOriginal = this->zDimSize;
856 this->xDimIndicesOriginal = this->xDimIndices;
857 this->yDimIndicesOriginal = this->yDimIndices;
858 this->zDimIndicesOriginal = this->zDimIndices;
861 this->xAxisOriginOriginal = this->xAxisOrigin;
862 this->yAxisOriginOriginal = this->yAxisOrigin;
863 this->zAxisOriginOriginal = this->zAxisOrigin;
866 this->findMapCOM ( );
867 this->originalMapXCom = this->xCom;
868 this->originalMapYCom = this->yCom;
869 this->originalMapZCom = this->zCom;
893 this->xDimIndices =
static_cast< proshade_unsign
> ( this->xTo );
894 this->yDimIndices =
static_cast< proshade_unsign
> ( this->yTo );
895 this->zDimIndices =
static_cast< proshade_unsign
> ( this->zTo );
903 this->xGridIndices = this->xDimIndices;
904 this->yGridIndices = this->yDimIndices;
905 this->zGridIndices = this->zDimIndices;
908 this->xAxisOrder = 1;
909 this->yAxisOrder = 2;
910 this->zAxisOrder = 3;
913 this->xAxisOrigin = this->xFrom;
914 this->yAxisOrigin = this->yFrom;
915 this->zAxisOrigin = this->zFrom;
929 this->xTo = this->xFrom +
static_cast< proshade_signed
> ( this->xDimIndices ) - 1;
930 this->yTo = this->yFrom +
static_cast< proshade_signed
> ( this->yDimIndices ) - 1;
931 this->zTo = this->zFrom +
static_cast< proshade_signed
> ( this->zDimIndices ) - 1;
951 gemmi::Grid<float> mapData;
952 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 ) );
953 mapData.set_size_without_checking (
static_cast< int > ( this->xDimIndices ),
static_cast< int > ( this->yDimIndices ),
static_cast< int > ( this->zDimIndices ) );
954 mapData.axis_order = gemmi::AxisOrder::XYZ;
955 mapData.spacegroup = &gemmi::get_spacegroup_p1();
958 gemmi::Ccp4<float> map;
960 map.update_ccp4_header ( mode );
964 this->xDimIndices, this->yDimIndices, this->zDimIndices,
965 this->xDimSize, this->yDimSize, this->zDimSize,
966 this->aAngle, this->bAngle, this->cAngle,
967 this->xFrom, this->yFrom, this->zFrom,
968 this->xAxisOrigin, this->yAxisOrigin, this->zAxisOrigin,
969 this->xAxisOrder, this->yAxisOrder, this->zAxisOrder,
970 this->xGridIndices, this->yGridIndices, this->zGridIndices,
974 proshade_unsign arrPos = 0;
975 for ( proshade_unsign uIt = 0; uIt < this->xDimIndices; uIt++ )
977 for ( proshade_unsign vIt = 0; vIt < this->yDimIndices; vIt++ )
979 for ( proshade_unsign wIt = 0; wIt < this->zDimIndices; wIt++ )
981 arrPos = wIt + this->zDimIndices * ( vIt + this->yDimIndices * uIt );
982 map.grid.set_value (
static_cast< int > ( uIt ),
static_cast< int > ( vIt ),
static_cast< int > ( wIt ),
static_cast<float> ( this->internalMap[arrPos] ) );
988 map.update_ccp4_header ( mode,
true );
991 map.write_ccp4_map ( fName );
1018 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." );
1022 gemmi::Structure pdbFile = gemmi::read_structure ( gemmi::MaybeGzipped ( this->fileName ) );
1025 if ( ( euA != 0.0 ) || ( euB != 0.0 ) || ( euG != 0.0 ) )
1035 std::ofstream outCoOrdFile;
1036 outCoOrdFile.open ( fName.c_str() );
1038 if ( outCoOrdFile.is_open() )
1040 gemmi::PdbWriteOptions opt;
1041 write_pdb ( pdbFile, outCoOrdFile, opt );
1045 std::stringstream hlpMessage;
1046 hlpMessage <<
"Failed to open the PDB file " << fName <<
" for output.";
1047 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." );
1050 outCoOrdFile.close ( );
1067 proshade_double* hlpMap =
new proshade_double[this->xDimIndices * this->yDimIndices * this->zDimIndices];
1071 for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
1073 hlpMap[iter] = this->internalMap[iter];
1074 this->internalMap[iter] = mask[iter];
1078 this->writeMap ( fName );
1081 for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
1083 this->internalMap[iter] = hlpMap[iter];
1107 proshade_signed arrayPos, invPos;
1110 proshade_double* hlpMap =
new proshade_double [this->xDimIndices * this->yDimIndices * this->zDimIndices];
1114 for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
1116 hlpMap[iter] = this->internalMap[iter];
1120 for ( proshade_signed xIt = 0; xIt < static_cast<proshade_signed> ( this->xDimIndices ); xIt++ )
1122 for ( proshade_signed yIt = 0; yIt < static_cast<proshade_signed> ( this->yDimIndices ); yIt++ )
1124 for ( proshade_signed zIt = 0; zIt < static_cast<proshade_signed> ( this->zDimIndices ); zIt++ )
1127 arrayPos = zIt +
static_cast< proshade_signed
> ( this->zDimIndices ) * ( yIt +
static_cast< proshade_signed
> ( this->yDimIndices ) * xIt );
1128 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 ) );
1131 this->internalMap[invPos] = hlpMap[arrayPos];
1161 std::vector<proshade_double> mapVals ( this->xDimIndices * this->yDimIndices * this->zDimIndices, 0.0 );
1164 for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
1166 mapVals.at(iter) = this->internalMap[iter];
1170 proshade_double* meanSD =
new proshade_double[2];
1174 for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
1176 this->internalMap[iter] = ( this->internalMap[iter] - meanSD[0] ) / meanSD[1];
1208 proshade_double* blurredMap =
new proshade_double[this->xDimIndices * this->yDimIndices * this->zDimIndices];
1213 this->xDimSize, this->yDimSize, this->zDimSize, settings->
blurFactor );
1219 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 ); } }
1222 delete[] blurredMap;
1250 for ( proshade_unsign iter = 0; iter < 6; iter++ ) { ret[iter] = settings->
forceBounds[iter]; }
1257 static_cast< proshade_signed
> ( this->xDimIndices ),
1258 static_cast< proshade_signed
> ( this->yDimIndices ),
1259 static_cast< proshade_signed
> ( this->zDimIndices ),
1264 this->xDimSize, this->yDimSize, this->zDimSize, ret, settings->
boundsExtraSpace );
1270 std::stringstream ssHlp;
1271 ssHlp <<
"New boundaries are: " << ret[1] - ret[0] + 1 <<
" x " << ret[3] - ret[2] + 1 <<
" x " << ret[5] - ret[4] + 1;
1277 for ( proshade_unsign iter = 0; iter < 6; iter++ ) { settings->
forceBounds[iter] = ret[iter]; }
1307 newStr->
fileType = ProSHADE_internal_io::MAP;
1310 newStr->
xDimIndices =
static_cast< proshade_unsign
> ( newBounds[1] ) -
static_cast< proshade_unsign
> ( newBounds[0] ) + 1;
1311 newStr->
yDimIndices =
static_cast< proshade_unsign
> ( newBounds[3] ) -
static_cast< proshade_unsign
> ( newBounds[2] ) + 1;
1312 newStr->
zDimIndices =
static_cast< proshade_unsign
> ( newBounds[5] ) -
static_cast< proshade_unsign
> ( newBounds[4] ) + 1;
1314 newStr->
aAngle = this->aAngle;
1315 newStr->
bAngle = this->aAngle;
1316 newStr->
cAngle = this->aAngle;
1318 newStr->
xDimSize =
static_cast<proshade_single
> ( newStr->
xDimIndices ) * ( this->xDimSize /
static_cast<proshade_single
> ( this->xDimIndices ) );
1319 newStr->
yDimSize =
static_cast<proshade_single
> ( newStr->
yDimIndices ) * ( this->yDimSize /
static_cast<proshade_single
> ( this->yDimIndices ) );
1320 newStr->
zDimSize =
static_cast<proshade_single
> ( newStr->
zDimIndices ) * ( this->zDimSize /
static_cast<proshade_single
> ( this->zDimIndices ) );
1330 newStr->
xAxisOrigin = this->xAxisOrigin + newBounds[0];
1331 newStr->
yAxisOrigin = this->yAxisOrigin + newBounds[2];
1332 newStr->
zAxisOrigin = this->zAxisOrigin + newBounds[4];
1334 newStr->
xFrom = this->xFrom + newBounds[0];
1335 newStr->
yFrom = this->yFrom + newBounds[2];
1336 newStr->
zFrom = this->zFrom + newBounds[4];
1338 newStr->
xTo = this->xTo - (
static_cast< proshade_signed
> ( this->xDimIndices - 1 ) - newBounds[1] );
1339 newStr->
yTo = this->yTo - (
static_cast< proshade_signed
> ( this->yDimIndices - 1 ) - newBounds[3] );
1340 newStr->
zTo = this->zTo - (
static_cast< proshade_signed
> ( this->zDimIndices - 1 ) - newBounds[5] );
1349 this->xDimIndices, this->yDimIndices, this->zDimIndices, newStr->
internalMap, this->internalMap );
1369 proshade_single* changeVals =
new proshade_single[6];
1375 this->xDimSize, this->yDimSize, this->zDimSize, changeVals );
1385 this->xDimSize, this->yDimSize, this->zDimSize, changeVals );
1390 this->xDimIndices +=
static_cast<proshade_unsign
> ( changeVals[0] );
1391 this->yDimIndices +=
static_cast<proshade_unsign
> ( changeVals[1] );
1392 this->zDimIndices +=
static_cast<proshade_unsign
> ( changeVals[2] );
1394 this->xGridIndices = this->xDimIndices;
1395 this->yGridIndices = this->yDimIndices;
1396 this->zGridIndices = this->zDimIndices;
1398 this->xTo +=
static_cast<proshade_unsign
> ( changeVals[0] );
1399 this->yTo +=
static_cast<proshade_unsign
> ( changeVals[1] );
1400 this->zTo +=
static_cast<proshade_unsign
> ( changeVals[2] );
1402 this->xDimSize = changeVals[3];
1403 this->yDimSize = changeVals[4];
1404 this->zDimSize = changeVals[5];
1407 proshade_single xMov = -( (
static_cast<proshade_single
> ( this->xFrom ) * ( this->xDimSize /
static_cast<proshade_single
> ( this->xDimIndices ) - changeVals[0] ) ) -
1408 (
static_cast<proshade_single
> ( this->xFrom ) * ( this->xDimSize /
static_cast<proshade_single
> ( this->xDimIndices ) ) ) );
1409 proshade_single yMov = -( (
static_cast<proshade_single
> ( this->yFrom ) * ( this->yDimSize /
static_cast<proshade_single
> ( this->yDimIndices ) - changeVals[1] ) ) -
1410 (
static_cast<proshade_single
> ( this->yFrom ) * ( this->yDimSize /
static_cast<proshade_single
> ( this->yDimIndices ) ) ) );
1411 proshade_single zMov = -( (
static_cast<proshade_single
> ( this->zFrom ) * ( this->zDimSize /
static_cast<proshade_single
> ( this->zDimIndices ) - changeVals[2] ) ) -
1412 (
static_cast<proshade_single
> ( this->zFrom ) * ( this->zDimSize /
static_cast<proshade_single
> ( this->zDimIndices ) ) ) );
1416 &this->yFrom, &this->yTo, &this->zFrom, &this->zTo, &this->xAxisOrigin, &this->yAxisOrigin, &this->zAxisOrigin );
1419 static_cast< proshade_signed
> ( this->xDimIndices ),
static_cast< proshade_signed
> ( this->yDimIndices ),
static_cast< proshade_signed
> ( this->zDimIndices ) );
1422 delete[] changeVals;
1444 proshade_double xCOM = 0.0;
1445 proshade_double yCOM = 0.0;
1446 proshade_double zCOM = 0.0;
1450 this->xDimSize, this->yDimSize, this->xDimSize, this->xFrom,
1451 this->xTo, this->yFrom, this->yTo, this->zFrom, this->zTo );
1454 proshade_single xSampRate =
static_cast< proshade_single
> ( this->xDimSize ) /
static_cast< proshade_single
> ( this->xTo - this->xFrom );
1455 proshade_single ySampRate =
static_cast< proshade_single
> ( this->yDimSize ) /
static_cast< proshade_single
> ( this->yTo - this->yFrom );
1456 proshade_single zSampRate =
static_cast< proshade_single
> ( this->zDimSize ) /
static_cast< proshade_single
> ( this->zTo - this->zFrom );
1459 xCOM /=
static_cast< proshade_double
> ( xSampRate );
1460 yCOM /=
static_cast< proshade_double
> ( ySampRate );
1461 zCOM /=
static_cast< proshade_double
> ( zSampRate );
1463 xCOM -=
static_cast< proshade_double
> ( this->xFrom );
1464 yCOM -=
static_cast< proshade_double
> ( this->yFrom );
1465 zCOM -=
static_cast< proshade_double
> ( this->zFrom );
1468 proshade_double xDist = ( (
static_cast<proshade_double
> ( this->xDimIndices ) / 2.0 ) - xCOM ) *
static_cast<proshade_double
> ( this->xDimSize ) /
static_cast<proshade_double
> ( this->xDimIndices );
1469 proshade_double yDist = ( (
static_cast<proshade_double
> ( this->yDimIndices ) / 2.0 ) - yCOM ) *
static_cast<proshade_double
> ( this->yDimSize ) /
static_cast<proshade_double
> ( this->yDimIndices );
1470 proshade_double zDist = ( (
static_cast<proshade_double
> ( this->zDimIndices ) / 2.0 ) - zCOM ) *
static_cast<proshade_double
> ( this->zDimSize ) /
static_cast<proshade_double
> ( this->zDimIndices );
1474 static_cast< proshade_single
> ( xDist ),
1475 static_cast< proshade_single
> ( yDist ),
1476 static_cast< proshade_single
> ( zDist ),
1477 this->xDimSize, this->yDimSize, this->zDimSize,
1478 static_cast< proshade_signed
> ( this->xDimIndices ),
1479 static_cast< proshade_signed
> ( this->yDimIndices ),
1480 static_cast< proshade_signed
> ( this->zDimIndices ) );
1483 this->mapCOMProcessChangeX -= xDist;
1484 this->mapCOMProcessChangeY -= yDist;
1485 this->mapCOMProcessChangeZ -= zDist;
1506 std::stringstream hlpSS;
1507 hlpSS <<
"Adding extra " << settings->
addExtraSpace <<
" angstroms.";
1516 this->xDimSize += 2 *
static_cast<proshade_single
> ( xAddIndices ) * this->xDimSize /
static_cast<proshade_single
> ( this->xDimIndices );
1517 this->yDimSize += 2 *
static_cast<proshade_single
> ( yAddIndices ) * this->yDimSize /
static_cast<proshade_single
> ( this->yDimIndices );
1518 this->zDimSize += 2 *
static_cast<proshade_single
> ( zAddIndices ) * this->zDimSize /
static_cast<proshade_single
> ( this->zDimIndices );
1520 this->xDimIndices += 2 * xAddIndices;
1521 this->yDimIndices += 2 * yAddIndices;
1522 this->zDimIndices += 2 * zAddIndices;
1524 this->xGridIndices = this->xDimIndices;
1525 this->yGridIndices = this->yDimIndices;
1526 this->zGridIndices = this->zDimIndices;
1528 this->xAxisOrigin -= xAddIndices;
1529 this->yAxisOrigin -= yAddIndices;
1530 this->zAxisOrigin -= zAddIndices;
1532 this->xFrom -= xAddIndices;
1533 this->yFrom -= yAddIndices;
1534 this->zFrom -= zAddIndices;
1536 this->xTo += xAddIndices;
1537 this->yTo += yAddIndices;
1538 this->zTo += zAddIndices;
1541 proshade_double* newMap =
new proshade_double[this->xDimIndices * this->yDimIndices * this->zDimIndices];
1545 for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
1551 proshade_unsign newMapIndex, oldMapIndex;
1552 for ( proshade_unsign xIt = 0; xIt < (this->xDimIndices - xAddIndices); xIt++ )
1555 if ( xIt < xAddIndices ) {
continue; }
1557 for ( proshade_unsign yIt = 0; yIt < (this->yDimIndices - yAddIndices); yIt++ )
1560 if ( yIt < yAddIndices ) {
continue; }
1562 for ( proshade_unsign zIt = 0; zIt < (this->zDimIndices - zAddIndices); zIt++ )
1565 if ( zIt < zAddIndices ) {
continue; }
1568 newMapIndex = zIt + this->zDimIndices * ( yIt + this->yDimIndices * xIt );
1569 oldMapIndex = (zIt - zAddIndices) + (this->zDimIndices - ( 2 * zAddIndices ) ) * ( (yIt - yAddIndices) + (this->yDimIndices - ( 2 * yAddIndices ) ) * (xIt - xAddIndices) );
1571 newMap[newMapIndex] = this->internalMap[oldMapIndex];
1577 delete[] this->internalMap;
1579 this->internalMap =
new proshade_double[this->xDimIndices * this->yDimIndices * this->zDimIndices];
1582 for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
1584 this->internalMap[iter] = newMap[iter];
1615 if ( settings->
invertMap ) { this->invertMirrorMap ( settings ); }
1619 if ( settings->
normaliseMap ) { this->normaliseMap ( settings ); }
1623 if ( settings->
maskMap ) { this->maskMap ( settings ); }
1627 if ( settings->
moveToCOM ) { this->centreMapOnCOM ( settings ); }
1631 if ( settings->
addExtraSpace != 0.0f ) { this->addExtraSpace ( settings ); }
1658 if ( this->spherePos.size() != 0 )
1660 std::stringstream hlpSS;
1661 hlpSS <<
"The sphere distances were determined as " << this->spherePos.at(0);
1662 for ( proshade_unsign iter = 1; iter < static_cast<proshade_unsign> ( this->spherePos.size() ); iter++ ) { hlpSS <<
"; " << this->spherePos.at(iter); }
1663 hlpSS <<
" Angstroms.";
1669 proshade_unsign maxDim =
static_cast< proshade_unsign
> ( std::max ( this->xDimSize, std::max ( this->yDimSize, this->zDimSize ) ) );
1670 proshade_unsign minDim =
static_cast< proshade_unsign
> ( std::min ( this->xDimSize, std::min ( this->yDimSize, this->zDimSize ) ) );
1671 proshade_unsign midDim =
static_cast< proshade_unsign
> ( 0 );
1672 if ( ( this->xDimSize <
static_cast< proshade_single
> ( maxDim ) ) && ( this->xDimSize >
static_cast< proshade_single
> ( minDim ) ) ) { midDim =
static_cast< proshade_unsign
> ( this->xDimSize ); }
1673 else if ( ( this->yDimSize <
static_cast< proshade_single
> ( maxDim ) ) && ( this->yDimSize >
static_cast< proshade_single
> ( minDim ) ) ) { midDim =
static_cast< proshade_unsign
> ( this->yDimSize ); }
1674 else { midDim =
static_cast< proshade_unsign
> ( this->zDimSize ); }
1676 proshade_single maxDiag =
static_cast< proshade_single
> ( std::sqrt ( std::pow (
static_cast<proshade_single
> ( maxDim ), 2.0 ) +
1677 std::pow (
static_cast<proshade_single
> ( midDim ), 2.0 ) ) );
1680 for ( proshade_single iter = 0.5f; ( iter * settings->
maxSphereDists ) < ( maxDiag / 2.0f ); iter += 1.0f )
1686 this->noSpheres =
static_cast<proshade_unsign
> ( this->spherePos.size() );
1689 std::stringstream hlpSS;
1690 hlpSS <<
"The sphere distances were determined as " << this->spherePos.at(0);
1691 for ( proshade_unsign iter = 1; iter < static_cast<proshade_unsign> ( this->spherePos.size() ); iter++ ) { hlpSS <<
"; " << this->spherePos.at(iter); }
1692 hlpSS <<
" Angstroms.";
1719 this->xDimSize, this->yDimSize, this->zDimSize );
1723 this->getSpherePositions ( settings );
1728 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( this->spherePos.size() ); iter++ )
1730 std::stringstream ss;
1731 ss <<
"Now mapping sphere " << iter <<
" .";
1735 this->xDimSize, this->yDimSize, this->zDimSize, iter,
1737 this->internalMap, &this->maxShellBand );
1762 this->sphericalHarmonics =
new proshade_complex* [this->noSpheres];
1764 for ( proshade_unsign iter = 0; iter < this->noSpheres; iter++ )
1766 this->sphericalHarmonics[iter] =
new proshade_complex [(this->spheres[iter]->getLocalBandwidth() * 2) * (this->spheres[iter]->getLocalBandwidth() * 2)];
1771 for ( proshade_unsign iter = 0; iter < this->noSpheres; iter++ )
1774 std::stringstream ss;
1775 ss <<
"Now decomposing sphere " << iter <<
". " <<
"( Band is: " << this->spheres[iter]->getLocalBandwidth() <<
").";
1804 fftw_complex *mapData, *origCoeffs, *fCoeffs;
1805 fftw_plan planForwardFourier;
1806 proshade_double **bindata;
1807 proshade_signed *binIndexing, *binCounts, noBins;
1808 this->prepareFSCFourierMemory ( mapData, origCoeffs, fCoeffs, binIndexing, &noBins, bindata, binCounts, &planForwardFourier );
1811 std::vector< proshade_double* > CSyms = this->getCyclicSymmetriesList ( settings );
1817 std::vector< proshade_double* > DSyms = this->getDihedralSymmetriesList ( settings, &CSyms );
1818 std::vector< proshade_double* > ISyms = this->getIcosahedralSymmetriesList ( settings, &CSyms );
1819 std::vector< proshade_double* > OSyms; std::vector< proshade_double* > TSyms;
1820 if ( ISyms.size() < 31 ) { OSyms = this->getOctahedralSymmetriesList ( settings, &CSyms );
if ( OSyms.size() < 13 ) { TSyms = this->getTetrahedralSymmetriesList ( settings, &CSyms ); } }
1823 this->saveRecommendedSymmetry ( settings, &CSyms, &DSyms, &TSyms, &OSyms, &ISyms, axes, mapData, fCoeffs, origCoeffs, &planForwardFourier, noBins, binIndexing, bindata, binCounts );
1829 this->saveRequestedSymmetryC ( settings, &CSyms, axes );
1835 std::vector< proshade_double* > DSyms = this->getDihedralSymmetriesList ( settings, &CSyms );
1836 this->saveRequestedSymmetryD ( settings, &DSyms, axes, mapData, fCoeffs, origCoeffs, &planForwardFourier, noBins, binIndexing, bindata, binCounts );
1842 std::vector< proshade_double* > TSyms = this->getTetrahedralSymmetriesList ( settings, &CSyms );
1851 std::vector< proshade_double* > OSyms = this->getOctahedralSymmetriesList ( settings, &CSyms );
1860 std::vector< proshade_double* > ISyms = this->getIcosahedralSymmetriesList ( settings, &CSyms );
1868 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." );
1872 bool isArgSameAsSettings =
true;
1873 for ( proshade_unsign cIt = 0; cIt < static_cast<proshade_unsign> ( CSyms.size() ); cIt++ )
1875 std::vector< proshade_double > nextSym;
1884 if ( ( cIt == 0 ) && ( settings->
allDetectedCAxes.size() == 0 ) ) { isArgSameAsSettings =
false; }
1891 for ( proshade_unsign it = 0; it < static_cast<proshade_unsign> ( CSyms.size() ); it++ ) {
delete[] CSyms.at(it); }
1895 delete[] origCoeffs;
1897 fftw_destroy_plan ( planForwardFourier );
1898 delete[] binIndexing;
1899 for (
size_t binIt = 0; binIt < static_cast< size_t > ( noBins ); binIt++ ) {
delete[] bindata[binIt]; }
1917 return ( a[6] > b[6] );
1937 if ( settings->axisErrToleranceDefault )
1939 settings->
axisErrTolerance = std::min ( std::max ( 0.01, ( 2.0 * M_PI ) /
static_cast< proshade_double
> ( this->maxShellBand ) ), 0.05 );
1943 fftw_complex *mapData, *origCoeffs, *fCoeffs;
1944 fftw_plan planForwardFourier;
1945 proshade_double **bindata;
1946 proshade_signed *binIndexing, *binCounts, noBins;
1947 this->prepareFSCFourierMemory ( mapData, origCoeffs, fCoeffs, binIndexing, &noBins, bindata, binCounts, &planForwardFourier );
1953 std::stringstream hlpSS;
1958 proshade_double symThres = 0.0;
1959 std::vector< proshade_double* > CSyms = this->findRequestedCSymmetryFromAngleAxis ( settings, settings->
requestedSymmetryFold, &symThres );
1962 bool possible010PIIssue =
false;
1964 if ( possible010PIIssue )
1966 proshade_double* addAxis =
new proshade_double[7];
1967 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] = -1.0;
1973 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 ); } }
1980 if ( CSyms.size() > 0 )
1982 bool passedTests =
false;
1983 for (
size_t cIt = 0; cIt < CSyms.size(); cIt++ )
1991 this->saveDetectedSymmetries ( settings, &CSyms, allCs );
2012 delete[] origCoeffs;
2014 fftw_destroy_plan ( planForwardFourier );
2015 delete[] binIndexing;
2016 for (
size_t binIt = 0; binIt < static_cast< size_t > ( noBins ); binIt++ ) {
delete[] bindata[binIt]; }
2028 std::vector< proshade_double* > CSyms = getCyclicSymmetriesListFromAngleAxis ( settings );
2031 bool possible010PIIssue =
false;
2033 if ( possible010PIIssue )
2035 proshade_double* addAxis =
new proshade_double[7];
2036 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] = -1.0;
2041 for (
size_t cIt = 0; cIt < CSyms.size(); cIt++ ) {
const FloatingPoint< proshade_double > lhs ( CSyms.at(cIt)[5] ), rhs ( -999.9 );
if ( lhs.AlmostEquals ( rhs ) ) { this->
computeFSC ( settings, &CSyms, cIt, mapData, fCoeffs, origCoeffs, &planForwardFourier, noBins, binIndexing, bindata, binCounts ); } }
2044 std::stringstream ss;
2045 ss <<
"Detected " << CSyms.size() <<
" C symmetries.";
2049 if ( this->sphereMappedRotFun.size() < 1 )
2051 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." );
2057 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." );
2064 std::vector< proshade_double* > DSyms = this->getDihedralSymmetriesList ( settings, &CSyms );
2065 std::vector< proshade_double* > ISyms;
2066 std::vector< proshade_double* > OSyms = this->getPredictedOctahedralSymmetriesList ( settings, &CSyms );
2067 std::vector< proshade_double* > TSyms = this->getPredictedTetrahedralSymmetriesList ( settings, &CSyms );
2070 proshade_double fscMax = 0.0;
2071 size_t fscMaxInd = 0;
2072 std::vector < std::vector< proshade_double* > > ISymsHlp = this->getPredictedIcosahedralSymmetriesList ( settings, &CSyms );
2074 for (
size_t icoIt = 0; icoIt < ISymsHlp.size(); icoIt++ )
2077 if ( ISymsHlp.at(icoIt).size() != 31 ) {
continue; }
2080 proshade_double fscVal = 0.0;
2081 proshade_double fscValAvg = 0.0;
2084 for (
size_t aIt = 0; aIt < ISymsHlp.at(icoIt).size(); aIt++ )
2087 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 );
2090 fscVal = this->
computeFSC ( settings, &CSyms,
static_cast< size_t > ( matchedPos ), mapData, fCoeffs, origCoeffs, &planForwardFourier, noBins, binIndexing, bindata, binCounts );
2091 ISymsHlp.at(fscMaxInd).at(aIt)[6] = fscVal;
2092 fscValAvg += fscVal;
2099 if ( fscValAvg > fscMax )
2110 for ( proshade_unsign retIt = 0; retIt < static_cast < proshade_unsign > ( ISymsHlp.at(fscMaxInd).size() ); retIt++ )
2113 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 );
2122 this->saveRecommendedSymmetry ( settings, &CSyms, &DSyms, &TSyms, &OSyms, &ISyms, axes, mapData, fCoeffs, origCoeffs, &planForwardFourier, noBins, binIndexing, bindata, binCounts );
2128 std::vector< proshade_double* > DSyms = this->getDihedralSymmetriesList ( settings, &CSyms );
2129 this->saveRequestedSymmetryD ( settings, &DSyms, axes, mapData, fCoeffs, origCoeffs, &planForwardFourier, noBins, binIndexing, bindata, binCounts );
2135 std::vector< proshade_double* > TSyms = this->getPredictedTetrahedralSymmetriesList ( settings, &CSyms );
2137 if ( TSyms.size() == 7 )
2140 proshade_double fscVal = 0.0;
2141 proshade_double fscValAvg = 0.0;
2144 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 ); fscValAvg += fscVal; } }
2162 std::vector< proshade_double* > OSyms = this->getPredictedOctahedralSymmetriesList ( settings, &CSyms );
2164 if ( OSyms.size() == 13 )
2167 proshade_double fscVal = 0.0;
2168 proshade_double fscValAvg = 0.0;
2171 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 ); fscValAvg += fscVal; } }
2189 proshade_double fscMax = 0.0;
2190 size_t fscMaxInd = 0;
2191 std::vector < std::vector< proshade_double* > > ISymsHlp = this->getPredictedIcosahedralSymmetriesList ( settings, &CSyms );
2192 std::vector< proshade_double* > ISyms;
2194 for (
size_t icoIt = 0; icoIt < ISymsHlp.size(); icoIt++ )
2197 if ( ISymsHlp.at(icoIt).size() != 31 ) {
continue; }
2200 proshade_double fscVal = 0.0;
2201 proshade_double fscValAvg = 0.0;
2204 for (
size_t aIt = 0; aIt < ISymsHlp.at(icoIt).size(); aIt++ )
2207 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 );
2210 fscVal = this->
computeFSC ( settings, &CSyms,
static_cast< size_t > ( matchedPos ), mapData, fCoeffs, origCoeffs, &planForwardFourier, noBins, binIndexing, bindata, binCounts );
2211 ISymsHlp.at(fscMaxInd).at(aIt)[6] = fscVal;
2212 fscValAvg += fscVal;
2219 if ( fscValAvg > fscMax )
2230 for ( proshade_unsign retIt = 0; retIt < static_cast < proshade_unsign > ( ISymsHlp.at(fscMaxInd).size() ); retIt++ )
2233 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 );
2242 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); } }
2256 this->saveDetectedSymmetries ( settings, &CSyms, allCs );
2260 delete[] origCoeffs;
2262 fftw_destroy_plan ( planForwardFourier );
2263 delete[] binIndexing;
2264 for (
size_t binIt = 0; binIt < static_cast< size_t > ( noBins ); binIt++ ) {
delete[] bindata[binIt]; }
2289 bool isArgSameAsSettings =
true;
2292 for ( proshade_unsign cIt = 0; cIt < static_cast<proshade_unsign> ( CSyms->size() ); cIt++ )
2295 std::vector< proshade_double > nextSym;
2306 if ( ( cIt == 0 ) && ( settings->
allDetectedCAxes.size() == 0 ) ) { isArgSameAsSettings =
false; }
2311 delete[] CSyms->at(cIt);
2335 proshade_double threshold = 0.0;
2336 proshade_signed totSize =
static_cast< proshade_signed
> ( ( 1.0 / step ) + 1 );
2337 std::vector< std::pair < proshade_double, proshade_unsign > > vals;
2338 std::vector< proshade_double > hist (
static_cast< unsigned long int > ( totSize ), 0.0 );
2339 proshade_unsign histPos = 0;
2342 if ( windowSize % 2 == 0 ) { windowSize += 1; }
2345 for ( proshade_unsign symIt = 0; symIt < static_cast<proshade_unsign> ( CSym->size() ); symIt++ ) { vals.emplace_back ( std::pair < proshade_double, proshade_unsign > ( CSym->at(symIt)[peakPos], symIt ) ); }
2348 for ( proshade_double it = 0.0; it <= 1.0; it = it + step )
2350 for ( proshade_unsign symIt = 0; symIt < static_cast<proshade_unsign> ( vals.size() ); symIt++ )
2353 if ( ( vals.at(symIt).first > it ) && ( vals.at(symIt).first <= ( it + step ) ) ) { hist.at(histPos) += 1.0; }
2367 proshade_signed bestHistPos;
2368 if ( peaks.size() > 0 ) { bestHistPos = peaks.at(peaks.size()-1) + ( ( windowSize - 1 ) / 2 ); }
2369 else { bestHistPos = 0.0; }
2371 threshold = (
static_cast< proshade_double
> ( bestHistPos ) * step ) - (
static_cast< proshade_double
> ( windowSize ) * step );
2374 return ( threshold );
2394 bindata =
new proshade_double*[*noBins];
2395 binCounts =
new proshade_signed [*noBins];
2398 for (
size_t binIt = 0; binIt < static_cast< size_t > ( *noBins ); binIt++ )
2400 bindata[binIt] =
new proshade_double[12];
2405 mapData =
new fftw_complex [this->xDimIndices * this->yDimIndices * this->zDimIndices];
2406 origCoeffs =
new fftw_complex [this->xDimIndices * this->yDimIndices * this->zDimIndices];
2407 fCoeffs =
new fftw_complex [this->xDimIndices * this->yDimIndices * this->zDimIndices];
2417 *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 );
2420 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; }
2421 fftw_execute ( *planForwardFourier );
2422 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]; }
2456 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 )
2459 if ( symIndex >= CSym->size() )
2461 std::cerr <<
"The supplied symmetry axes vector does not contain element number " << symIndex <<
". Returning FSC 0.0." << std::endl;
2466 const FloatingPoint< proshade_double > lhs1 ( CSym->at(symIndex)[6] ), rhs1 ( -1.0 );
2467 if ( !lhs1.AlmostEquals ( rhs1 ) ) {
return ( CSym->at(symIndex)[6] ); }
2470 std::stringstream ss2;
2471 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];
2475 proshade_double *rotMap;
2478 proshade_double averageFSC = 0.0;
2479 for ( proshade_double rotIter = 1.0; rotIter < CSym->at(symIndex)[0]; rotIter += 1.0 )
2482 this->rotateMapRealSpace ( CSym->at(symIndex)[1], CSym->at(symIndex)[2], CSym->at(symIndex)[3], ( ( 2.0 * M_PI ) / CSym->at(symIndex)[0] ) * rotIter, rotMap );
2485 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; }
2486 fftw_execute ( *planForwardFourier );
2489 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; } }
2490 for (
size_t binIt = 0; binIt < static_cast< size_t > ( noBins ); binIt++ ) { binCounts[binIt] = 0; }
2493 averageFSC +=
ProSHADE_internal_maths::computeFSC ( origCoeffs, fCoeffs, this->xDimIndices, this->yDimIndices, this->zDimIndices, noBins, binIndexing, bindata, binCounts );
2500 averageFSC /= ( CSym->at(symIndex)[0] - 1.0 );
2503 CSym->at(symIndex)[6] = averageFSC;
2506 std::stringstream ss3;
2507 ss3 <<
"FSC value is " << averageFSC <<
" .";
2511 return ( averageFSC );
2544 const FloatingPoint< proshade_double > lhs1 ( sym[6] ), rhs1 ( -1.0 );
2545 if ( !lhs1.AlmostEquals ( rhs1 ) ) {
return ( sym[6] ); }
2548 std::stringstream ss2;
2549 ss2 <<
"Computing FSC for symmetry C" << sym[0] <<
" ( " << sym[1] <<
" ; " << sym[2] <<
" ; " << sym[3] <<
" ) with peak height " << sym[5];
2553 proshade_double *rotMap;
2556 proshade_double averageFSC = 0.0;
2557 for ( proshade_double rotIter = 1.0; rotIter < sym[0]; rotIter += 1.0 )
2560 this->rotateMapRealSpace ( sym[1], sym[2], sym[3], ( ( 2.0 * M_PI ) / sym[0] ) * rotIter, rotMap );
2563 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; }
2564 fftw_execute ( *planForwardFourier );
2567 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; } }
2568 for (
size_t binIt = 0; binIt < static_cast< size_t > ( noBins ); binIt++ ) { binCounts[binIt] = 0; }
2571 averageFSC +=
ProSHADE_internal_maths::computeFSC ( origCoeffs, fCoeffs, this->xDimIndices, this->yDimIndices, this->zDimIndices, noBins, binIndexing, bindata, binCounts );
2578 averageFSC /= ( sym[0] - 1.0 );
2581 sym[6] = averageFSC;
2584 std::stringstream ss3;
2585 ss3 <<
"FSC value is " << averageFSC <<
" .";
2589 return ( averageFSC );
2627 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 )
2633 if ( CSym->size() == 0 )
2641 proshade_double step = 0.01;
2642 proshade_double sigma = 0.03;
2643 proshade_signed windowSize = 9;
2644 proshade_double bestHistPeakStart = this->findTopGroupSmooth ( CSym, 5, step, sigma, windowSize );
2648 proshade_unsign noPassed = 0;
for (
size_t cIt = 0; cIt < CSym->size(); cIt++ ) {
if ( CSym->at(cIt)[5] > bestHistPeakStart ) { noPassed += 1; } }
2649 std::stringstream ss;
2650 ss <<
"Smoothening has resolved in " << noPassed <<
" C symmetries.";
2655 bool alreadyDecided =
false;
2656 if ( ISym->size() == 31 )
2659 proshade_double fscVal = 0.0;
2660 proshade_double fscValAvg = 0.0;
2663 for (
size_t iIt = 0; iIt < 31; iIt++ ) {
if ( CSym->at(settings->
allDetectedIAxes.at(iIt))[5] > bestHistPeakStart ) { fscVal = this->
computeFSC ( settings, CSym, settings->
allDetectedIAxes.at(iIt), mapData, fCoeffs, origCoeffs, planForwardFourier, noBins, binIndexing, bindata, binCounts ); fscValAvg += fscVal; } }
2676 alreadyDecided =
true;
2681 if ( ( OSym->size() == 13 ) && !alreadyDecided )
2684 proshade_double fscVal = 0.0;
2685 proshade_double fscValAvg = 0.0;
2688 for (
size_t oIt = 0; oIt < 13; oIt++ ) {
if ( CSym->at(settings->
allDetectedOAxes.at(oIt))[5] > bestHistPeakStart ) { fscVal = this->
computeFSC ( settings, CSym, settings->
allDetectedOAxes.at(oIt), mapData, fCoeffs, origCoeffs, planForwardFourier, noBins, binIndexing, bindata, binCounts ); fscValAvg += fscVal; } }
2701 alreadyDecided =
true;
2706 if ( ( TSym->size() == 7 ) && !alreadyDecided )
2709 proshade_double fscVal = 0.0;
2710 proshade_double fscValAvg = 0.0;
2713 for (
size_t tIt = 0; tIt < 7; tIt++ ) {
if ( CSym->at(settings->
allDetectedTAxes.at(tIt))[5] > bestHistPeakStart ) { fscVal = this->
computeFSC ( settings, CSym, settings->
allDetectedTAxes.at(tIt), mapData, fCoeffs, origCoeffs, planForwardFourier, noBins, binIndexing, bindata, binCounts ); fscValAvg += fscVal; } }
2726 alreadyDecided =
true;
2731 if ( ( settings->
allDetectedDAxes.size() > 0 ) && ( DSym->size() > 0 ) && !alreadyDecided )
2734 proshade_signed bestD = -1;
2735 proshade_unsign bestFold = 0;
2741 if ( dIt > 20 ) {
continue; }
2744 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 ) );
2745 if ( ( CSym->at(settings->
allDetectedDAxes.at(dIt).at(0))[5] < bestHistPeakStart ) && !( lhs999a.AlmostEquals( rhs999 ) ) ) {
continue; }
2746 if ( ( CSym->at(settings->
allDetectedDAxes.at(dIt).at(1))[5] < bestHistPeakStart ) && !( lhs999b.AlmostEquals( rhs999 ) ) ) {
continue; }
2749 this->
computeFSC ( settings, CSym, settings->
allDetectedDAxes.at(dIt).at(0), mapData, fCoeffs, origCoeffs, planForwardFourier, noBins, binIndexing, bindata, binCounts );
2750 this->
computeFSC ( settings, CSym, settings->
allDetectedDAxes.at(dIt).at(1), mapData, fCoeffs, origCoeffs, planForwardFourier, noBins, binIndexing, bindata, binCounts );
2754 proshade_double bestHistFSCStart = this->findTopGroupSmooth ( CSym, 6, step, sigma, windowSize );
2760 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 ) );
2761 if ( ( CSym->at(settings->
allDetectedDAxes.at(dIt).at(0))[5] < bestHistPeakStart ) && !( lhs999a2.AlmostEquals( rhs999 ) ) ) {
continue; }
2762 if ( ( CSym->at(settings->
allDetectedDAxes.at(dIt).at(1))[5] < bestHistPeakStart ) && !( lhs999b2.AlmostEquals( rhs999 ) ) ) {
continue; }
2765 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 ) ) )
2770 if ( std::max ( CSym->at(settings->
allDetectedDAxes.at(dIt).at(0))[6], CSym->at(settings->
allDetectedDAxes.at(dIt).at(1))[6] ) < bestHistFSCStart ) {
continue; }
2773 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] ) );
2774 bestD =
static_cast< proshade_signed
> ( dIt );
2783 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] ) ) );
2793 alreadyDecided =
true;
2798 if ( ( CSym->size() > 0 ) && !alreadyDecided )
2801 proshade_signed bestC = -1;
2802 proshade_unsign bestFold = 0;
2805 for (
size_t cIt = 0; cIt < CSym->size(); cIt++ )
2808 if ( cIt > 20 ) {
continue; }
2811 if ( CSym->at(cIt)[5] < bestHistPeakStart ) {
continue; }
2814 this->
computeFSC ( settings, CSym, cIt, mapData, fCoeffs, origCoeffs, planForwardFourier, noBins, binIndexing, bindata, binCounts );
2818 proshade_double bestHistFSCStart = this->findTopGroupSmooth ( CSym, 6, step, sigma, windowSize );
2821 for (
size_t cIt = 0; cIt < CSym->size(); cIt++ )
2824 if ( CSym->at(cIt)[0] >
static_cast< proshade_double
> ( bestFold ) )
2827 if ( ( CSym->at(cIt)[6] > settings->
fscThreshold ) && ( CSym->at(cIt)[6] >= bestHistFSCStart ) )
2829 bestFold =
static_cast< proshade_unsign
> ( CSym->at(cIt)[0] );
2830 bestC =
static_cast< proshade_signed
> ( cIt );
2840 settings->
setRecommendedFold (
static_cast< proshade_unsign
> ( CSym->at(
static_cast< size_t > ( bestC ) )[0] ) );
2845 alreadyDecided =
true;
2868 proshade_unsign bestIndex = 0;
2869 proshade_double highestSym = 0.0;
2872 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( CSym->size() ); iter++ )
2875 const FloatingPoint< proshade_double > lhs1 ( CSym->at(iter)[0] ), rhs1 (
static_cast< proshade_double
> ( settings->
requestedSymmetryFold ) );
2876 if ( !lhs1.AlmostEquals ( rhs1 ) ) {
continue; }
2879 if ( CSym->at(iter)[5] > highestSym )
2881 highestSym = CSym->at(iter)[5];
2887 if ( highestSym > 0.0 )
2890 settings->
setRecommendedFold (
static_cast< proshade_unsign
> ( CSym->at(bestIndex)[0] ) );
2917 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 )
2920 proshade_unsign bestIndex = 0;
2921 proshade_double highestSym = 0.0;
2924 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( DSym->size() ); iter++ )
2927 const FloatingPoint< proshade_double > lhs1 ( std::max ( DSym->at(iter)[0], DSym->at(iter)[7] ) ), rhs1 (
static_cast< proshade_double
> ( settings->
requestedSymmetryFold ) );
2928 if ( !lhs1.AlmostEquals ( rhs1 ) ) {
continue; }
2931 const FloatingPoint< proshade_double > lhs999a ( DSym->at(iter)[5] ), lhs999b ( DSym->at(iter)[12] ), rhs999 (
static_cast< proshade_double
> ( -999.9 ) );
2932 if ( ( DSym->at(iter)[5] < settings->
peakThresholdMin ) && !( lhs999a.AlmostEquals( rhs999 ) ) ) {
continue; }
2933 if ( ( DSym->at(iter)[12] < settings->
peakThresholdMin ) && !( lhs999b.AlmostEquals( rhs999 ) ) ) {
continue; }
2936 this->
computeFSC ( settings, &DSym->at(iter)[0], mapData, fCoeffs, origCoeffs, planForwardFourier, noBins, binIndexing, bindata, binCounts );
2937 this->
computeFSC ( settings, &DSym->at(iter)[7], mapData, fCoeffs, origCoeffs, planForwardFourier, noBins, binIndexing, bindata, binCounts );
2940 if ( ( DSym->at(iter)[6] + DSym->at(iter)[13] ) > highestSym )
2942 highestSym = ( DSym->at(iter)[6] + DSym->at(iter)[13] );
2948 if ( highestSym > 0.0 )
2951 settings->
setRecommendedFold (
static_cast< proshade_unsign
> ( std::max ( DSym->at(bestIndex)[0], DSym->at(bestIndex)[7] ) ) );
2983 std::vector< proshade_double > angList;
2984 std::vector<std::vector< proshade_double > > ret;
2987 proshade_double* rotMat =
new proshade_double[9];
2992 proshade_double normF = std::sqrt( std::pow ( xAx, 2.0 ) + std::pow ( yAx, 2.0 ) + std::pow ( zAx, 2.0 ) );
2998 if ( fold % 2 == 0 )
3001 for ( proshade_double iter =
static_cast < proshade_double
> ( -( ( fold / 2 ) - 1 ) ); iter <= static_cast < proshade_double > ( fold / 2 ); iter++ )
3009 for ( proshade_double iter =
static_cast < proshade_double
> ( -fold / 2 ); iter <= static_cast < proshade_double > ( fold / 2 ); iter++ )
3016 for ( proshade_unsign iter = 0; iter < static_cast < proshade_unsign > ( angList.size() ); iter++ )
3022 std::vector < proshade_double > retEl;
3023 for ( proshade_unsign matIt = 0; matIt < 9; matIt++ )
3047 if ( obtainedAxes != requiredAxes )
3049 std::stringstream hlpSS;
3050 hlpSS <<
"The supplied number of axes for group element\n : detection ( >" << obtainedAxes <<
"< ) does not match the group type ( >" << groupType <<
"< ).";
3051 throw ProSHADE_exception (
"Mismatch between supplied number of axes and\n : symmetry type.",
"ES00059", __FILE__, __LINE__, __func__, hlpSS.str() );
3066 bool checkElementAlreadyExists ( std::vector<std::vector< proshade_double > >* elements, std::vector< proshade_double >* elem, proshade_double matrixTolerance )
3069 bool elementFound =
false;
3072 for ( proshade_unsign elIt = 0; elIt < static_cast<proshade_unsign> ( elements->size() ); elIt++ )
3076 elementFound =
true;
3082 return ( elementFound );
3095 bool isGroup =
true;
3098 for ( proshade_unsign gr1 = 0; gr1 < static_cast<proshade_unsign> ( elements->size() ); gr1++ )
3100 for ( proshade_unsign gr2 = 1; gr2 < static_cast<proshade_unsign> ( elements->size() ); gr2++ )
3103 if ( gr1 >= gr2 ) {
continue; }
3117 if ( !isGroup ) {
break; }
3136 std::vector< std::vector< proshade_double > > ret;
3139 for ( proshade_unsign elIt = 0; elIt < static_cast<proshade_unsign> ( first->size() ); elIt++ )
3148 for ( proshade_unsign elIt = 0; elIt < static_cast<proshade_unsign> ( second->size() ); elIt++ )
3159 for ( proshade_unsign gr1 = 0; gr1 < static_cast<proshade_unsign> ( first->size() ); gr1++ )
3161 for ( proshade_unsign gr2 = 0; gr2 < static_cast<proshade_unsign> ( second->size() ); gr2++ )
3202 std::vector<std::vector< proshade_double > > ret;
3205 if ( groupType ==
"C" )
3214 static_cast< proshade_signed
> ( settings->
allDetectedCAxes.at(axesList.at(0)).at(0) ) );
3220 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." );
3223 else if ( groupType ==
"D" )
3232 static_cast< proshade_signed
> ( settings->
allDetectedCAxes.at(axesList.at(0)).at(0) ) );
3236 static_cast< proshade_signed
> ( settings->
allDetectedCAxes.at(axesList.at(1)).at(0) ) );
3245 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." );
3248 else if ( groupType ==
"T" )
3254 for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
3257 const FloatingPoint< proshade_double > lhs1 ( settings->
allDetectedCAxes.at(axesList.at(grIt)).at(0) ), rhs1 ( 3.0 );
3258 if ( lhs1.AlmostEquals ( rhs1 ) )
3264 static_cast< proshade_signed
> ( settings->
allDetectedCAxes.at(axesList.at(grIt)).at(0) ) );
3272 for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
3275 const FloatingPoint< proshade_double > lhs1 ( settings->
allDetectedCAxes.at(axesList.at(grIt)).at(0) ), rhs1 ( 2.0 );
3276 if ( lhs1.AlmostEquals ( rhs1 ) )
3282 static_cast< proshade_signed
> ( settings->
allDetectedCAxes.at(axesList.at(grIt)).at(0) ) );
3293 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." );
3296 else if ( groupType ==
"O" )
3302 for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
3305 const FloatingPoint< proshade_double > lhs1 ( settings->
allDetectedCAxes.at(axesList.at(grIt)).at(0) ), rhs1 ( 4.0 );
3306 if ( lhs1.AlmostEquals ( rhs1 ) )
3312 static_cast< proshade_signed
> ( settings->
allDetectedCAxes.at(axesList.at(grIt)).at(0) ) );
3320 for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
3323 const FloatingPoint< proshade_double > lhs1 ( settings->
allDetectedCAxes.at(axesList.at(grIt)).at(0) ), rhs1 ( 3.0 );
3324 if ( lhs1.AlmostEquals ( rhs1 ) )
3330 static_cast< proshade_signed
> ( settings->
allDetectedCAxes.at(axesList.at(grIt)).at(0) ) );
3338 for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
3341 const FloatingPoint< proshade_double > lhs1 ( settings->
allDetectedCAxes.at(axesList.at(grIt)).at(0) ), rhs1 ( 2.0 );
3342 if ( lhs1.AlmostEquals ( rhs1 ) )
3348 static_cast< proshade_signed
> ( settings->
allDetectedCAxes.at(axesList.at(grIt)).at(0) ) );
3359 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." );
3362 else if ( groupType ==
"I" )
3368 for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
3371 const FloatingPoint< proshade_double > lhs1 ( settings->
allDetectedCAxes.at(axesList.at(grIt)).at(0) ), rhs1 ( 5.0 );
3372 if ( lhs1.AlmostEquals ( rhs1 ) )
3378 static_cast< proshade_signed
> ( settings->
allDetectedCAxes.at(axesList.at(grIt)).at(0) ) );
3386 for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
3389 const FloatingPoint< proshade_double > lhs1 ( settings->
allDetectedCAxes.at(axesList.at(grIt)).at(0) ), rhs1 ( 3.0 );
3390 if ( lhs1.AlmostEquals ( rhs1 ) )
3396 static_cast< proshade_signed
> ( settings->
allDetectedCAxes.at(axesList.at(grIt)).at(0) ) );
3404 for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
3407 const FloatingPoint< proshade_double > lhs1 ( settings->
allDetectedCAxes.at(axesList.at(grIt)).at(0) ), rhs1 ( 2.0 );
3408 if ( lhs1.AlmostEquals ( rhs1 ) )
3414 static_cast< proshade_signed
> ( settings->
allDetectedCAxes.at(axesList.at(grIt)).at(0) ) );
3425 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." );
3428 else if ( groupType ==
"X" )
3431 for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
3437 static_cast< proshade_signed
> ( settings->
allDetectedCAxes.at(axesList.at(grIt)).at(0) ) );
3447 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." );
3452 std::stringstream hlpSS;
3453 hlpSS <<
"Unknown symmetry type: >" << groupType <<
"<";
3454 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." );
3469 if ( saveTo !=
nullptr )
3476 saveTo =
new proshade_double[this->xDimIndices * this->yDimIndices * this->zDimIndices];
3482 for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
3484 saveTo[iter] = this->internalMap[iter];
3507 std::stringstream ssHlp;
3508 std::vector< proshade_double > comMove = this->getMapCOMProcessChange ( );
3509 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 .";
3514 ssHlp.clear(); ssHlp.str (
"" );
3515 ssHlp <<
" Fold X Y Z Angle Height Average FSC";
3518 for ( proshade_unsign symIt = 0; symIt < static_cast<proshade_unsign> ( settings->
detectedSymmetry.size() ); symIt++ )
3520 ssHlp.clear(); ssHlp.str (
"" );
3525 std::stringstream hlpSS3;
3526 ssHlp.clear(); ssHlp.str (
"" );
3527 hlpSS3 << std::endl <<
"To facilitate manual checking for symmetries, the following is a list of all detected C symmetries:";
3532 ssHlp.clear(); ssHlp.str (
"" );
3533 ssHlp <<
" Fold X Y Z Angle Height Average FSC";
3536 for ( proshade_unsign symIt = 0; symIt < static_cast<proshade_unsign> ( settings->
allDetectedCAxes.size() ); symIt++ )
3538 ssHlp.clear(); ssHlp.str (
"" );
3560 proshade_double totNonZeroPoints = 0.0;
3561 proshade_signed mapIt = 0;
3564 for ( proshade_signed xIt = 0; xIt < static_cast<proshade_signed> ( this->xDimIndices ); xIt++ )
3566 for ( proshade_signed yIt = 0; yIt < static_cast<proshade_signed> ( this->yDimIndices ); yIt++ )
3568 for ( proshade_signed zIt = 0; zIt < static_cast<proshade_signed> ( this->zDimIndices ); zIt++ )
3571 mapIt = zIt +
static_cast< proshade_signed
> ( this->zDimIndices ) * ( yIt +
static_cast< proshade_signed
> ( this->yDimIndices ) * xIt );
3574 if ( this->internalMap[mapIt] <= 0.0 ) {
continue; }
3577 this->xCom += this->internalMap[mapIt] *
static_cast<proshade_double
> ( xIt + this->xFrom );
3578 this->yCom += this->internalMap[mapIt] *
static_cast<proshade_double
> ( yIt + this->yFrom );
3579 this->zCom += this->internalMap[mapIt] *
static_cast<proshade_double
> ( zIt + this->zFrom );
3580 totNonZeroPoints += this->internalMap[mapIt];
3585 this->xCom /= totNonZeroPoints;
3586 this->yCom /= totNonZeroPoints;
3587 this->zCom /= totNonZeroPoints;
3590 this->xCom =
static_cast< proshade_double
> ( (
static_cast< proshade_single
> ( this->xFrom ) * ( this->xDimSizeOriginal /
static_cast< proshade_single
> ( this->xDimIndicesOriginal ) ) ) +
3591 ( (
static_cast< proshade_single
> ( this->xCom ) -
static_cast< proshade_single
> ( this->xFrom ) ) *
3592 (
static_cast< proshade_single
> ( this->xDimSizeOriginal ) /
static_cast< proshade_single
> ( this->xDimIndicesOriginal ) ) ) );
3593 this->yCom =
static_cast< proshade_double
> ( (
static_cast< proshade_single
> ( this->yFrom ) * ( this->yDimSizeOriginal /
static_cast< proshade_single
> ( this->yDimIndicesOriginal ) ) ) +
3594 ( (
static_cast< proshade_single
> ( this->yCom ) -
static_cast< proshade_single
> ( this->yFrom ) ) *
3595 (
static_cast< proshade_single
> ( this->yDimSizeOriginal ) /
static_cast< proshade_single
> ( this->yDimIndicesOriginal ) ) ) );
3596 this->zCom =
static_cast< proshade_double
> ( (
static_cast< proshade_single
> ( this->zFrom ) * ( this->zDimSizeOriginal /
static_cast< proshade_single
> ( this->zDimIndicesOriginal ) ) ) +
3597 ( (
static_cast< proshade_single
> ( this->zCom ) -
static_cast< proshade_single
> ( this->zFrom ) ) *
3598 (
static_cast< proshade_single
> ( this->zDimSizeOriginal ) /
static_cast< proshade_single
> ( this->zDimIndicesOriginal ) ) ) );
3612 return ( this->noSpheres );
3623 return ( this->internalMap[pos] );
3633 return ( this->maxShellBand );
3643 return ( this->rrpMatrices[band][sh1][sh2] );
3658 if ( this->spheres[shell]->getLocalBandwidth( ) >= bandVal )
3682 fftw_complex* mapCoeffs =
new fftw_complex[this->xDimIndices * this->yDimIndices * this->zDimIndices];
3683 fftw_complex* pattersonMap =
new fftw_complex[this->xDimIndices * this->yDimIndices * this->zDimIndices];
3690 for ( proshade_unsign iter = 0; iter < (this->xDimIndices * this->yDimIndices * this->zDimIndices); iter++ )
3692 pattersonMap[iter][0] = this->internalMap[iter];
3693 pattersonMap[iter][1] = 0.0;
3697 fftw_plan forward = fftw_plan_dft_3d (
static_cast< int > ( this->xDimIndices ),
static_cast< int > ( this->yDimIndices ),
static_cast< int > ( this->zDimIndices ),
3698 pattersonMap, mapCoeffs, FFTW_FORWARD, FFTW_ESTIMATE );
3699 fftw_plan inverse = fftw_plan_dft_3d (
static_cast< int > ( this->xDimIndices ),
static_cast< int > ( this->yDimIndices ),
static_cast< int > ( this->zDimIndices ),
3700 mapCoeffs, pattersonMap, FFTW_BACKWARD, FFTW_ESTIMATE );
3703 fftw_execute ( forward );
3709 fftw_execute ( inverse );
3712 proshade_signed mapIt, patIt, patX, patY, patZ;
3713 for ( proshade_signed xIt = 0; xIt < static_cast<proshade_signed> ( this->xDimIndices ); xIt++ )
3715 for ( proshade_signed yIt = 0; yIt < static_cast<proshade_signed> ( this->yDimIndices ); yIt++ )
3717 for ( proshade_signed zIt = 0; zIt < static_cast<proshade_signed> ( this->zDimIndices ); zIt++ )
3720 patX = xIt - (
static_cast<proshade_signed
> ( this->xDimIndices ) / 2 );
if ( patX < 0 ) { patX += this->xDimIndices; }
3721 patY = yIt - (
static_cast<proshade_signed
> ( this->yDimIndices ) / 2 );
if ( patY < 0 ) { patY += this->yDimIndices; }
3722 patZ = zIt - (
static_cast<proshade_signed
> ( this->zDimIndices ) / 2 );
if ( patZ < 0 ) { patZ += this->zDimIndices; }
3725 mapIt = zIt +
static_cast< proshade_signed
> ( this->zDimIndices ) * ( yIt +
static_cast< proshade_signed
> ( this->yDimIndices ) * xIt );
3726 patIt = patZ +
static_cast< proshade_signed
> ( this->zDimIndices ) * ( patY +
static_cast< proshade_signed
> ( this->yDimIndices ) * patX );
3729 this->internalMap[mapIt] = pattersonMap[patIt][0];
3735 delete[] pattersonMap;
3739 fftw_destroy_plan ( forward );
3740 fftw_destroy_plan ( inverse );
3757 return ( &this->sphericalHarmonics[shell][seanindex (
static_cast< int > ( order ) -
static_cast< int > ( band ),
3758 static_cast< int > ( band ),
3759 static_cast< int > ( this->spheres[shell]->getLocalBandwidth() ) )][0] );
3770 return ( &this->sphericalHarmonics[shell][seanindex (
static_cast< int > ( order ) -
static_cast< int > ( band ),
3771 static_cast< int > ( band ),
3772 static_cast< int > ( this->spheres[shell]->getLocalBandwidth() ) )][1] );
3783 return ( this->spheres[shell]->getShellRadius() );
3794 return ( this->integrationWeight );
3806 return ( this->spheres[shell]->getLocalBandwidth ( ) );
3818 return ( this->spherePos.at(shell) );
3830 return ( this->eMatrices[band] );
3845 *valueReal = this->eMatrices[band][order1][order2][0];
3846 *valueImag = this->eMatrices[band][order1][order2][1];
3860 return ( this->so3CoeffsInverse );
3871 return ( this->so3Coeffs );
3882 return ( this->maxCompBand );
3897 *valueReal = this->wignerMatrices[band][order1][order2][0];
3898 *valueImag = this->wignerMatrices[band][order1][order2][1];
3912 return ( this->xDimSize );
3922 return ( this->yDimSize );
3932 return ( this->zDimSize );
3942 return ( this->xDimIndices );
3952 return ( this->yDimIndices );
3962 return ( this->zDimIndices );
3972 return ( &this->xFrom );
3982 return ( &this->yFrom );
3992 return ( &this->zFrom );
4002 return ( &this->xTo );
4012 return ( &this->yTo );
4022 return ( &this->zTo );
4032 return ( &this->xAxisOrigin );
4042 return ( &this->yAxisOrigin );
4052 return ( &this->zAxisOrigin );
4062 return ( this->internalMap );
4072 return ( this->translationMap );
4082 std::vector< proshade_double > ret;
4100 this->integrationWeight = intW;
4114 this->integrationWeight += intW;
4131 this->eMatrices[band][order1][order2][0] = val[0];
4132 this->eMatrices[band][order1][order2][1] = val[1];
4149 this->eMatrices[band][order1][order2][0] /= normF;
4150 this->eMatrices[band][order1][order2][1] /= normF;
4165 this->so3Coeffs[position][0] = val[0];
4166 this->so3Coeffs[position][1] = val[1];
4183 this->wignerMatrices[band][order1][order2][0] = val[0];
4184 this->wignerMatrices[band][order1][order2][1] = val[1];
4201 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
4203 eMatsLMReal[iter] =
static_cast<double> ( this->eMatrices[band][order1][iter][0] );
4221 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
4223 eMatsLMImag[iter] =
static_cast<double> ( this->eMatrices[band][order1][iter][1] );
4239 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
4241 so3CoefsReal[iter] =
static_cast<double> ( this->so3Coeffs[iter][0] );
4257 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
4259 so3CoefsImag[iter] =
static_cast<double> ( this->so3Coeffs[iter][1] );
4279 return (
static_cast<int> ( so3CoefLoc (
static_cast< int > ( order1 ),
static_cast< int > ( order2 ),
static_cast< int > ( band ),
static_cast< int > ( this->getMaxBand() ) ) ) );
4290 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
4292 rotFunReal[iter] =
static_cast<double> ( this->so3CoeffsInverse[iter][0] );
4308 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
4310 rotFunImag[iter] =
static_cast<double> ( this->so3CoeffsInverse[iter][1] );
4326 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
4328 trsFunReal[iter] =
static_cast<double> ( this->translationMap[iter][0] );
4344 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
4346 trsFunImag[iter] =
static_cast<double> ( this->translationMap[iter][1] );
4365 proshade_double eA, eB, eG;
4369 proshade_double* rMat =
nullptr;
4370 rMat =
new proshade_double[9];
4377 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
4379 rotMat[iter] =
static_cast<double> ( rMat[iter] );
4420 return (
static_cast<proshade_unsign
> ( settings->
detectedSymmetry.size() ) );
4432 if (
static_cast<proshade_unsign
> ( settings->
detectedSymmetry.size() ) <= axisNo )
4435 return ( std::vector< std::string > ( ) );
4439 std::vector< std::string > ret;
4442 std::stringstream ssHlp;
4491 std::stringstream fNameHlp;
4493 this->writeMap ( fNameHlp.str() );
4500 this->writePdb ( fNameHlp.str(), eulA, eulB, eulG, ultimateTranslation->at(0), ultimateTranslation->at(1), ultimateTranslation->at(2), settings->
firstModelOnly );
4506 ultimateTranslation->at(0), ultimateTranslation->at(1), ultimateTranslation->at(2),
4528 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);
4532 proshade_double* rotMat =
new proshade_double[9];
4536 std::stringstream rotMatSS;
4537 rotMatSS << std::setprecision (3) << std::showpos <<
"The rotation matrix about origin is : " << rotMat[0] <<
" " << rotMat[1] <<
" " << rotMat[2] << std::endl;
4538 rotMatSS << std::setprecision (3) << std::showpos <<
" : " << rotMat[3] <<
" " << rotMat[4] <<
" " << rotMat[5] << std::endl;
4539 rotMatSS << std::setprecision (3) << std::showpos <<
" : " << rotMat[6] <<
" " << rotMat[7] <<
" " << rotMat[8];
4545 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);