ProSHADE  0.7.5.4 (MAR 2021)
Protein Shape Detection
ProSHADE_data.cpp
Go to the documentation of this file.
1 
24 //==================================================== ProSHADE
25 #include "ProSHADE_data.hpp"
26 
27 //==================================================== Gemmi PDB output - this cannot be with the rest of includes for some stb_sprintf library related reasons ...
28 #define GEMMI_WRITE_IMPLEMENTATION
29 #include <gemmi/to_pdb.hpp>
30 
40 {
41  //================================================ Initialise variables
42  // ... Variables regarding input file
43  this->fileName = "";
44  this->fileType = ProSHADE_internal_io::UNKNOWN;
45 
46  // ... Variables regarding map
47  this->internalMap = NULL;
48 
49  // ... Variables regarding map information
50  this->xDimSize = 0.0;
51  this->yDimSize = 0.0;
52  this->zDimSize = 0.0;
53  this->aAngle = 0.0;
54  this->bAngle = 0.0;
55  this->cAngle = 0.0;
56  this->xDimIndices = 0;
57  this->yDimIndices = 0;
58  this->zDimIndices = 0;
59  this->xGridIndices = 0;
60  this->yGridIndices = 0;
61  this->zGridIndices = 0;
62  this->xAxisOrder = 1;
63  this->yAxisOrder = 2;
64  this->zAxisOrder = 3;
65  this->xAxisOrigin = 0;
66  this->yAxisOrigin = 0;
67  this->zAxisOrigin = 0;
68  this->xCom = 0.0;
69  this->yCom = 0.0;
70  this->zCom = 0.0;
71 
72  // ... Variables regarding original input values (i.e. these do not change with ProSHADE manipulations)
73  this->xDimSizeOriginal = 0.0;
74  this->yDimSizeOriginal = 0.0;
75  this->zDimSizeOriginal = 0.0;
76  this->xDimIndicesOriginal = 0;
77  this->yDimIndicesOriginal = 0;
78  this->zDimIndicesOriginal = 0;
79  this->xAxisOriginOriginal = 0;
80  this->yAxisOriginOriginal = 0;
81  this->zAxisOriginOriginal = 0;
82  this->originalMapXCom = 0.0;
83  this->originalMapYCom = 0.0;
84  this->originalMapZCom = 0.0;
85  this->mapMovFromsChangeX = 0.0;
86  this->mapMovFromsChangeY = 0.0;
87  this->mapMovFromsChangeZ = 0.0;
88  this->mapCOMProcessChangeX = 0.0;
89  this->mapCOMProcessChangeY = 0.0;
90  this->mapCOMProcessChangeZ = 0.0;
91 
92  // ... Variables regarding rotation and translation of original input files
93  this->originalPdbRotCenX = 0.0;
94  this->originalPdbRotCenY = 0.0;
95  this->originalPdbRotCenZ = 0.0;
96  this->originalPdbTransX = 0.0;
97  this->originalPdbTransY = 0.0;
98  this->originalPdbTransZ = 0.0;
99 
100  // ... Variables regarding iterator positions
101  this->xFrom = 0;
102  this->yFrom = 0;
103  this->zFrom = 0;
104  this->xTo = 0;
105  this->yTo = 0;
106  this->zTo = 0;
107 
108  // ... Variables regarding SH mapping spheres
109  this->spherePos = std::vector<proshade_single> ( );
110  this->noSpheres = 0;
111  this->spheres = NULL;
112  this->sphericalHarmonics = NULL;
113  this->rotSphericalHarmonics = NULL;
114  this->maxShellBand = 0;
115 
116  // ... Variables regarding shape distance computations
117  this->rrpMatrices = NULL;
118  this->eMatrices = NULL;
119  this->so3Coeffs = NULL;
120  this->so3CoeffsInverse = NULL;
121  this->wignerMatrices = NULL;
122  this->integrationWeight = 0.0;
123  this->maxCompBand = 0;
124  this->translationMap = NULL;
125 
126 
127  // ... Control variables
128  this->isEmpty = true;
129 
130  //================================================ Done
131 
132 }
133 
160 ProSHADE_internal_data::ProSHADE_data::ProSHADE_data ( ProSHADE_settings* settings, 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 )
161 {
162  //================================================ Initialise variables
163  // ... Variables regarding input file
164  this->fileName = strName;
165  this->fileType = ProSHADE_internal_io::MAP;
166 
167  // ... Variables regarding map
168  this->internalMap = NULL;
169 
170  // ... Variables regarding map information
171  this->xDimSize = xDmSz;
172  this->yDimSize = yDmSz;
173  this->zDimSize = zDmSz;
174  this->aAngle = 90.0;
175  this->bAngle = 90.0;
176  this->cAngle = 90.0;
177  this->xDimIndices = xDmInd;
178  this->yDimIndices = yDmInd;
179  this->zDimIndices = zDmInd;
180  this->xGridIndices = xDmInd;
181  this->yGridIndices = yDmInd;
182  this->zGridIndices = zDmInd;
183  this->xAxisOrder = 1;
184  this->yAxisOrder = 2;
185  this->zAxisOrder = 3;
186  this->xAxisOrigin = xFr;
187  this->yAxisOrigin = yFr;
188  this->zAxisOrigin = zFr;
189  this->xCom = 0.0;
190  this->yCom = 0.0;
191  this->zCom = 0.0;
192 
193  // ... Variables regarding original input values (i.e. these do not change with ProSHADE manipulations)
194  this->xDimSizeOriginal = 0.0;
195  this->yDimSizeOriginal = 0.0;
196  this->zDimSizeOriginal = 0.0;
197  this->xDimIndicesOriginal = 0;
198  this->yDimIndicesOriginal = 0;
199  this->zDimIndicesOriginal = 0;
200  this->xAxisOriginOriginal = 0;
201  this->yAxisOriginOriginal = 0;
202  this->zAxisOriginOriginal = 0;
203  this->originalMapXCom = 0.0;
204  this->originalMapYCom = 0.0;
205  this->originalMapZCom = 0.0;
206  this->mapMovFromsChangeX = 0.0;
207  this->mapMovFromsChangeY = 0.0;
208  this->mapMovFromsChangeZ = 0.0;
209  this->mapCOMProcessChangeX = 0.0;
210  this->mapCOMProcessChangeY = 0.0;
211  this->mapCOMProcessChangeZ = 0.0;
212 
213  // ... Variables regarding rotation and translation of original input files
214  this->originalPdbRotCenX = 0.0;
215  this->originalPdbRotCenY = 0.0;
216  this->originalPdbRotCenZ = 0.0;
217  this->originalPdbTransX = 0.0;
218  this->originalPdbTransY = 0.0;
219  this->originalPdbTransZ = 0.0;
220 
221  // ... Variables regarding iterator positions
222  this->xFrom = xFr;
223  this->yFrom = yFr;
224  this->zFrom = zFr;
225  this->xTo = xT;
226  this->yTo = yT;
227  this->zTo = zT;
228 
229  // ... Variables regarding SH mapping spheres
230  this->spherePos = std::vector<proshade_single> ( );
231  this->noSpheres = 0;
232  this->spheres = NULL;
233  this->sphericalHarmonics = NULL;
234  this->rotSphericalHarmonics = NULL;
235  this->maxShellBand = 0;
236 
237  // ... Variables regarding shape distance computations
238  this->rrpMatrices = NULL;
239  this->eMatrices = NULL;
240  this->so3Coeffs = NULL;
241  this->so3CoeffsInverse = NULL;
242  this->wignerMatrices = NULL;
243  this->integrationWeight = 0.0;
244  this->maxCompBand = 0;
245  this->translationMap = NULL;
246 
247  // ... Control variables
248  this->isEmpty = false;
249  this->inputOrder = inputO;
250 
251  //================================================ Sanity checks
252  if ( static_cast<proshade_unsign> ( len ) != ( xDmInd * yDmInd * zDmInd ) )
253  {
254  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." );
255  }
256 
257  if ( ( static_cast<proshade_signed> ( xT - xFr ) != static_cast<proshade_signed> ( xDmInd - 1 ) ) ||
258  ( static_cast<proshade_signed> ( yT - yFr ) != static_cast<proshade_signed> ( yDmInd - 1 ) ) ||
259  ( static_cast<proshade_signed> ( zT - zFr ) != static_cast<proshade_signed> ( zDmInd - 1 ) ) )
260  {
261  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." );
262  }
263 
264  //================================================ Allocate the map memory
265  this->internalMap = new proshade_double [this->xDimIndices * this->yDimIndices * this->zDimIndices];
266  ProSHADE_internal_misc::checkMemoryAllocation ( this->internalMap, __FILE__, __LINE__, __func__ );
267 
268  //================================================ Copy the values into the map
269  proshade_unsign arrPos = 0;
270  for ( proshade_unsign xIt = 0; xIt < this->xDimIndices; xIt++ )
271  {
272  for ( proshade_unsign yIt = 0; yIt < this->yDimIndices; yIt++ )
273  {
274  for ( proshade_unsign zIt = 0; zIt < this->zDimIndices; zIt++ )
275  {
276  arrPos = zIt + this->zDimIndices * ( yIt + this->yDimIndices * xIt );
277  this->internalMap[arrPos] = static_cast<proshade_double> ( mapVals[arrPos] );
278  }
279  }
280  }
281 
282  //================================================ Release memory (it was allocated by the PyBind11 lambda function and needs to be released)
283  delete[] mapVals;
284 
285  //================================================ Done
286 
287 }
288 
296 {
297  //================================================ Release the internal map
298  if ( this->internalMap != NULL )
299  {
300  delete[] this->internalMap;
301  }
302 
303  //================================================ Release the sphere mapping
304  if ( this->spheres != NULL )
305  {
306  for ( proshade_unsign iter = 0; iter < this->noSpheres; iter++ )
307  {
308  if ( this->spheres[iter] != NULL )
309  {
310  delete this->spheres[iter];
311  this->spheres[iter] = NULL;
312  }
313  }
314  delete[] this->spheres;
315  }
316 
317  //================================================ Release the spherical harmonics
318  if ( this->sphericalHarmonics != NULL )
319  {
320  for ( proshade_unsign iter = 0; iter < this->noSpheres; iter++ )
321  {
322  if ( this->sphericalHarmonics[iter] != NULL )
323  {
324  delete[] this->sphericalHarmonics[iter];
325  this->sphericalHarmonics[iter] = NULL;
326  }
327  }
328  delete[] this->sphericalHarmonics;
329  }
330 
331  //================================================ Release the rotated spherical harmonics
332  if ( this->rotSphericalHarmonics != NULL )
333  {
334  for ( proshade_unsign iter = 0; iter < this->noSpheres; iter++ )
335  {
336  if ( this->rotSphericalHarmonics[iter] != NULL )
337  {
338  delete[] this->rotSphericalHarmonics[iter];
339  this->rotSphericalHarmonics[iter] = NULL;
340  }
341  }
342  delete[] this->rotSphericalHarmonics;
343  }
344 
345  //================================================ Release the RRP matrices (pre-computation for the energy levels descriptor)
346  if ( this->rrpMatrices != NULL )
347  {
348  for ( proshade_unsign bwIt = 0; bwIt < this->maxShellBand; bwIt++ )
349  {
350  if ( this->rrpMatrices[bwIt] != NULL )
351  {
352  for ( proshade_unsign shIt = 0; shIt < this->noSpheres; shIt++ )
353  {
354  if ( this->rrpMatrices[bwIt][shIt] != NULL )
355  {
356  delete[] this->rrpMatrices[bwIt][shIt];
357  }
358  }
359 
360  delete[] this->rrpMatrices[bwIt];
361  }
362  }
363 
364  delete[] this->rrpMatrices;
365  }
366 
367  //================================================ Release the E matrices
368  if ( this->eMatrices != NULL )
369  {
370  for ( proshade_unsign bandIter = 0; bandIter < this->maxCompBand; bandIter++ )
371  {
372  if ( this->eMatrices[bandIter] != NULL )
373  {
374  for ( proshade_unsign band2Iter = 0; band2Iter < static_cast<proshade_unsign> ( ( bandIter * 2 ) + 1 ); band2Iter++ )
375  {
376  if ( this->eMatrices[bandIter][band2Iter] != NULL )
377  {
378  delete[] this->eMatrices[bandIter][band2Iter];
379  }
380  }
381 
382  delete[] this->eMatrices[bandIter];
383  }
384  }
385 
386  delete[] this->eMatrices;
387  }
388 
389  //================================================ Release SOFT and inverse SOFT coefficients
390  if ( this->so3Coeffs != NULL )
391  {
392  delete[] this->so3Coeffs;
393  }
394  if ( this->so3CoeffsInverse != NULL )
395  {
396  delete[] this->so3CoeffsInverse;
397  }
398 
399  //================================================ Release Wigner matrices
400  if ( this->wignerMatrices != NULL )
401  {
402  for ( proshade_unsign bandIter = 1; bandIter < this->maxCompBand; bandIter++ )
403  {
404  if ( this->wignerMatrices[bandIter] != NULL )
405  {
406  for ( proshade_unsign order1Iter = 0; order1Iter < ( (bandIter * 2) + 1 ); order1Iter++ )
407  {
408  if ( this->wignerMatrices[bandIter][order1Iter] != NULL )
409  {
410  delete[] this->wignerMatrices[bandIter][order1Iter];
411  }
412  }
413  delete[] this->wignerMatrices[bandIter];
414  }
415  }
416  delete[] wignerMatrices;
417  }
418 
419  //================================================ Release translation map
420  if ( this->translationMap != NULL )
421  {
422  delete[] this->translationMap;
423  }
424 
425  //================================================ Release the angle-axis space rotation function
426  if ( this->sphereMappedRotFun.size() > 0 )
427  {
428  for ( proshade_unsign spIt = 0; spIt < static_cast<proshade_unsign> ( this->sphereMappedRotFun.size() ); spIt++ )
429  {
430  delete this->sphereMappedRotFun.at(spIt);
431  }
432  }
433 
434  //================================================ Done
435 
436 }
437 
447 void ProSHADE_internal_data::ProSHADE_data::readInStructure ( std::string fName, proshade_unsign inputO, ProSHADE_settings* settings )
448 {
449  //================================================ Report function start
450  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Starting to read the structure: " + fName );
451 
452  //================================================ Check if instance is empty
453  if ( !this->isEmpty )
454  {
455  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 );
456  }
457 
458  //================================================ Save the filename
459  this->fileName = fName;
460 
461  //================================================ Check what is the input format
462  this->fileType = ProSHADE_internal_io::figureDataType ( this->fileName );
463 
464  //================================================ Save input order
465  this->inputOrder = inputO;
466 
467  //================================================ Decide how to proceed
468  switch ( this->fileType )
469  {
470  case ProSHADE_internal_io::UNKNOWN:
471  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." );
472  break;
473 
474  case ProSHADE_internal_io::PDB:
475  this->readInPDB ( settings );
476  break;
477 
478  case ProSHADE_internal_io::MAP:
479  this->readInMAP ( settings );
480  break;
481  }
482 
483  //================================================ This structure is now full
484  this->isEmpty = false;
485 
486  //================================================ Report function completion
487  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 2, "Structure read in successfully." );
488 
489  //================================================ Done
490  return ;
491 
492 }
493 
502 {
503  //================================================ Open the file
504  gemmi::Ccp4<float> map;
505  map.read_ccp4 ( gemmi::MaybeGzipped ( this->fileName.c_str() ) );
506 
507  //================================================ Convert to XYZ and create complete map, if need be
508  map.setup ( gemmi::GridSetup::ReorderOnly, NAN );
509 
510  //================================================ Read in the rest of the map file header
512  &this->xDimIndices, &this->yDimIndices, &this->zDimIndices,
513  &this->xDimSize, &this->yDimSize, &this->zDimSize,
514  &this->aAngle, &this->bAngle, &this->cAngle,
515  &this->xFrom, &this->yFrom, &this->zFrom,
516  &this->xAxisOrigin, &this->yAxisOrigin, &this->zAxisOrigin,
517  &this->xAxisOrder, &this->yAxisOrder, &this->zAxisOrder,
518  &this->xGridIndices, &this->yGridIndices, &this->zGridIndices );
519 
520  //================================================ Save the map density to ProSHADE variable
521  ProSHADE_internal_io::readInMapData ( &map, this->internalMap, this->xDimIndices, this->yDimIndices, this->zDimIndices, this->xAxisOrder, this->yAxisOrder, this->zAxisOrder );
522 
523  //================================================ Set resolution if need be
524  if ( settings->requestedResolution < 0.0 )
525  {
526  settings->setResolution ( std::min ( static_cast<proshade_double> ( this->xDimSize ) / static_cast<proshade_double> ( this->xDimIndices ),
527  std::min ( static_cast<proshade_double> ( this->yDimSize ) / static_cast<proshade_double> ( this->yDimIndices ),
528  static_cast<proshade_double> ( this->zDimSize ) / static_cast<proshade_double> ( this->zDimIndices ) ) ) * 2.0 );
529  }
530 
531  //================================================ Set iterators from and to
532  this->figureIndexStartStop ( );
533 
534  //================================================ If specific resolution is requested, make sure the map has it
535  if ( settings->changeMapResolution || settings->changeMapResolutionTriLinear )
536  {
537  //============================================ Find COM pre map re-sampling
538  proshade_double xMapCOMPreReSampl = 0.0, yMapCOMPreReSampl = 0.0, zMapCOMPreReSampl = 0.0;
539  ProSHADE_internal_mapManip::findMAPCOMValues ( this->internalMap, &xMapCOMPreReSampl, &yMapCOMPreReSampl, &zMapCOMPreReSampl,
540  this->xDimSize, this->yDimSize, this->zDimSize,
541  this->xFrom, this->xTo, this->yFrom, this->yTo, this->zFrom, this->zTo );
542 
543  //============================================ Get real world start position pre-sampling
544  proshade_double xOrPre = this->xFrom * ( this->xDimSize / static_cast<proshade_double> ( this->xDimIndices ) );
545  proshade_double yOrPre = this->yFrom * ( this->yDimSize / static_cast<proshade_double> ( this->yDimIndices ) );
546  proshade_double zOrPre = this->zFrom * ( this->zDimSize / static_cast<proshade_double> ( this->zDimIndices ) );
547 
548  //============================================ Re-sample map
549  this->reSampleMap ( settings );
550 
551  //============================================ Find COM post map re-sampling
552  proshade_double xMapCOMPostReSampl = 0.0, yMapCOMPostReSampl = 0.0, zMapCOMPostReSampl = 0.0;
553  ProSHADE_internal_mapManip::findMAPCOMValues ( this->internalMap, &xMapCOMPostReSampl, &yMapCOMPostReSampl, &zMapCOMPostReSampl,
554  this->xDimSize, this->yDimSize, this->zDimSize,
555  this->xFrom, this->xTo, this->yFrom, this->yTo, this->zFrom, this->zTo );
556 
557  //============================================ Get real world start position post sampling
558  proshade_double xOrPst = this->xFrom * ( this->xDimSize / static_cast<proshade_double> ( this->xDimIndices ) );
559  proshade_double yOrPst = this->yFrom * ( this->yDimSize / static_cast<proshade_double> ( this->yDimIndices ) );
560  proshade_double zOrPst = this->zFrom * ( this->zDimSize / static_cast<proshade_double> ( this->zDimIndices ) );
561 
562  //============================================ Final translation
563  proshade_double xFinMov = ( xMapCOMPreReSampl - xMapCOMPostReSampl ) - ( xOrPre - xOrPst );
564  proshade_double yFinMov = ( yMapCOMPreReSampl - yMapCOMPostReSampl ) - ( yOrPre - yOrPst );
565  proshade_double zFinMov = ( zMapCOMPreReSampl - zMapCOMPostReSampl ) - ( zOrPre - zOrPst );
566 
567  //============================================ Remove any sampling induced shift
568  ProSHADE_internal_mapManip::moveMapByFourier ( this->internalMap, xFinMov, yFinMov, zFinMov,
569  this->xDimSize, this->yDimSize, this->zDimSize,
570  this->xDimIndices, this->yDimIndices, this->zDimIndices );
571  }
572 
573  //================================================ Save the original sizes
574  this->xDimSizeOriginal = this->xDimSize;
575  this->yDimSizeOriginal = this->yDimSize;
576  this->zDimSizeOriginal = this->zDimSize;
577 
578  //================================================ Save the original index counts
579  this->xDimIndicesOriginal = this->xDimIndices;
580  this->yDimIndicesOriginal = this->yDimIndices;
581  this->zDimIndicesOriginal = this->zDimIndices;
582 
583  //================================================ Save the original axis origins
584  this->xAxisOriginOriginal = this->xAxisOrigin;
585  this->yAxisOriginOriginal = this->yAxisOrigin;
586  this->zAxisOriginOriginal = this->zAxisOrigin;
587 
588  //================================================ Compute and save the COM
589  this->findMapCOM ( );
590  this->originalMapXCom = this->xCom;
591  this->originalMapYCom = this->yCom;
592  this->originalMapZCom = this->zCom;
593 
594  //================================================ Done
595 
596 }
597 
608 {
609  //================================================ Set resolution if need be
610  if ( settings->requestedResolution < 0.0 )
611  {
612  settings->setResolution ( 8.0 );
613  }
614 
615  //================================================ Open PDB file for reading
616  gemmi::Structure pdbFile = gemmi::read_structure ( gemmi::MaybeGzipped ( this->fileName ) );
617 
618  //================================================ Change B-factors if need be
619  if ( settings->pdbBFactorNewVal >= 0.0 )
620  {
622  }
623 
624  //================================================ Remove waters if required
625  if ( settings->removeWaters )
626  {
628  }
629 
630  //================================================ Get PDB COM values
631  proshade_double xCOMPdb, yCOMPdb, zCOMPdb;
632  ProSHADE_internal_mapManip::findPDBCOMValues ( pdbFile, &xCOMPdb, &yCOMPdb, &zCOMPdb, settings->firstModelOnly );
633 
634  //================================================ Find the ranges
635  proshade_single xF, xT, yF, yT, zF, zT;
636  ProSHADE_internal_mapManip::determinePDBRanges ( pdbFile, &xF, &xT, &yF, &yT, &zF, &zT, settings->firstModelOnly );
637 
638  //================================================ Move ranges to have all FROM values 20
639  proshade_single xMov = 20.0 - xF;
640  proshade_single yMov = 20.0 - yF;
641  proshade_single zMov = 20.0 - zF;
642  ProSHADE_internal_mapManip::movePDBForMapCalc ( &pdbFile, xMov, yMov, zMov, settings->firstModelOnly );
643 
644  //================================================ Set the angstrom sizes
645  this->xDimSize = xT - xF + 40.0;
646  this->yDimSize = yT - yF + 40.0;
647  this->zDimSize = zT - zF + 40.0;
648 
649  //================================================ Generate map from nicely placed atoms (cell size will be range + 40)
650  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 );
651 
652  //================================================ Set the internal variables to correct values
653  this->setPDBMapValues ( );
654 
655  //================================================ Compute reverse movement based on COMs. If there is more than 1 models, simply moving back the xyzMov is not enough.
656  proshade_double xCOMMap, yCOMMap, zCOMMap;
657  ProSHADE_internal_mapManip::findMAPCOMValues ( this->internalMap, &xCOMMap, &yCOMMap, &zCOMMap,
658  this->xDimSize, this->yDimSize, this->zDimSize,
659  this->xFrom, this->xTo, this->yFrom, this->yTo, this->zFrom, this->zTo );
660 
661  if ( pdbFile.models.size() > 1 )
662  {
663  xMov = xCOMMap - xCOMPdb;
664  yMov = yCOMMap - yCOMPdb;
665  zMov = zCOMMap - zCOMPdb;
666  }
667 
668  //================================================ Move map back to the original PDB location
669  ProSHADE_internal_mapManip::moveMapByIndices ( &xMov, &yMov, &zMov, this->xDimSize, this->yDimSize, this->zDimSize,
670  &this->xFrom, &this->xTo, &this->yFrom, &this->yTo, &this->zFrom, &this->zTo,
671  &this->xAxisOrigin, &this->yAxisOrigin, &this->zAxisOrigin );
672  ProSHADE_internal_mapManip::moveMapByFourier ( this->internalMap, xMov, yMov, zMov, this->xDimSize, this->yDimSize, this->zDimSize,
673  this->xDimIndices, this->yDimIndices, this->zDimIndices );
674 
675  //================================================ If specific resolution is requested, make sure the map has it
676  if ( settings->changeMapResolution || settings->changeMapResolutionTriLinear )
677  {
678  //============================================ Find COM pre map re-sampling
679  proshade_double xMapCOMPreReSampl = 0.0, yMapCOMPreReSampl = 0.0, zMapCOMPreReSampl = 0.0;
680  ProSHADE_internal_mapManip::findMAPCOMValues ( this->internalMap, &xMapCOMPreReSampl, &yMapCOMPreReSampl, &zMapCOMPreReSampl,
681  this->xDimSize, this->yDimSize, this->zDimSize,
682  this->xFrom, this->xTo, this->yFrom, this->yTo, this->zFrom, this->zTo );
683 
684  //============================================ Get real world start position pre-sampling
685  proshade_double xOrPre = this->xFrom * ( this->xDimSize / static_cast<proshade_double> ( this->xDimIndices ) );
686  proshade_double yOrPre = this->yFrom * ( this->yDimSize / static_cast<proshade_double> ( this->yDimIndices ) );
687  proshade_double zOrPre = this->zFrom * ( this->zDimSize / static_cast<proshade_double> ( this->zDimIndices ) );
688 
689  //============================================ Re-sample map
690  this->reSampleMap ( settings );
691 
692  //============================================ Find COM post map re-sampling
693  proshade_double xMapCOMPostReSampl = 0.0, yMapCOMPostReSampl = 0.0, zMapCOMPostReSampl = 0.0;
694  ProSHADE_internal_mapManip::findMAPCOMValues ( this->internalMap, &xMapCOMPostReSampl, &yMapCOMPostReSampl, &zMapCOMPostReSampl,
695  this->xDimSize, this->yDimSize, this->zDimSize,
696  this->xFrom, this->xTo, this->yFrom, this->yTo, this->zFrom, this->zTo );
697 
698  //============================================ Get real world start position post sampling
699  proshade_double xOrPst = this->xFrom * ( this->xDimSize / static_cast<proshade_double> ( this->xDimIndices ) );
700  proshade_double yOrPst = this->yFrom * ( this->yDimSize / static_cast<proshade_double> ( this->yDimIndices ) );
701  proshade_double zOrPst = this->zFrom * ( this->zDimSize / static_cast<proshade_double> ( this->zDimIndices ) );
702 
703  //============================================ Final translation
704  proshade_double xFinMov = ( xMapCOMPreReSampl - xMapCOMPostReSampl ) - ( xOrPre - xOrPst );
705  proshade_double yFinMov = ( yMapCOMPreReSampl - yMapCOMPostReSampl ) - ( yOrPre - yOrPst );
706  proshade_double zFinMov = ( zMapCOMPreReSampl - zMapCOMPostReSampl ) - ( zOrPre - zOrPst );
707 
708  //============================================ Remove any sampling induced shift
709  ProSHADE_internal_mapManip::moveMapByFourier ( this->internalMap, xFinMov, yFinMov, zFinMov,
710  this->xDimSize, this->yDimSize, this->zDimSize,
711  this->xDimIndices, this->yDimIndices, this->zDimIndices );
712  }
713 
714  //================================================ Save the original sizes
715  this->xDimSizeOriginal = this->xDimSize;
716  this->yDimSizeOriginal = this->yDimSize;
717  this->zDimSizeOriginal = this->zDimSize;
718 
719  //================================================ Save the original index counts
720  this->xDimIndicesOriginal = this->xDimIndices;
721  this->yDimIndicesOriginal = this->yDimIndices;
722  this->zDimIndicesOriginal = this->zDimIndices;
723 
724  //================================================ Save the original axis origins
725  this->xAxisOriginOriginal = this->xAxisOrigin;
726  this->yAxisOriginOriginal = this->yAxisOrigin;
727  this->zAxisOriginOriginal = this->zAxisOrigin;
728 
729  //================================================ Compute and save the COM
730  this->findMapCOM ( );
731  this->originalMapXCom = this->xCom;
732  this->originalMapYCom = this->yCom;
733  this->originalMapZCom = this->zCom;
734 
735  //================================================ Done
736  return;
737 
738 }
739 
745 {
746  //================================================ Set starts to 0
747  this->xFrom = 0;
748  this->yFrom = 0;
749  this->zFrom = 0;
750 
751  //================================================ Set angles to 90 degrees
752  this->aAngle = 90.0;
753  this->bAngle = 90.0;
754  this->cAngle = 90.0;
755 
756  //================================================ Set dimension sizes in indices
757  this->xDimIndices = this->xTo;
758  this->yDimIndices = this->yTo;
759  this->zDimIndices = this->zTo;
760 
761  //================================================ Set grid indexing to cell indexing
762  this->xGridIndices = this->xDimIndices;
763  this->yGridIndices = this->yDimIndices;
764  this->zGridIndices = this->zDimIndices;
765 
766  //================================================ Set axis order
767  this->xAxisOrder = 1;
768  this->yAxisOrder = 2;
769  this->zAxisOrder = 3;
770 
771  //================================================ Set origin to the first index
772  this->xAxisOrigin = this->xFrom;
773  this->yAxisOrigin = this->yFrom;
774  this->zAxisOrigin = this->zFrom;
775 
776  //================================================ Done
777  return ;
778 
779 }
780 
786 {
787  //================================================ Set ends to origin + size - 1
788  this->xTo = this->xFrom + this->xDimIndices - 1;
789  this->yTo = this->yFrom + this->yDimIndices - 1;
790  this->zTo = this->zFrom + this->zDimIndices - 1;
791 
792  //================================================ Done
793  return ;
794 
795 }
796 
807 void ProSHADE_internal_data::ProSHADE_data::writeMap ( std::string fName, std::string title, int mode )
808 {
809  //================================================ Create and prepare new Grid gemmi object
810  gemmi::Grid<float> mapData;
811  mapData.set_unit_cell ( this->xDimSize, this->yDimSize, this->zDimSize, this->aAngle, this->bAngle, this->cAngle );
812  mapData.set_size_without_checking ( this->xDimIndices, this->yDimIndices, this->zDimIndices );
813  mapData.axis_order = gemmi::AxisOrder::XYZ;
814  mapData.spacegroup = &gemmi::get_spacegroup_p1();
815 
816  //================================================ Create and prepare new Ccp4 gemmi object
817  gemmi::Ccp4<float> map;
818  map.grid = mapData;
819  map.update_ccp4_header ( mode );
820 
821  //================================================ Fill in the header
823  this->xDimIndices, this->yDimIndices, this->zDimIndices,
824  this->xDimSize, this->yDimSize, this->zDimSize,
825  this->aAngle, this->bAngle, this->cAngle,
826  this->xFrom, this->yFrom, this->zFrom,
827  this->xAxisOrigin, this->yAxisOrigin, this->zAxisOrigin,
828  this->xAxisOrder, this->yAxisOrder, this->zAxisOrder,
829  this->xGridIndices, this->yGridIndices, this->zGridIndices,
830  title, mode );
831 
832  //================================================ Copy internal map to grid
833  proshade_unsign arrPos = 0;
834  for ( proshade_unsign uIt = 0; uIt < this->xDimIndices; uIt++ )
835  {
836  for ( proshade_unsign vIt = 0; vIt < this->yDimIndices; vIt++ )
837  {
838  for ( proshade_unsign wIt = 0; wIt < this->zDimIndices; wIt++ )
839  {
840  arrPos = wIt + this->zDimIndices * ( vIt + this->yDimIndices * uIt );
841  map.grid.set_value ( uIt, vIt, wIt, static_cast<float> ( this->internalMap[arrPos] ) );
842  }
843  }
844  }
845 
846  //================================================ Update the statistics in the header
847  map.update_ccp4_header ( mode, true );
848 
849  //================================================ Write out the map
850  map.write_ccp4_map ( fName );
851 
852  //================================================ Done
853  return ;
854 
855 }
856 
872 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, bool firstModel )
873 {
874  //================================================ Check for co-ordinate origin
875  if ( !ProSHADE_internal_io::isFilePDB ( this->fileName ) )
876  {
877  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." );
878  }
879 
880  //================================================ Open PDB file for reading
881  gemmi::Structure pdbFile = gemmi::read_structure ( gemmi::MaybeGzipped ( this->fileName ) );
882 
883  //================================================ If the map was rotated, do the same for the co-ordinates, making sure we take into account the rotation centre of the map
884  if ( ( euA != 0.0 ) || ( euB != 0.0 ) || ( euG != 0.0 ) )
885  {
886  //============================================ Rotate the co-ordinates
887  ProSHADE_internal_mapManip::rotatePDBCoordinates ( &pdbFile, euA, euB, euG, this->originalPdbRotCenX, this->originalPdbRotCenY, this->originalPdbRotCenZ, firstModel );
888  }
889 
890  //================================================ Translate by required translation and the map centering (if applied)
891  ProSHADE_internal_mapManip::translatePDBCoordinates ( &pdbFile, trsX, trsY, trsZ, firstModel );
892 
893  //================================================ Write the PDB file
894  std::ofstream outCoOrdFile;
895  outCoOrdFile.open ( fName.c_str() );
896 
897  if ( outCoOrdFile.is_open() )
898  {
899  gemmi::PdbWriteOptions opt;
900  write_pdb ( pdbFile, outCoOrdFile, opt );
901  }
902  else
903  {
904  std::stringstream hlpMessage;
905  hlpMessage << "Failed to open the PDB file " << fName << " for output.";
906  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." );
907  }
908 
909  outCoOrdFile.close ( );
910 
911  //================================================ Done
912  return ;
913 }
914 
923 void ProSHADE_internal_data::ProSHADE_data::writeMask ( std::string fName, proshade_double* mask )
924 {
925  //================================================ Allocate the memory
926  proshade_double* hlpMap = new proshade_double[this->xDimIndices * this->yDimIndices * this->zDimIndices];
927  ProSHADE_internal_misc::checkMemoryAllocation ( hlpMap, __FILE__, __LINE__, __func__ );
928 
929  //================================================ Copy original map and over-write with the mask
930  for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
931  {
932  hlpMap[iter] = this->internalMap[iter];
933  this->internalMap[iter] = mask[iter];
934  }
935 
936  //================================================ Write out the mask
937  this->writeMap ( fName );
938 
939  //================================================ Copy the original map values back
940  for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
941  {
942  this->internalMap[iter] = hlpMap[iter];
943  }
944 
945  //================================================ Release memory
946  delete[] hlpMap;
947 
948  //================================================ Done
949  return ;
950 }
951 
961 {
962  //================================================ Report function start
963  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Map inversion." );
964 
965  //================================================ Initialise variables
966  proshade_signed arrayPos, invPos;
967 
968  //================================================ Create helper map
969  proshade_double* hlpMap = new proshade_double [this->xDimIndices * this->yDimIndices * this->zDimIndices];
970  ProSHADE_internal_misc::checkMemoryAllocation ( hlpMap, __FILE__, __LINE__, __func__ );
971 
972  //================================================ Save map values to the helper map
973  for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
974  {
975  hlpMap[iter] = this->internalMap[iter];
976  }
977 
978  //================================================ Invert the values
979  for ( proshade_signed xIt = 0; xIt < static_cast<proshade_signed> ( this->xDimIndices ); xIt++ )
980  {
981  for ( proshade_signed yIt = 0; yIt < static_cast<proshade_signed> ( this->yDimIndices ); yIt++ )
982  {
983  for ( proshade_signed zIt = 0; zIt < static_cast<proshade_signed> ( this->zDimIndices ); zIt++ )
984  {
985  //==================================== Var init
986  arrayPos = zIt + this->zDimIndices * ( yIt + this->yDimIndices * xIt );
987  invPos = ( (this->zDimIndices-1) - zIt ) + this->zDimIndices * ( ( (this->yDimIndices-1) - yIt ) + this->yDimIndices * ( (this->xDimIndices-1) - xIt ) );
988 
989  //==================================== And save
990  this->internalMap[invPos] = hlpMap[arrayPos];
991  }
992  }
993  }
994 
995  //================================================ Release memory
996  delete[] hlpMap;
997 
998  //================================================ Report function completion
999  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 2, "Map inversion completed." );
1000 
1001  //================================================ Done
1002  return ;
1003 
1004 }
1005 
1015 {
1016  //================================================ Report function start
1017  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Map normalisation." );
1018 
1019  //================================================ Initialise vector of map values
1020  std::vector<proshade_double> mapVals ( this->xDimIndices * this->yDimIndices * this->zDimIndices, 0.0 );
1021 
1022  //================================================ Get all map values
1023  for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
1024  {
1025  mapVals.at(iter) = this->internalMap[iter];
1026  }
1027 
1028  //================================================ Get mean and sd
1029  proshade_double* meanSD = new proshade_double[2];
1030  ProSHADE_internal_maths::vectorMeanAndSD ( &mapVals, meanSD );
1031 
1032  //================================================ Normalise the values
1033  for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
1034  {
1035  this->internalMap[iter] = ( this->internalMap[iter] - meanSD[0] ) / meanSD[1];
1036  }
1037 
1038  //================================================ Clear the vector
1039  mapVals.clear ( );
1040 
1041  //================================================ Release memory
1042  delete[] meanSD;
1043 
1044  //================================================ Report function completion
1045  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 2, "Map normalisation completed." );
1046 
1047  //================================================ Done
1048  return ;
1049 
1050 }
1051 
1052 
1062 {
1063  //================================================ Report function start
1064  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Computing mask." );
1065 
1066  //================================================ Initialise the blurred map
1067  proshade_double* blurredMap = new proshade_double[this->xDimIndices * this->yDimIndices * this->zDimIndices];
1068  ProSHADE_internal_misc::checkMemoryAllocation ( blurredMap, __FILE__, __LINE__, __func__ );
1069 
1070  //================================================ Compute blurred map
1071  ProSHADE_internal_mapManip::blurSharpenMap ( this->internalMap, blurredMap, this->xDimIndices, this->yDimIndices, this->zDimIndices,
1072  this->xDimSize, this->yDimSize, this->zDimSize, settings->blurFactor );
1073 
1074  //================================================ Compute mask from blurred map and save it into the original map
1075  ProSHADE_internal_mapManip::getMaskFromBlurr ( blurredMap, this->internalMap, this->xDimIndices, this->yDimIndices, this->zDimIndices, settings->maskingThresholdIQRs );
1076 
1077  //================================================ Print the mask if need be
1078  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 ); } }
1079 
1080  //================================================ Release memory
1081  delete[] blurredMap;
1082 
1083  //================================================ Report function completion
1084  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 2, "Mask computed." );
1085 
1086  //================================================ Done
1087  return ;
1088 
1089 }
1090 
1102 {
1103  //================================================ Report function start
1104  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Finding new boundaries." );
1105 
1106  //================================================ If same bounds as first one are required, test if possible and return these instead
1107  if ( settings->useSameBounds && ( this->inputOrder != 0 ) )
1108  {
1109  for ( proshade_unsign iter = 0; iter < 6; iter++ ) { ret[iter] = settings->forceBounds[iter]; }
1110  }
1111  //================================================ In this case, bounds need to be found de novo
1112  else
1113  {
1114  //============================================ Find the non-zero bounds
1115  ProSHADE_internal_mapManip::getNonZeroBounds ( this->internalMap, this->xDimIndices, this->yDimIndices, this->zDimIndices,
1116  this->xDimSize, this->yDimSize, this->zDimSize, ret );
1117 
1118  //============================================ Add the extra space
1119  ProSHADE_internal_mapManip::addExtraBoundSpace ( this->xDimIndices, this->yDimIndices, this->zDimIndices,
1120  this->xDimSize, this->yDimSize, this->zDimSize, ret, settings->boundsExtraSpace );
1121 
1122  //============================================ Beautify boundaries
1123  ProSHADE_internal_mapManip::beautifyBoundaries ( ret, this->xDimIndices, this->yDimIndices, this->zDimIndices, settings->boundsSimilarityThreshold, settings->verbose );
1124 
1125  //============================================ Report function results
1126  std::stringstream ssHlp;
1127  ssHlp << "New boundaries are: " << ret[1] - ret[0] + 1 << " x " << ret[3] - ret[2] + 1 << " x " << ret[5] - ret[4] + 1;
1128  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 3, ssHlp.str() );
1129 
1130  //============================================ If need be, save boundaries to be used for all other structure
1131  if ( settings->useSameBounds && ( this->inputOrder == 0 ) )
1132  {
1133  for ( proshade_unsign iter = 0; iter < 6; iter++ ) { settings->forceBounds[iter] = ret[iter]; }
1134  }
1135  }
1136 
1137  //================================================ Report function completion
1138  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 2, "New boundaries determined." );
1139 
1140  //================================================ Done
1141  return ;
1142 
1143 }
1144 
1157 {
1158  //================================================ Report function start
1159  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Creating new structure according to the new bounds." );
1160 
1161  //================================================ Fill in basic info
1162  newStr->fileName = "N/A";
1163  newStr->fileType = ProSHADE_internal_io::MAP;
1164 
1165  //================================================ Fill in new structure values
1166  newStr->xDimIndices = static_cast<proshade_signed> ( newBounds[1] ) - static_cast<proshade_signed> ( newBounds[0] ) + 1;
1167  newStr->yDimIndices = static_cast<proshade_signed> ( newBounds[3] ) - static_cast<proshade_signed> ( newBounds[2] ) + 1;
1168  newStr->zDimIndices = static_cast<proshade_signed> ( newBounds[5] ) - static_cast<proshade_signed> ( newBounds[4] ) + 1;
1169 
1170  newStr->aAngle = this->aAngle;
1171  newStr->bAngle = this->aAngle;
1172  newStr->cAngle = this->aAngle;
1173 
1174  newStr->xDimSize = static_cast<proshade_single> ( newStr->xDimIndices ) * ( this->xDimSize / static_cast<proshade_single> ( this->xDimIndices ) );
1175  newStr->yDimSize = static_cast<proshade_single> ( newStr->yDimIndices ) * ( this->yDimSize / static_cast<proshade_single> ( this->yDimIndices ) );
1176  newStr->zDimSize = static_cast<proshade_single> ( newStr->zDimIndices ) * ( this->zDimSize / static_cast<proshade_single> ( this->zDimIndices ) );
1177 
1178  newStr->xGridIndices = newStr->xDimIndices;
1179  newStr->yGridIndices = newStr->yDimIndices;
1180  newStr->zGridIndices = newStr->zDimIndices;
1181 
1182  newStr->xAxisOrder = this->xAxisOrder;
1183  newStr->yAxisOrder = this->yAxisOrder;
1184  newStr->zAxisOrder = this->zAxisOrder;
1185 
1186  newStr->xAxisOrigin = this->xAxisOrigin + newBounds[0];
1187  newStr->yAxisOrigin = this->yAxisOrigin + newBounds[2];
1188  newStr->zAxisOrigin = this->zAxisOrigin + newBounds[4];
1189 
1190  newStr->xFrom = this->xFrom + newBounds[0];
1191  newStr->yFrom = this->yFrom + newBounds[2];
1192  newStr->zFrom = this->zFrom + newBounds[4];
1193 
1194  newStr->xTo = this->xTo - ( (this->xDimIndices-1) - newBounds[1] );
1195  newStr->yTo = this->yTo - ( (this->yDimIndices-1) - newBounds[3] );
1196  newStr->zTo = this->zTo - ( (this->zDimIndices-1) - newBounds[5] );
1197 
1198  //================================================ Allocate new structure map
1199  newStr->internalMap = new proshade_double[newStr->xDimIndices * newStr->yDimIndices * newStr->zDimIndices];
1200  ProSHADE_internal_misc::checkMemoryAllocation ( newStr->internalMap, __FILE__, __LINE__, __func__ );
1201 
1202  //================================================ Copy the map
1203  ProSHADE_internal_mapManip::copyMapByBounds ( newStr->xFrom, newStr->xTo, newStr->yFrom, newStr->yTo, newStr->zFrom, newStr->zTo,
1204  this->xFrom, this->yFrom, this->zFrom, newStr->yDimIndices, newStr->zDimIndices,
1205  this->xDimIndices, this->yDimIndices, this->zDimIndices, newStr->internalMap, this->internalMap );
1206 
1207  //================================================ Report function completion
1208  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 2, "New structure created." );
1209 
1210  //================================================ Done
1211  return ;
1212 
1213 }
1214 
1223 {
1224  //================================================ Initialise the return variable
1225  proshade_single* changeVals = new proshade_single[6];
1226 
1227  //================================================ Now re-sample the map
1228  if ( settings->changeMapResolution )
1229  {
1230  ProSHADE_internal_mapManip::reSampleMapToResolutionFourier ( this->internalMap, settings->requestedResolution, this->xDimIndices, this->yDimIndices, this->zDimIndices,
1231  this->xDimSize, this->yDimSize, this->zDimSize, changeVals );
1232 
1233  if ( settings->changeMapResolutionTriLinear )
1234  {
1235  ProSHADE_internal_messages::printWarningMessage ( settings->verbose, "!!! ProSHADE WARNING !!! Requested both Fourier-space and real-space map re-sampling. Defaulting to only Fourier space re-samplling.", "WM00049" );
1236  }
1237  }
1238  if ( settings->changeMapResolutionTriLinear && !settings->changeMapResolution )
1239  {
1240  ProSHADE_internal_mapManip::reSampleMapToResolutionTrilinear ( this->internalMap, settings->requestedResolution, this->xDimIndices, this->yDimIndices, this->zDimIndices,
1241  this->xDimSize, this->yDimSize, this->zDimSize, changeVals );
1242 
1243  }
1244 
1245  //================================================ Set the internal values to reflect the new map size
1246  this->xDimIndices += static_cast<proshade_unsign> ( changeVals[0] );
1247  this->yDimIndices += static_cast<proshade_unsign> ( changeVals[1] );
1248  this->zDimIndices += static_cast<proshade_unsign> ( changeVals[2] );
1249 
1250  this->xGridIndices = this->xDimIndices;
1251  this->yGridIndices = this->yDimIndices;
1252  this->zGridIndices = this->zDimIndices;
1253 
1254  this->xTo += static_cast<proshade_unsign> ( changeVals[0] );
1255  this->yTo += static_cast<proshade_unsign> ( changeVals[1] );
1256  this->zTo += static_cast<proshade_unsign> ( changeVals[2] );
1257 
1258  this->xDimSize = changeVals[3];
1259  this->yDimSize = changeVals[4];
1260  this->zDimSize = changeVals[5];
1261 
1262  //================================================ Figure how much the new map moved
1263  proshade_single xMov = -( ( this->xFrom * ( this->xDimSize / static_cast<proshade_single> ( this->xDimIndices - changeVals[0] ) ) ) -
1264  ( this->xFrom * ( this->xDimSize / static_cast<proshade_single> ( this->xDimIndices ) ) ) );
1265  proshade_single yMov = -( ( this->yFrom * ( this->yDimSize / static_cast<proshade_single> ( this->yDimIndices - changeVals[1] ) ) ) -
1266  ( this->yFrom * ( this->yDimSize / static_cast<proshade_single> ( this->yDimIndices ) ) ) );
1267  proshade_single zMov = -( ( this->zFrom * ( this->zDimSize / static_cast<proshade_single> ( this->zDimIndices - changeVals[2] ) ) ) -
1268  ( this->zFrom * ( this->zDimSize / static_cast<proshade_single> ( this->zDimIndices ) ) ) );
1269 
1270  //================================================ Move by indices (this should be sufficient)
1271  ProSHADE_internal_mapManip::moveMapByIndices ( &xMov, &yMov, &zMov, this->xDimSize, this->yDimSize, this->zDimSize, &this->xFrom, &this->xTo,
1272  &this->yFrom, &this->yTo, &this->zFrom, &this->zTo, &this->xAxisOrigin, &this->yAxisOrigin, &this->zAxisOrigin );
1273 
1274  ProSHADE_internal_mapManip::moveMapByFourier ( this->internalMap, xMov, yMov, zMov, this->xDimSize, this->yDimSize, this->zDimSize,
1275  this->xDimIndices, this->yDimIndices, this->zDimIndices );
1276 
1277  //================================================ Release memory
1278  delete[] changeVals;
1279 
1280  //================================================ Done
1281  return ;
1282 
1283 }
1284 
1295 {
1296  //================================================ Report function start
1297  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Centering map onto its COM." );
1298 
1299  //================================================ Initialise local variables
1300  proshade_unsign arrPos = 0;
1301  proshade_single xCOM = 0.0;
1302  proshade_single yCOM = 0.0;
1303  proshade_single zCOM = 0.0;
1304  proshade_single totDens = 0.0;
1305 
1306  //================================================ Find the COM location
1307  for ( proshade_unsign xIt = 0; xIt < this->xDimIndices; xIt++ )
1308  {
1309  for ( proshade_unsign yIt = 0; yIt < this->yDimIndices; yIt++ )
1310  {
1311  for ( proshade_unsign zIt = 0; zIt < this->zDimIndices; zIt++ )
1312  {
1313  //==================================== Get index
1314  arrPos = zIt + this->zDimIndices * ( yIt + this->yDimIndices * xIt );
1315 
1316  //==================================== Get COM
1317  if ( this->internalMap[arrPos] > 0.0 )
1318  {
1319  xCOM += static_cast<proshade_single> ( this->internalMap[arrPos] * xIt );
1320  yCOM += static_cast<proshade_single> ( this->internalMap[arrPos] * yIt );
1321  zCOM += static_cast<proshade_single> ( this->internalMap[arrPos] * zIt );
1322  totDens += static_cast<proshade_single> ( this->internalMap[arrPos] );
1323  }
1324  }
1325  }
1326  }
1327  xCOM /= totDens;
1328  yCOM /= totDens;
1329  zCOM /= totDens;
1330 
1331  //================================================ Find distance from COM to map centre in Angstroms
1332  proshade_single xDist = ( static_cast<proshade_single> ( this->xDimIndices / 2.0 ) - xCOM ) * static_cast<proshade_single> ( this->xDimSize / this->xDimIndices );
1333  proshade_single yDist = ( static_cast<proshade_single> ( this->yDimIndices / 2.0 ) - yCOM ) * static_cast<proshade_single> ( this->yDimSize / this->yDimIndices );
1334  proshade_single zDist = ( static_cast<proshade_single> ( this->zDimIndices / 2.0 ) - zCOM ) * static_cast<proshade_single> ( this->zDimSize / this->zDimIndices );
1335 
1336  //================================================ Move the map within the box
1337  ProSHADE_internal_mapManip::moveMapByFourier ( this->internalMap, xDist, yDist, zDist, this->xDimSize, this->yDimSize, this->zDimSize, this->xDimIndices, this->yDimIndices, this->zDimIndices );
1338 
1339  //================================================ Report function completion
1340  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 2, "Map centered." );
1341 
1342  //================================================ Done
1343  return ;
1344 
1345 }
1346 
1356 {
1357  //================================================ Report function start
1358  std::stringstream hlpSS;
1359  hlpSS << "Adding extra " << settings->addExtraSpace << " angstroms.";
1360  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, hlpSS.str() );
1361 
1362  //================================================ Figure how much indices need to change
1363  proshade_unsign xAddIndices = ProSHADE_internal_mapManip::myRound ( settings->addExtraSpace / static_cast<proshade_single> ( this->xDimSize / this->xDimIndices ) );
1364  proshade_unsign yAddIndices = ProSHADE_internal_mapManip::myRound ( settings->addExtraSpace / static_cast<proshade_single> ( this->yDimSize / this->yDimIndices ) );
1365  proshade_unsign zAddIndices = ProSHADE_internal_mapManip::myRound ( settings->addExtraSpace / static_cast<proshade_single> ( this->zDimSize / this->zDimIndices ) );
1366 
1367  //================================================ Update internal data variables
1368  this->xDimSize += static_cast<proshade_single> ( 2 * xAddIndices ) * static_cast<proshade_single> ( this->xDimSize / this->xDimIndices );
1369  this->yDimSize += static_cast<proshade_single> ( 2 * yAddIndices ) * static_cast<proshade_single> ( this->yDimSize / this->yDimIndices );
1370  this->zDimSize += static_cast<proshade_single> ( 2 * zAddIndices ) * static_cast<proshade_single> ( this->zDimSize / this->zDimIndices );
1371 
1372  this->xDimIndices += 2 * xAddIndices;
1373  this->yDimIndices += 2 * yAddIndices;
1374  this->zDimIndices += 2 * zAddIndices;
1375 
1376  this->xGridIndices = this->xDimIndices;
1377  this->yGridIndices = this->yDimIndices;
1378  this->zGridIndices = this->zDimIndices;
1379 
1380  this->xAxisOrigin -= xAddIndices;
1381  this->yAxisOrigin -= yAddIndices;
1382  this->zAxisOrigin -= zAddIndices;
1383 
1384  this->xFrom -= xAddIndices;
1385  this->yFrom -= yAddIndices;
1386  this->zFrom -= zAddIndices;
1387 
1388  this->xTo += xAddIndices;
1389  this->yTo += yAddIndices;
1390  this->zTo += zAddIndices;
1391 
1392  //================================================ Allocate new map
1393  proshade_double* newMap = new proshade_double[this->xDimIndices * this->yDimIndices * this->zDimIndices];
1394  ProSHADE_internal_misc::checkMemoryAllocation ( newMap, __FILE__, __LINE__, __func__ );
1395 
1396  //================================================ Set new map to zeroes
1397  for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
1398  {
1399  newMap[iter] = 0.0;
1400  }
1401 
1402  //================================================ Update the map
1403  proshade_unsign newMapIndex, oldMapIndex;
1404  for ( proshade_unsign xIt = 0; xIt < (this->xDimIndices - xAddIndices); xIt++ )
1405  {
1406  //============================================ Check if point is applicable
1407  if ( xIt < xAddIndices ) { continue; }
1408 
1409  for ( proshade_unsign yIt = 0; yIt < (this->yDimIndices - yAddIndices); yIt++ )
1410  {
1411  //======================================== Check if point is applicable
1412  if ( yIt < yAddIndices ) { continue; }
1413 
1414  for ( proshade_unsign zIt = 0; zIt < (this->zDimIndices - zAddIndices); zIt++ )
1415  {
1416  //==================================== Check if point is applicable
1417  if ( zIt < zAddIndices ) { continue; }
1418 
1419  //==================================== Var init
1420  newMapIndex = zIt + this->zDimIndices * ( yIt + this->yDimIndices * xIt );
1421  oldMapIndex = (zIt - zAddIndices) + (this->zDimIndices - ( 2 * zAddIndices ) ) * ( (yIt - yAddIndices) + (this->yDimIndices - ( 2 * yAddIndices ) ) * (xIt - xAddIndices) );
1422 
1423  newMap[newMapIndex] = this->internalMap[oldMapIndex];
1424  }
1425  }
1426  }
1427 
1428  //================================================ Copy new to old
1429  delete[] this->internalMap;
1430 
1431  this->internalMap = new proshade_double[this->xDimIndices * this->yDimIndices * this->zDimIndices];
1432  ProSHADE_internal_misc::checkMemoryAllocation ( this->internalMap, __FILE__, __LINE__, __func__ );
1433 
1434  for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
1435  {
1436  this->internalMap[iter] = newMap[iter];
1437  }
1438 
1439  //================================================ Release memory
1440  delete[] newMap;
1441 
1442  //================================================ Report function completion
1443  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 2, "Extra space added." );
1444 
1445  //================================================ Done
1446  return ;
1447 
1448 }
1449 
1465 {
1466  //================================================ Invert map
1467  if ( settings->invertMap ) { this->invertMirrorMap ( settings ); }
1468  else { ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Map inversion (mirror image) not requested." ); }
1469 
1470  //================================================ Normalise map
1471  if ( settings->normaliseMap ) { this->normaliseMap ( settings ); }
1472  else { ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Map normalisation not requested." ); }
1473 
1474  //================================================ Compute mask
1475  if ( settings->maskMap ) { this->maskMap ( settings ); }
1476  else { ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Masking not requested." ); }
1477 
1478  //================================================ Centre map
1479  if ( settings->moveToCOM ) { this->centreMapOnCOM ( settings ); }
1480  else { ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Map centering not requested." ); }
1481 
1482  //================================================ Add extra space
1483  if ( settings->addExtraSpace != 0.0 ) { this->addExtraSpace ( settings ); }
1484  else { ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Extra space not requested." ); }
1485 
1486  //================================================ Remove phase, if required
1487  if ( !settings->usePhase ) { this->removePhaseInormation ( settings ); ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Phase information removed from the data." ); }
1488  else { ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Phase information retained in the data." ); }
1489 
1490  //================================================ Set settings values which were left on AUTO by user and will not be set later
1491  settings->setVariablesLeftOnAuto ( );
1492 
1493  //================================================ Done
1494  return ;
1495 
1496 }
1497 
1508 {
1509  //================================================ Check the current settings value is set to auto
1510  if ( this->spherePos.size() != 0 )
1511  {
1512  std::stringstream hlpSS;
1513  hlpSS << "The sphere distances were determined as " << this->spherePos.at(0);
1514  for ( proshade_unsign iter = 1; iter < static_cast<proshade_unsign> ( this->spherePos.size() ); iter++ ) { hlpSS << "; " << this->spherePos.at(iter); }
1515  hlpSS << " Angstroms.";
1516  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 3, hlpSS.str() );
1517  return ;
1518  }
1519 
1520  //================================================ Find maximum diagonal
1521  proshade_unsign maxDim = std::max ( this->xDimSize, std::max ( this->yDimSize, this->zDimSize ) );
1522  proshade_unsign minDim = std::min ( this->xDimSize, std::min ( this->yDimSize, this->zDimSize ) );
1523  proshade_unsign midDim = 0;
1524  if ( ( this->xDimSize < maxDim ) && ( this->xDimSize > minDim ) ) { midDim = this->xDimSize; }
1525  else if ( ( this->yDimSize < maxDim ) && ( this->yDimSize > minDim ) ) { midDim = this->yDimSize; }
1526  else { midDim = this->zDimSize; }
1527 
1528  proshade_single maxDiag = std::sqrt ( std::pow ( static_cast<proshade_single> ( maxDim ), 2.0 ) +
1529  std::pow ( static_cast<proshade_single> ( midDim ), 2.0 ) );
1530 
1531  //================================================ Set between the points
1532  for ( proshade_single iter = 0.5; ( iter * settings->maxSphereDists ) < ( maxDiag / 2.0 ); iter += 1.0 )
1533  {
1534  ProSHADE_internal_misc::addToSingleVector ( &this->spherePos, ( iter * settings->maxSphereDists ) );
1535  }
1536 
1537  //================================================ Save the number of spheres
1538  this->noSpheres = static_cast<proshade_unsign> ( this->spherePos.size() );
1539 
1540  //================================================ Report progress
1541  std::stringstream hlpSS;
1542  hlpSS << "The sphere distances were determined as " << this->spherePos.at(0);
1543  for ( proshade_unsign iter = 1; iter < static_cast<proshade_unsign> ( this->spherePos.size() ); iter++ ) { hlpSS << "; " << this->spherePos.at(iter); }
1544  hlpSS << " Angstroms.";
1545  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 3, hlpSS.str() );
1546 
1547  //================================================ Done
1548  return ;
1549 
1550 }
1551 
1552 
1565 {
1566  //================================================ Report progress
1567  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Starting sphere mapping procedure." );
1568 
1569  //================================================ Determine spherical harmonics variables
1570  settings->determineAllSHValues ( this->xDimIndices, this->yDimIndices, this->zDimIndices,
1571  this->xDimSize, this->yDimSize, this->zDimSize );
1572  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 2, "Sphere settings determined." );
1573 
1574  //================================================ Find number of spheres supported
1575  this->getSpherePositions ( settings );
1576  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 2, "Sphere positions obtained." );
1577 
1578  //================================================ Create sphere objects and map the density
1579  this->spheres = new ProSHADE_internal_spheres::ProSHADE_sphere* [ this->noSpheres ];
1580  for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( this->spherePos.size() ); iter++ )
1581  {
1582  std::stringstream ss;
1583  ss << "Now mapping sphere " << iter << " .";
1584  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 4, ss.str() );
1585 
1586  this->spheres[iter] = new ProSHADE_internal_spheres::ProSHADE_sphere ( this->xDimIndices, this->yDimIndices, this->zDimIndices,
1587  this->xDimSize, this->yDimSize, this->zDimSize, iter,
1588  &this->spherePos, settings->progressiveSphereMapping, settings->maxBandwidth,
1589  this->internalMap, &this->maxShellBand );
1590  }
1591 
1592  //================================================ Report completion
1593  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 2, "Sphere mapping procedure completed." );
1594 
1595  //================================================ Done
1596  return ;
1597 
1598 }
1599 
1609 {
1610  //================================================ Report progress
1611  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Starting spherical harmonics decomposition." );
1612 
1613  //================================================ Initialise memory
1614  this->sphericalHarmonics = new proshade_complex* [this->noSpheres];
1615  ProSHADE_internal_misc::checkMemoryAllocation ( this->sphericalHarmonics, __FILE__, __LINE__, __func__ );
1616  for ( proshade_unsign iter = 0; iter < this->noSpheres; iter++ )
1617  {
1618  this->sphericalHarmonics[iter] = new proshade_complex [(this->spheres[iter]->getLocalBandwidth() * 2) * (this->spheres[iter]->getLocalBandwidth() * 2)];
1619  ProSHADE_internal_misc::checkMemoryAllocation ( this->sphericalHarmonics[iter], __FILE__, __LINE__, __func__ );
1620  }
1621 
1622  //================================================ Compute the spherical harmonics
1623  for ( proshade_unsign iter = 0; iter < this->noSpheres; iter++ )
1624  {
1625  //============================================ Report progress
1626  std::stringstream ss;
1627  ss << "Now decomposing sphere " << iter << ". " << "( Band is: " << this->spheres[iter]->getLocalBandwidth() << ").";
1628  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 4, ss.str() );
1629 
1630  //============================================ Compute
1631  ProSHADE_internal_sphericalHarmonics::computeSphericalHarmonics ( this->spheres[iter]->getLocalBandwidth(), this->spheres[iter]->getMappedData(), this->sphericalHarmonics[iter] );
1632  }
1633 
1634  //================================================ Report completion
1635  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 2, "Spherical harmonics decomposition complete." );
1636 
1637  //======================================== Done
1638  return ;
1639 
1640 }
1641 
1653 void ProSHADE_internal_data::ProSHADE_data::detectSymmetryInStructure ( ProSHADE_settings* settings, std::vector< proshade_double* >* axes, std::vector < std::vector< proshade_double > >* allCs )
1654 {
1655  //================================================ Initialise variables
1656  std::vector< proshade_double* > CSyms = this->getCyclicSymmetriesList ( settings );
1657 
1658  //================================================ Was any particular symmetry requested?
1659  if ( settings->requestedSymmetryType == "" )
1660  {
1661  //============================================ Run the symmetry detection functions for C, D, T, O and I symmetries
1662  std::vector< proshade_double* > DSyms = this->getDihedralSymmetriesList ( settings, &CSyms );
1663  std::vector< proshade_double* > ISyms = this->getIcosahedralSymmetriesList ( settings, &CSyms );
1664  std::vector< proshade_double* > OSyms; std::vector< proshade_double* > TSyms;
1665  if ( ISyms.size() < 31 ) { OSyms = this->getOctahedralSymmetriesList ( settings, &CSyms ); if ( OSyms.size() < 13 ) { TSyms = this->getTetrahedralSymmetriesList ( settings, &CSyms ); } }
1666 
1667  //============================================ Decide on recommended symmetry
1668  this->saveRecommendedSymmetry ( settings, &CSyms, &DSyms, &TSyms, &OSyms, &ISyms, axes );
1669  }
1670 
1671  if ( settings->requestedSymmetryType == "C" )
1672  {
1673  //============================================ Run only the C symmetry detection and search for requested fold
1674  this->saveRequestedSymmetryC ( settings, &CSyms, axes );
1675  }
1676 
1677  if ( settings->requestedSymmetryType == "D" )
1678  {
1679  //============================================ Run only the D symmetry detection and search for requested fold
1680  std::vector< proshade_double* > DSyms = this->getDihedralSymmetriesList ( settings, &CSyms );
1681  this->saveRequestedSymmetryD ( settings, &DSyms, axes );
1682  }
1683 
1684  if ( settings->requestedSymmetryType == "T" )
1685  {
1686  //============================================ Run only the T symmetry detection and search for requested fold
1687  std::vector< proshade_double* > TSyms = this->getTetrahedralSymmetriesList ( settings, &CSyms );
1688  settings->setRecommendedFold ( 0 );
1689  if ( TSyms.size() == 7 ) { settings->setRecommendedSymmetry ( "T" ); for ( proshade_unsign it = 0; it < static_cast<proshade_unsign> ( TSyms.size() ); it++ ) { settings->setDetectedSymmetry ( TSyms.at(it) ); ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( axes, TSyms.at(it) ); } }
1690  else { settings->setRecommendedSymmetry ( "" ); }
1691  }
1692 
1693  if ( settings->requestedSymmetryType == "O" )
1694  {
1695  //============================================ Run only the O symmetry detection and search for requested fold
1696  std::vector< proshade_double* > OSyms = this->getOctahedralSymmetriesList ( settings, &CSyms );
1697  settings->setRecommendedFold ( 0 );
1698  if ( OSyms.size() == 13 ) { settings->setRecommendedSymmetry ( "O" ); for ( proshade_unsign it = 0; it < static_cast<proshade_unsign> ( OSyms.size() ); it++ ) { settings->setDetectedSymmetry ( OSyms.at(it) ); ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( axes, OSyms.at(it) ); } }
1699  else { settings->setRecommendedSymmetry ( "" ); }
1700  }
1701 
1702  if ( settings->requestedSymmetryType == "I" )
1703  {
1704  //============================================ Run only the T symmetry detection and search for requested fold
1705  std::vector< proshade_double* > ISyms = this->getIcosahedralSymmetriesList ( settings, &CSyms );
1706  settings->setRecommendedFold ( 0 );
1707  if ( ISyms.size() == 31 ) { settings->setRecommendedSymmetry ( "I" ); for ( proshade_unsign it = 0; it < static_cast<proshade_unsign> ( ISyms.size() ); it++ ) { settings->setDetectedSymmetry ( ISyms.at(it) ); ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( axes, ISyms.at(it) ); } }
1708  else { settings->setRecommendedSymmetry ( "" ); }
1709  }
1710 
1711  if ( ( settings->requestedSymmetryType != "" ) && ( settings->requestedSymmetryType != "C" ) && ( settings->requestedSymmetryType != "D" ) && ( settings->requestedSymmetryType != "T" ) && ( settings->requestedSymmetryType != "O" ) && ( settings->requestedSymmetryType != "I" ) )
1712  {
1713  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." );
1714  }
1715 
1716  //================================================ Save C symmetries to argument and if different from settings, to the settings as well
1717  bool isArgSameAsSettings = true;
1718  for ( proshade_unsign cIt = 0; cIt < static_cast<proshade_unsign> ( CSyms.size() ); cIt++ )
1719  {
1720  std::vector< proshade_double > nextSym;
1721  ProSHADE_internal_misc::addToDoubleVector ( &nextSym, CSyms.at(cIt)[0] );
1722  ProSHADE_internal_misc::addToDoubleVector ( &nextSym, CSyms.at(cIt)[1] );
1723  ProSHADE_internal_misc::addToDoubleVector ( &nextSym, CSyms.at(cIt)[2] );
1724  ProSHADE_internal_misc::addToDoubleVector ( &nextSym, CSyms.at(cIt)[3] );
1725  ProSHADE_internal_misc::addToDoubleVector ( &nextSym, CSyms.at(cIt)[4] );
1726  ProSHADE_internal_misc::addToDoubleVector ( &nextSym, CSyms.at(cIt)[5] );
1728 
1729  if ( ( cIt == 0 ) && ( settings->allDetectedCAxes.size() == 0 ) ) { isArgSameAsSettings = false; }
1730  if ( !isArgSameAsSettings ) { ProSHADE_internal_misc::addToDoubleVectorVector ( &settings->allDetectedCAxes, nextSym ); }
1731 
1732  nextSym.clear ( );
1733  }
1734 
1735  //================================================ Release memory
1736  for ( proshade_unsign it = 0; it < static_cast<proshade_unsign> ( CSyms.size() ); it++ ) { delete[] CSyms.at(it); }
1737 
1738  //================================================ Done
1739  return ;
1740 
1741 }
1742 
1751 {
1752  //================================================ Run the algorithm
1753  this->detectSymmetryInStructure ( settings, &settings->detectedSymmetry, &settings->allDetectedCAxes );
1754 
1755  //================================================ Done
1756  return ;
1757 
1758 }
1759 
1773 void ProSHADE_internal_data::ProSHADE_data::detectSymmetryFromAngleAxisSpace ( ProSHADE_settings* settings, std::vector< proshade_double* >* axes, std::vector < std::vector< proshade_double > >* allCs )
1774 {
1775  //================================================ Modify axis tolerance and matrix tolerance by sampling, if required by user
1776  if ( settings->axisErrToleranceDefault )
1777  {
1778  settings->axisErrTolerance = std::max ( 0.01, ( 2.0 * M_PI ) / this->maxShellBand );
1779  }
1780 
1781  //================================================ If C was requested, we will do it immediately - this allows for a significant speed-up.
1782  if ( settings->requestedSymmetryType == "C" )
1783  {
1784  //============================================ Report progress
1785  std::stringstream hlpSS;
1786  hlpSS << "Starting detection of cyclic point group C" << settings->requestedSymmetryFold;
1787  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, hlpSS.str() );
1788 
1789  //============================================ Do simplified search only in the applicable data
1790  proshade_double symThres = 0.0;
1791  std::vector< proshade_double* > CSyms = this->findRequestedCSymmetryFromAngleAxis ( settings, settings->requestedSymmetryFold, &symThres );
1792 
1793  //============================================ Save the best axis as the recommended one
1794  if ( settings->detectedSymmetry.size() == 0 ) { if ( CSyms.size() > 0 ) { settings->setDetectedSymmetry ( CSyms.at(0) ); } }
1795  if ( CSyms.size() > 0 )
1796  {
1797  settings->setRecommendedSymmetry ( "C" );
1798  settings->setRecommendedFold ( settings->requestedSymmetryFold );
1799 
1801  this->saveDetectedSymmetries ( settings, &CSyms, allCs );
1802  }
1803  else
1804  {
1805  settings->setRecommendedSymmetry ( "" );
1806  settings->setRecommendedFold ( 0 );
1807  }
1808 
1809  //============================================ Done
1810  return ;
1811  }
1812 
1813  //============================================ Report progress
1814  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Starting C symmetry detection." );
1815 
1816  //================================================ Initialise variables
1817  std::vector< proshade_double* > CSyms = getCyclicSymmetriesListFromAngleAxis ( settings );
1818 
1819  //================================================ Sanity check - was the rotation function mapped properly?
1820  if ( this->sphereMappedRotFun.size() < 1 )
1821  {
1822  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." );
1823  }
1824 
1825  //================================================ Sanity check - was any symmetry requested?
1826  if ( ( settings->requestedSymmetryType != "" ) && ( settings->requestedSymmetryType != "C" ) && ( settings->requestedSymmetryType != "D" ) && ( settings->requestedSymmetryType != "T" ) && ( settings->requestedSymmetryType != "O" ) && ( settings->requestedSymmetryType != "I" ) )
1827  {
1828  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." );
1829  }
1830 
1831  //================================================ Are we doing general search?
1832  if ( settings->requestedSymmetryType == "" )
1833  {
1834  //============================================ Run the symmetry detection functions for C, D, T, O and I symmetries
1835  std::vector< proshade_double* > DSyms = this->getDihedralSymmetriesList ( settings, &CSyms );
1836  std::vector< proshade_double* > ISyms = this->getPredictedIcosahedralSymmetriesList ( settings, &CSyms );
1837  std::vector< proshade_double* > OSyms = this->getPredictedOctahedralSymmetriesList ( settings, &CSyms );
1838  std::vector< proshade_double* > TSyms = this->getPredictedTetrahedralSymmetriesList ( settings, &CSyms );;
1839 
1840  //============================================ Decide on recommended symmetry
1841  this->saveRecommendedSymmetry ( settings, &CSyms, &DSyms, &TSyms, &OSyms, &ISyms, axes );
1842  }
1843 
1844  if ( settings->requestedSymmetryType == "D" )
1845  {
1846  //============================================ Run only the D symmetry detection and search for requested fold
1847  std::vector< proshade_double* > DSyms = this->getDihedralSymmetriesList ( settings, &CSyms );
1848  this->saveRequestedSymmetryD ( settings, &DSyms, axes );
1849  }
1850 
1851  if ( settings->requestedSymmetryType == "T" )
1852  {
1853  //============================================ Run only the T symmetry detection
1854  std::vector< proshade_double* > TSyms = this->getPredictedTetrahedralSymmetriesList ( settings, &CSyms );
1855  if ( TSyms.size() == 7 ) { settings->setRecommendedSymmetry ( "T" ); for ( proshade_unsign it = 0; it < static_cast<proshade_unsign> ( TSyms.size() ); it++ ) { settings->setDetectedSymmetry ( TSyms.at(it) ); ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( axes, TSyms.at(it) ); } }
1856  else { settings->setRecommendedSymmetry ( "" ); }
1857  }
1858 
1859  if ( settings->requestedSymmetryType == "O" )
1860  {
1861  //============================================ Run only the O symmetry detection
1862  std::vector< proshade_double* > OSyms = this->getPredictedOctahedralSymmetriesList ( settings, &CSyms );
1863  if ( OSyms.size() == 13 ) { settings->setRecommendedSymmetry ( "O" ); for ( proshade_unsign it = 0; it < static_cast<proshade_unsign> ( OSyms.size() ); it++ ) { settings->setDetectedSymmetry ( OSyms.at(it) ); ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( axes, OSyms.at(it) ); } }
1864  else { settings->setRecommendedSymmetry ( "" ); }
1865  }
1866 
1867  if ( settings->requestedSymmetryType == "I" )
1868  {
1869  //============================================ Run only the I symmetry detection
1870  std::vector< proshade_double* > ISyms = this->getPredictedIcosahedralSymmetriesList ( settings, &CSyms );
1871  if ( ISyms.size() == 31 ) { settings->setRecommendedSymmetry ( "I" ); for ( proshade_unsign it = 0; it < static_cast<proshade_unsign> ( ISyms.size() ); it++ ) { settings->setDetectedSymmetry ( ISyms.at(it) ); ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( axes, ISyms.at(it) ); } }
1872  else { settings->setRecommendedSymmetry ( "" ); }
1873  }
1874 
1875  //================================================ Save C symmetries to argument and if different from settings, to the settings as well
1876  this->saveDetectedSymmetries ( settings, &CSyms, allCs );
1877 
1878  //================================================ Done
1879  return ;
1880 
1881 }
1882 
1896 void ProSHADE_internal_data::ProSHADE_data::saveDetectedSymmetries ( ProSHADE_settings* settings, std::vector< proshade_double* >* CSyms, std::vector < std::vector< proshade_double > >* allCs )
1897 {
1898  //================================================ Initialise variables
1899  bool isArgSameAsSettings = true;
1900 
1901  //================================================ For each detected point group
1902  for ( proshade_unsign cIt = 0; cIt < static_cast<proshade_unsign> ( CSyms->size() ); cIt++ )
1903  {
1904  //============================================ Create vector to replace the pointer
1905  std::vector< proshade_double > nextSym;
1906  ProSHADE_internal_misc::addToDoubleVector ( &nextSym, CSyms->at(cIt)[0] );
1907  ProSHADE_internal_misc::addToDoubleVector ( &nextSym, CSyms->at(cIt)[1] );
1908  ProSHADE_internal_misc::addToDoubleVector ( &nextSym, CSyms->at(cIt)[2] );
1909  ProSHADE_internal_misc::addToDoubleVector ( &nextSym, CSyms->at(cIt)[3] );
1910  ProSHADE_internal_misc::addToDoubleVector ( &nextSym, CSyms->at(cIt)[4] );
1911  ProSHADE_internal_misc::addToDoubleVector ( &nextSym, CSyms->at(cIt)[5] );
1913 
1914  //============================================ Copy the vector to output variable and if different, then also to settings object
1915  if ( ( cIt == 0 ) && ( settings->allDetectedCAxes.size() == 0 ) ) { isArgSameAsSettings = false; }
1916  if ( !isArgSameAsSettings ) { ProSHADE_internal_misc::addToDoubleVectorVector ( &settings->allDetectedCAxes, nextSym ); }
1917 
1918  //============================================ Release memory
1919  nextSym.clear ( );
1920  delete[] CSyms->at(cIt);
1921  }
1922 
1923  //================================================ Done
1924  return ;
1925 
1926 }
1927 
1928 
1938 proshade_double ProSHADE_internal_data::ProSHADE_data::findBestCScore ( std::vector< proshade_double* >* CSym, proshade_unsign* symInd )
1939 {
1940  //================================================ Sanity check
1941  if ( CSym->size() == 0 ) { *symInd = 0; return ( 0.0 ); }
1942 
1943  //================================================ Initalise variables
1944  proshade_double ret = CSym->at(0)[5];
1945  *symInd = 0;
1946  proshade_double frac = 0.0;
1947 
1948  //================================================ Check all other axes
1949 // THIS NEEDS TO BE IMPROVED USING THE MAXIMUM LIKELIHOOD FOR THIS FOLD
1950  for ( proshade_unsign ind = 1; ind < static_cast<proshade_unsign>( CSym->size() ); ind++ )
1951  {
1952  //============================================ If higher fold than already leading one (do not care for lower fold and lower average height axes)
1953  if ( CSym->at(ind)[0] > CSym->at(*symInd)[0] )
1954  {
1955  //======================================== How much higher fold is it? Also, adding some protection against large syms supported only by a subset and a minimum requirement.
1956  frac = ( std::abs( CSym->at(ind)[5]- 0.5 ) / std::abs( CSym->at(*symInd)[5] - 0.5 ) ) / ( CSym->at(*symInd)[0] / CSym->at(ind)[0] );
1957 
1958  //======================================== Check if the new is "better" according to this criteria.
1959  if ( frac >= 1.0 && ( ( CSym->at(*symInd)[5] * 0.85 ) < CSym->at(ind)[5] ) )
1960  {
1961  //==================================== And it is! Save and try next one.
1962  *symInd = ind;
1963  ret = CSym->at(ind)[5];
1964  }
1965  }
1966  }
1967 
1968  //================================================ Done
1969  return ( ret );
1970 
1971 }
1972 
1982 proshade_double ProSHADE_internal_data::ProSHADE_data::findBestDScore ( std::vector< proshade_double* >* DSym, proshade_unsign* symInd )
1983 {
1984  //================================================ Sort the vector
1985  std::sort ( DSym->begin(), DSym->end(), ProSHADE_internal_misc::sortDSymHlpInv );
1986 
1987  //================================================ Initalise variables
1988  proshade_double ret = 0.0;
1989  proshade_double frac = 0.0;
1990  if ( DSym->size() > 0 )
1991  {
1992  ret = ( ( DSym->at(0)[0] * DSym->at(0)[5] ) + ( DSym->at(0)[6] * DSym->at(0)[11] ) ) / ( DSym->at(0)[0] + DSym->at(0)[6] );
1993  *symInd = 0;
1994  }
1995  else { return ( ret ); }
1996 
1997  //================================================ Check all other axes
1998 // THIS NEEDS TO BE IMPROVED USING THE MAXIMUM LIKELIHOOD FOR THIS FOLD
1999  for ( proshade_unsign ind = 1; ind < static_cast<proshade_unsign>( DSym->size() ); ind++ )
2000  {
2001  //============================================ If higher fold than already leading one (do not care for lower fold and lower average height axes)
2002  if ( ( DSym->at(ind)[0] + DSym->at(ind)[6] ) > ( DSym->at(*symInd)[0] + DSym->at(*symInd)[6] ) )
2003  {
2004  //======================================== How much higher fold is it? Also, adding some protection against large syms supported only by a subset and a minimum requirement.
2005  frac = std::max ( std::min ( ( ( DSym->at(*symInd)[0] + DSym->at(*symInd)[6] ) / ( DSym->at(ind)[0] + DSym->at(ind)[6] ) ) * 1.5, 0.9 ), 0.6 );
2006 
2007  //======================================== Check if the new is "better" according to this criteria.
2008  if ( ( ( ( DSym->at(*symInd)[0] * DSym->at(*symInd)[5] ) + ( DSym->at(*symInd)[6] * DSym->at(*symInd)[11] ) ) / ( DSym->at(*symInd)[0] + DSym->at(*symInd)[6] ) * frac ) < ( ( DSym->at(ind)[0] * DSym->at(ind)[5] ) + ( DSym->at(ind)[6] * DSym->at(ind)[11] ) ) / ( DSym->at(ind)[0] + DSym->at(ind)[6] ) )
2009  {
2010  //==================================== And it is! Save and try next one.
2011  *symInd = ind;
2012  ret = ( ( DSym->at(ind)[0] * DSym->at(ind)[5] ) + ( DSym->at(ind)[6] * DSym->at(ind)[11] ) ) / ( DSym->at(ind)[0] + DSym->at(ind)[6] );
2013  }
2014  }
2015  }
2016 
2017  //================================================ Done
2018  return ( ret );
2019 
2020 }
2021 
2030 proshade_double ProSHADE_internal_data::ProSHADE_data::findTScore ( std::vector< proshade_double* >* TSym )
2031 {
2032  //================================================ Initialise variables
2033  proshade_double ret = 0.0;
2034  proshade_double foldSum = 0.0;
2035 
2036  //================================================ Check the T symmetry for being complete
2037  if ( TSym->size() == 7 )
2038  {
2039  //============================================ Compute the weighted fold
2040  for ( proshade_unsign cIt = 0; cIt < static_cast<proshade_unsign> ( TSym->size() ); cIt++ )
2041  {
2042  ret += TSym->at(cIt)[0] * TSym->at(cIt)[5];
2043  foldSum += TSym->at(cIt)[0];
2044  }
2045 
2046  //============================================ Weight
2047  ret /= foldSum;
2048  }
2049 
2050  //================================================ Done
2051  return ( ret );
2052 
2053 }
2054 
2063 proshade_double ProSHADE_internal_data::ProSHADE_data::findOScore ( std::vector< proshade_double* >* OSym )
2064 {
2065  //================================================ Initialise variables
2066  proshade_double ret = 0.0;
2067  proshade_double foldSum = 0.0;
2068 
2069  //================================================ Check the O symmetry for being complete
2070  if ( OSym->size() == 13 )
2071  {
2072  //============================================ Compute the weighted fold
2073  for ( proshade_unsign cIt = 0; cIt < static_cast<proshade_unsign> ( OSym->size() ); cIt++ )
2074  {
2075  ret += OSym->at(cIt)[0] * OSym->at(cIt)[5];
2076  foldSum += OSym->at(cIt)[0];
2077  }
2078 
2079  //============================================ Weight
2080  ret /= foldSum;
2081  }
2082 
2083  //================================================ Done
2084  return ( ret );
2085 
2086 }
2087 
2096 proshade_double ProSHADE_internal_data::ProSHADE_data::findIScore ( std::vector< proshade_double* >* ISym )
2097 {
2098  //================================================ Initialise variables
2099  proshade_double ret = 0.0;
2100  proshade_double foldSum = 0.0;
2101 
2102  //================================================ Check the T symmetry for being complete
2103  if ( ISym->size() == 31 )
2104  {
2105  //============================================ Compute the weighted fold
2106  for ( proshade_unsign cIt = 0; cIt < static_cast<proshade_unsign> ( ISym->size() ); cIt++ )
2107  {
2108  ret += ISym->at(cIt)[0] * ISym->at(cIt)[5];
2109  foldSum += ISym->at(cIt)[0];
2110  }
2111 
2112  //============================================ Weight
2113  ret /= foldSum;
2114  }
2115 
2116  //================================================ Done
2117  return ( ret );
2118 
2119 }
2120 
2135 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 )
2136 {
2137  //================================================ Initialise variables
2138  proshade_double cScore = 0.0, dScore = 0.0, tScore = 0.0, oScore = 0.0, iScore = 0.0;
2139  proshade_unsign bestCIndex, bestDIndex;
2140 
2141  //================================================ Find a score for each input symmetry type.
2142  cScore = this->findBestCScore ( CSym, &bestCIndex );
2143  dScore = this->findBestDScore ( DSym, &bestDIndex );
2144  tScore = this->findTScore ( TSym );
2145  oScore = this->findOScore ( OSym );
2146  iScore = this->findIScore ( ISym );
2147 
2148  //================================================ Find the best available score - !!! Modified weights for the predicted symmetries as they have heights 0.0 (predicted) ...
2149  proshade_double bestWeightedScore = std::max ( cScore, std::max ( dScore * 1.1, std::max ( tScore * 3000.0, std::max ( oScore * 4000.0, iScore * 5000.0 ) ) ) );
2150 
2151  //================================================ No score? Well, no symmetry.
2152  if ( bestWeightedScore < 0.05 ) { settings->setRecommendedSymmetry ( "" ); return; }
2153 
2154  if ( bestWeightedScore == cScore )
2155  {
2156  settings->setRecommendedSymmetry ( "C" );
2157  settings->setRecommendedFold ( CSym->at(bestCIndex)[0] );
2158  ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( axes, CSym->at(bestCIndex) );
2159  if ( settings->detectedSymmetry.size() == 0 ) { settings->setDetectedSymmetry ( CSym->at(bestCIndex) ); }
2160 
2161  //============================================ Warn if resolution does not really support this fold
2162  if ( ( ( 360.0 / static_cast<double> ( CSym->at(bestCIndex)[0] ) ) - ( 360.0 / static_cast<double> ( CSym->at(bestCIndex)[0] + 1 ) ) ) <
2163  ( 360.0 / static_cast<double> ( settings->maxBandwidth * 4.0 ) ) )
2164  {
2165  std::stringstream hlpSS;
2166  hlpSS << "!!! ProSHADE WARNING !!! Reporting symmetry C" << CSym->at(bestCIndex)[0] << ", however, the grid sampling does not provide reasonable accuracy for symmetry with such high fold and therefore ProSHADE cannot responsibly claim this symmetry to be correct. It is suggested that the grid sampling is increased for more accurate symmetry detection. (Set higher resolution using -r).";
2167  ProSHADE_internal_messages::printWarningMessage ( settings->verbose, hlpSS.str(), "WS00054" );
2168  }
2169  }
2170  if ( bestWeightedScore == dScore * 1.1 )
2171  {
2172  settings->setRecommendedSymmetry ( "D" );
2173  settings->setRecommendedFold ( std::max ( DSym->at(bestDIndex)[0], DSym->at(bestDIndex)[6] ) );
2174  ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( axes, DSym->at(bestDIndex) );
2175  ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( axes, &DSym->at(bestDIndex)[6] );
2176  if ( settings->detectedSymmetry.size() == 0 )
2177  {
2178  settings->setDetectedSymmetry ( DSym->at(bestDIndex) );
2179  settings->setDetectedSymmetry ( &DSym->at(bestDIndex)[6] );
2180  }
2181 
2182  //============================================ Warn if resolution does not really support this fold
2183  if ( ( ( 360.0 / static_cast<double> ( std::max ( DSym->at(bestDIndex)[0], DSym->at(bestDIndex)[6] ) ) ) - ( 360.0 / static_cast<double> ( std::max ( DSym->at(bestDIndex)[0], DSym->at(bestDIndex)[6] ) + 1 ) ) ) <
2184  ( 360.0 / static_cast<double> ( settings->maxBandwidth * 4.0 ) ) )
2185  {
2186  std::stringstream hlpSS;
2187  hlpSS << "!!! ProSHADE WARNING !!! Reporting symmetry D" << std::max ( DSym->at(bestDIndex)[0], DSym->at(bestDIndex)[6] ) << ", however, the grid sampling does not provide reasonable accuracy for symmetry with such high fold and therefore ProSHADE cannot responsibly claim this symmetry to be correct. It is suggested that the grid sampling is increased for more accurate symmetry detection. (Set higher resolution using -r).";
2188  ProSHADE_internal_messages::printWarningMessage ( settings->verbose, hlpSS.str(), "WS00054" );
2189  }
2190  }
2191  if ( bestWeightedScore == tScore * 3000.0 )
2192  {
2193  settings->setRecommendedSymmetry ( "T" );
2194  settings->setRecommendedFold ( 0 );
2195  for ( proshade_unsign it = 0; it < static_cast<proshade_unsign> ( TSym->size() ); it++ ) { ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( axes, TSym->at(it) ); }
2196  if ( settings->detectedSymmetry.size() == 0 ) { for ( proshade_unsign it = 0; it < static_cast<proshade_unsign> ( TSym->size() ); it++ ) { settings->setDetectedSymmetry ( TSym->at(it) ); } }
2197  }
2198  if ( bestWeightedScore == oScore * 4000.0 )
2199  {
2200  settings->setRecommendedSymmetry ( "O" );
2201  settings->setRecommendedFold ( 0 );
2202  for ( proshade_unsign it = 0; it < static_cast<proshade_unsign> ( OSym->size() ); it++ ) { ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( axes, OSym->at(it) ); }
2203  if ( settings->detectedSymmetry.size() == 0 ) { for ( proshade_unsign it = 0; it < static_cast<proshade_unsign> ( OSym->size() ); it++ ) { settings->setDetectedSymmetry ( OSym->at(it) ); } }
2204  }
2205  if ( bestWeightedScore == iScore * 5000.0 )
2206  {
2207  settings->setRecommendedSymmetry ( "I" );
2208  settings->setRecommendedFold ( 0 );
2209  for ( proshade_unsign it = 0; it < static_cast<proshade_unsign> ( ISym->size() ); it++ ) { ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( axes, ISym->at(it) ); }
2210  if ( settings->detectedSymmetry.size() == 0 ) { for ( proshade_unsign it = 0; it < static_cast<proshade_unsign> ( ISym->size() ); it++ ) { settings->setDetectedSymmetry ( ISym->at(it) ); } }
2211  }
2212 
2213  //================================================ Done
2214  return ;
2215 
2216 }
2217 
2229 void ProSHADE_internal_data::ProSHADE_data::saveRequestedSymmetryC ( ProSHADE_settings* settings, std::vector< proshade_double* >* CSym, std::vector< proshade_double* >* axes )
2230 {
2231  //================================================ Initialise variables
2232  proshade_unsign bestIndex = 0;
2233  proshade_double highestSym = 0.0;
2234 
2235  //================================================ Search for best fold
2236  for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( CSym->size() ); iter++ )
2237  {
2238  //============================================ Check if it is tbe correct fold
2239  if ( CSym->at(iter)[0] != settings->requestedSymmetryFold ) { continue; }
2240 
2241  //============================================ If correct, is it the highest found?
2242  if ( CSym->at(iter)[5] > highestSym )
2243  {
2244  highestSym = CSym->at(iter)[5];
2245  bestIndex = iter;
2246  }
2247  }
2248 
2249  //================================================ Found?
2250  if ( highestSym > 0.0 )
2251  {
2252  settings->setRecommendedSymmetry ( "C" );
2253  settings->setRecommendedFold ( CSym->at(bestIndex)[0] );
2254  ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( axes, CSym->at(bestIndex) );
2255 
2256  if ( settings->detectedSymmetry.size() == 0 ) { settings->setDetectedSymmetry ( CSym->at(bestIndex) ); }
2257  }
2258  else
2259  {
2260  settings->setRecommendedSymmetry ( "" );
2261  settings->setRecommendedFold ( 0 );
2262  }
2263 
2264  //================================================ Done
2265  return ;
2266 
2267 }
2268 
2280 void ProSHADE_internal_data::ProSHADE_data::saveRequestedSymmetryD ( ProSHADE_settings* settings, std::vector< proshade_double* >* DSym, std::vector< proshade_double* >* axes )
2281 {
2282  //================================================ Initialise variables
2283  proshade_unsign bestIndex = 0;
2284  proshade_double highestSym = 0.0;
2285 
2286  //================================================ Search for best fold
2287  for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( DSym->size() ); iter++ )
2288  {
2289  //============================================ Check if it is tbe correct fold
2290  if ( std::max ( DSym->at(iter)[0], DSym->at(iter)[6] ) != settings->requestedSymmetryFold ) { continue; }
2291 
2292  //============================================ If correct, is it the highest found?
2293  if ( ( DSym->at(iter)[5] + DSym->at(iter)[11] ) > highestSym )
2294  {
2295  highestSym = ( DSym->at(iter)[5] + DSym->at(iter)[11] );
2296  bestIndex = iter;
2297  }
2298  }
2299 
2300  //================================================ Found?
2301  if ( highestSym > 0.0 )
2302  {
2303  settings->setRecommendedSymmetry ( "D" );
2304  settings->setRecommendedFold ( std::max ( DSym->at(bestIndex)[0], DSym->at(bestIndex)[6] ) );
2305  ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( axes, DSym->at(bestIndex) );
2306  ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( axes, &DSym->at(bestIndex)[6] );
2307 
2308  if ( settings->detectedSymmetry.size() == 0 )
2309  {
2310  settings->setDetectedSymmetry ( DSym->at(bestIndex) );
2311  settings->setDetectedSymmetry ( &DSym->at(bestIndex)[6] );
2312  }
2313  }
2314  else
2315  {
2316  settings->setRecommendedSymmetry ( "" );
2317  settings->setRecommendedFold ( 0 );
2318  }
2319 
2320  //================================================ Done
2321  return ;
2322 
2323 }
2324 
2333 std::vector<std::vector< proshade_double > > ProSHADE_internal_data::computeGroupElementsForGroup ( proshade_double xAx, proshade_double yAx, proshade_double zAx, proshade_signed fold )
2334 {
2335  //================================================ Initialise variables
2336  std::vector< proshade_double > angList;
2337  std::vector<std::vector< proshade_double > > ret;
2338 
2339  //================================================ Allocate memory
2340  proshade_double* rotMat = new proshade_double[9];
2341  ProSHADE_internal_misc::checkMemoryAllocation ( rotMat, __FILE__, __LINE__, __func__ );
2342 
2343 
2344  //================================================ Normalise the axis to have magnitude of 1.0
2345  proshade_double normF = std::sqrt( std::pow ( xAx, 2.0 ) + std::pow ( yAx, 2.0 ) + std::pow ( zAx, 2.0 ) );
2346  xAx /= normF;
2347  yAx /= normF;
2348  zAx /= normF;
2349 
2350  //================================================ Determine the list of angles
2351  if ( fold % 2 == 0 )
2352  {
2353  //============================================ If fold is even, add the negative angles
2354  for ( proshade_double iter = static_cast < proshade_double > ( -( ( fold / 2 ) - 1 ) ); iter <= static_cast < proshade_double > ( fold / 2 ); iter++ )
2355  {
2356  ProSHADE_internal_misc::addToDoubleVector ( &angList, ( ( 2.0 * M_PI ) / static_cast<proshade_double> ( fold ) ) * iter );
2357  }
2358  }
2359  else
2360  {
2361  //============================================ If fold is odd, do the same as for even, but start one index earlier
2362  for ( proshade_double iter = static_cast < proshade_double > ( -fold / 2 ); iter <= static_cast < proshade_double > ( fold / 2 ); iter++ )
2363  {
2364  ProSHADE_internal_misc::addToDoubleVector ( &angList, ( ( 2.0 * M_PI ) / static_cast<proshade_double> ( fold ) ) * iter );
2365  }
2366  }
2367 
2368  //================================================ For each detected angle
2369  for ( proshade_unsign iter = 0; iter < static_cast < proshade_unsign > ( angList.size() ); iter++ )
2370  {
2371  //============================================ Compute the rotation matrix
2372  ProSHADE_internal_maths::getRotationMatrixFromAngleAxis ( rotMat, xAx, yAx, zAx, angList.at(iter) );
2373 
2374  //============================================ Convert to vector of vectors of doubles and save to ret
2375  std::vector < proshade_double > retEl;
2376  for ( proshade_unsign matIt = 0; matIt < 9; matIt++ )
2377  {
2378  ProSHADE_internal_misc::addToDoubleVector ( &retEl, rotMat[matIt] );
2379  }
2381  }
2382 
2383  //================================================ Release memory
2384  delete[] rotMat;
2385 
2386  //================================================ Done
2387  return ( ret );
2388 
2389 }
2390 
2397 void axesToGroupTypeSanityCheck ( proshade_unsign requiredAxes, proshade_unsign obtainedAxes, std::string groupType )
2398 {
2399  //================================================ Sanity check
2400  if ( obtainedAxes != requiredAxes )
2401  {
2402  std::stringstream hlpSS;
2403  hlpSS << "The supplied number of axes for group element\n : detection ( >" << obtainedAxes << "< ) does not match the group type ( >" << groupType << "< ).";
2404  throw ProSHADE_exception ( "Mismatch between supplied number of axes and\n : symmetry type.", "ES00059", __FILE__, __LINE__, __func__, hlpSS.str() );
2405  }
2406 
2407  //================================================ Done
2408  return ;
2409 
2410 }
2411 
2419 bool checkElementAlreadyExists ( std::vector<std::vector< proshade_double > >* elements, std::vector< proshade_double >* elem, proshade_double matrixTolerance )
2420 {
2421  //================================================ Initialise variables
2422  bool elementFound = false;
2423 
2424  //================================================ For each existing element
2425  for ( proshade_unsign elIt = 0; elIt < static_cast<proshade_unsign> ( elements->size() ); elIt++ )
2426  {
2427  if ( ProSHADE_internal_maths::rotationMatrixSimilarity ( &elements->at(elIt), elem, matrixTolerance ) )
2428  {
2429  elementFound = true;
2430  break;
2431  }
2432  }
2433 
2434  //================================================ Done
2435  return ( elementFound );
2436 
2437 }
2438 
2445 bool checkElementsFormGroup ( std::vector<std::vector< proshade_double > >* elements, proshade_double matrixTolerance )
2446 {
2447  //================================================ Initialise variables
2448  bool isGroup = true;
2449 
2450  //================================================ Multiply all group element pairs
2451  for ( proshade_unsign gr1 = 0; gr1 < static_cast<proshade_unsign> ( elements->size() ); gr1++ )
2452  {
2453  for ( proshade_unsign gr2 = 1; gr2 < static_cast<proshade_unsign> ( elements->size() ); gr2++ )
2454  {
2455  //======================================== Use unique pairs only
2456  if ( gr1 >= gr2 ) { continue; }
2457 
2458  //======================================== Multiply the two rotation matrices
2459  std::vector< proshade_double > product = ProSHADE_internal_maths::multiplyGroupElementMatrices ( &elements->at(gr1), &elements->at(gr2) );
2460 
2461  //======================================== Check the group already contains the produces as an element
2462  if ( !checkElementAlreadyExists ( elements, &product, matrixTolerance ) )
2463  {
2464  isGroup = false;
2465  break;
2466  }
2467  }
2468 
2469  //============================================ Stop if problem was found
2470  if ( !isGroup ) { break; }
2471  }
2472 
2473  //================================================ Done
2474  return ( isGroup );
2475 
2476 }
2477 
2486 std::vector<std::vector< proshade_double > > ProSHADE_internal_data::joinElementsFromDifferentGroups ( std::vector<std::vector< proshade_double > >* first, std::vector<std::vector< proshade_double > >* second, proshade_double matrixTolerance, bool combine )
2487 {
2488  //================================================ Initialise variables
2489  std::vector< std::vector< proshade_double > > ret;
2490 
2491  //================================================ Add the first list to ret, checking for uniqueness
2492  for ( proshade_unsign elIt = 0; elIt < static_cast<proshade_unsign> ( first->size() ); elIt++ )
2493  {
2494  if ( !checkElementAlreadyExists( &ret, &first->at(elIt), matrixTolerance ) )
2495  {
2496  ProSHADE_internal_misc::addToDoubleVectorVector ( &ret, first->at(elIt) );
2497  }
2498  }
2499 
2500  //================================================ Add the second list to ret, checking for uniqueness
2501  for ( proshade_unsign elIt = 0; elIt < static_cast<proshade_unsign> ( second->size() ); elIt++ )
2502  {
2503  if ( !checkElementAlreadyExists( &ret, &second->at(elIt), matrixTolerance ) )
2504  {
2505  ProSHADE_internal_misc::addToDoubleVectorVector ( &ret, second->at(elIt) );
2506  }
2507  }
2508 
2509  //================================================ Multiply all combinations of first and second and check for uniqueness
2510  if ( combine )
2511  {
2512  for ( proshade_unsign gr1 = 0; gr1 < static_cast<proshade_unsign> ( first->size() ); gr1++ )
2513  {
2514  for ( proshade_unsign gr2 = 0; gr2 < static_cast<proshade_unsign> ( second->size() ); gr2++ )
2515  {
2516  //==================================== Multiply the two rotation matrices
2517  std::vector< proshade_double > product = ProSHADE_internal_maths::multiplyGroupElementMatrices ( &first->at(gr1), &second->at(gr2) );
2518 
2519  //==================================== Add
2520  if ( !checkElementAlreadyExists( &ret, &product, matrixTolerance ) )
2521  {
2523  }
2524 
2525  }
2526  }
2527  }
2528 
2529  //================================================ Done
2530  return ( ret );
2531 
2532 }
2533 
2552 std::vector<std::vector< proshade_double > > ProSHADE_internal_data::ProSHADE_data::getAllGroupElements ( ProSHADE_settings* settings, std::vector< proshade_unsign > axesList, std::string groupType, proshade_double matrixTolerance )
2553 {
2554  //================================================ Initialise variables
2555  std::vector<std::vector< proshade_double > > ret;
2556 
2557  //================================================ Select which symmetry type are we computing for
2558  if ( groupType == "C" )
2559  {
2560  //============================================ Sanity check
2561  axesToGroupTypeSanityCheck ( 1, static_cast<proshade_unsign> ( axesList.size() ), groupType );
2562 
2563  //============================================ Generate elements
2564  ret = computeGroupElementsForGroup ( settings->allDetectedCAxes.at(axesList.at(0)).at(1),
2565  settings->allDetectedCAxes.at(axesList.at(0)).at(2),
2566  settings->allDetectedCAxes.at(axesList.at(0)).at(3),
2567  settings->allDetectedCAxes.at(axesList.at(0)).at(0) );
2568 
2569  //============================================ Check the element to form a group
2570  if ( checkElementsFormGroup ( &ret, matrixTolerance ) ) { return ( ret ); }
2571  else
2572  {
2573  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." );
2574  }
2575  }
2576  else if ( groupType == "D" )
2577  {
2578  //============================================ Sanity check
2579  axesToGroupTypeSanityCheck ( 2, static_cast<proshade_unsign> ( axesList.size() ), groupType );
2580 
2581  //============================================ Generate elements for both axes
2582  std::vector<std::vector< proshade_double > > first = computeGroupElementsForGroup ( settings->allDetectedCAxes.at(axesList.at(0)).at(1),
2583  settings->allDetectedCAxes.at(axesList.at(0)).at(2),
2584  settings->allDetectedCAxes.at(axesList.at(0)).at(3),
2585  settings->allDetectedCAxes.at(axesList.at(0)).at(0) );
2586  std::vector<std::vector< proshade_double > > second = computeGroupElementsForGroup ( settings->allDetectedCAxes.at(axesList.at(1)).at(1),
2587  settings->allDetectedCAxes.at(axesList.at(1)).at(2),
2588  settings->allDetectedCAxes.at(axesList.at(1)).at(3),
2589  settings->allDetectedCAxes.at(axesList.at(1)).at(0) );
2590 
2591  //============================================ Join the element lists
2592  ret = joinElementsFromDifferentGroups ( &first, &second, matrixTolerance, true );
2593 
2594  //============================================ Check the element to form a group
2595  if ( checkElementsFormGroup ( &ret, matrixTolerance ) ) { return ( ret ); }
2596  else
2597  {
2598  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." );
2599  }
2600  }
2601  else if ( groupType == "T" )
2602  {
2603  //============================================ Sanity check
2604  axesToGroupTypeSanityCheck ( 7, static_cast<proshade_unsign> ( axesList.size() ), groupType );
2605 
2606  //============================================ Generate elements for all four C3 axes first
2607  for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
2608  {
2609  //======================================== If this is a C3 axis
2610  if ( settings->allDetectedCAxes.at(axesList.at(grIt)).at(0) == 3 )
2611  {
2612  //==================================== Generate the elements
2613  std::vector<std::vector< proshade_double > > els = computeGroupElementsForGroup ( settings->allDetectedCAxes.at(axesList.at(grIt)).at(1),
2614  settings->allDetectedCAxes.at(axesList.at(grIt)).at(2),
2615  settings->allDetectedCAxes.at(axesList.at(grIt)).at(3),
2616  settings->allDetectedCAxes.at(axesList.at(grIt)).at(0) );
2617 
2618  //==================================== Join the elements to any already found
2619  ret = joinElementsFromDifferentGroups ( &els, &ret, matrixTolerance, false );
2620  }
2621  }
2622 
2623  //============================================ Generate elements for all three C2 axes second
2624  for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
2625  {
2626  //======================================== If this is a C3 axis
2627  if ( settings->allDetectedCAxes.at(axesList.at(grIt)).at(0) == 2 )
2628  {
2629  //==================================== Generate the elements
2630  std::vector<std::vector< proshade_double > > els = computeGroupElementsForGroup ( settings->allDetectedCAxes.at(axesList.at(grIt)).at(1),
2631  settings->allDetectedCAxes.at(axesList.at(grIt)).at(2),
2632  settings->allDetectedCAxes.at(axesList.at(grIt)).at(3),
2633  settings->allDetectedCAxes.at(axesList.at(grIt)).at(0) );
2634 
2635  //==================================== Join the elements to any already found
2636  ret = joinElementsFromDifferentGroups ( &els, &ret, matrixTolerance, false );
2637  }
2638  }
2639 
2640  //============================================ Check the element to form a group
2641  if ( checkElementsFormGroup ( &ret, matrixTolerance ) ) { return ( ret ); }
2642  else
2643  {
2644  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." );
2645  }
2646  }
2647  else if ( groupType == "O" )
2648  {
2649  //============================================ Sanity check
2650  axesToGroupTypeSanityCheck ( 13, static_cast<proshade_unsign> ( axesList.size() ), groupType );
2651 
2652  //============================================ Generate elements for all three C4 axes first
2653  for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
2654  {
2655  //======================================== If this is a C3 axis
2656  if ( settings->allDetectedCAxes.at(axesList.at(grIt)).at(0) == 4 )
2657  {
2658  //==================================== Generate the elements
2659  std::vector<std::vector< proshade_double > > els = computeGroupElementsForGroup ( settings->allDetectedCAxes.at(axesList.at(grIt)).at(1),
2660  settings->allDetectedCAxes.at(axesList.at(grIt)).at(2),
2661  settings->allDetectedCAxes.at(axesList.at(grIt)).at(3),
2662  settings->allDetectedCAxes.at(axesList.at(grIt)).at(0) );
2663 
2664  //==================================== Join the elements to any already found
2665  ret = joinElementsFromDifferentGroups ( &els, &ret, matrixTolerance, false );
2666  }
2667  }
2668 
2669  //============================================ Generate elements for all four C3 axes first
2670  for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
2671  {
2672  //======================================== If this is a C3 axis
2673  if ( settings->allDetectedCAxes.at(axesList.at(grIt)).at(0) == 3 )
2674  {
2675  //==================================== Generate the elements
2676  std::vector<std::vector< proshade_double > > els = computeGroupElementsForGroup ( settings->allDetectedCAxes.at(axesList.at(grIt)).at(1),
2677  settings->allDetectedCAxes.at(axesList.at(grIt)).at(2),
2678  settings->allDetectedCAxes.at(axesList.at(grIt)).at(3),
2679  settings->allDetectedCAxes.at(axesList.at(grIt)).at(0) );
2680 
2681  //==================================== Join the elements to any already found
2682  ret = joinElementsFromDifferentGroups ( &els, &ret, matrixTolerance, false );
2683  }
2684  }
2685 
2686  //============================================ Generate elements for all six C2 axes next
2687  for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
2688  {
2689  //======================================== If this is a C3 axis
2690  if ( settings->allDetectedCAxes.at(axesList.at(grIt)).at(0) == 2 )
2691  {
2692  //==================================== Generate the elements
2693  std::vector<std::vector< proshade_double > > els = computeGroupElementsForGroup ( settings->allDetectedCAxes.at(axesList.at(grIt)).at(1),
2694  settings->allDetectedCAxes.at(axesList.at(grIt)).at(2),
2695  settings->allDetectedCAxes.at(axesList.at(grIt)).at(3),
2696  settings->allDetectedCAxes.at(axesList.at(grIt)).at(0) );
2697 
2698  //==================================== Join the elements to any already found
2699  ret = joinElementsFromDifferentGroups ( &els, &ret, matrixTolerance, false );
2700  }
2701  }
2702 
2703  //============================================ Check the element to form a group
2704  if ( checkElementsFormGroup ( &ret, matrixTolerance ) ) { return ( ret ); }
2705  else
2706  {
2707  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." );
2708  }
2709  }
2710  else if ( groupType == "I" )
2711  {
2712  //============================================ Sanity check
2713  axesToGroupTypeSanityCheck ( 31, static_cast<proshade_unsign> ( axesList.size() ), groupType );
2714 
2715  //============================================ Generate elements for all six C5 axes first
2716  for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
2717  {
2718  //======================================== If this is a C5 axis
2719  if ( settings->allDetectedCAxes.at(axesList.at(grIt)).at(0) == 5 )
2720  {
2721  //==================================== Generate the elements
2722  std::vector<std::vector< proshade_double > > els = computeGroupElementsForGroup ( settings->allDetectedCAxes.at(axesList.at(grIt)).at(1),
2723  settings->allDetectedCAxes.at(axesList.at(grIt)).at(2),
2724  settings->allDetectedCAxes.at(axesList.at(grIt)).at(3),
2725  settings->allDetectedCAxes.at(axesList.at(grIt)).at(0) );
2726 
2727  //==================================== Join the elements to any already found
2728  ret = joinElementsFromDifferentGroups ( &els, &ret, matrixTolerance, false );
2729  }
2730  }
2731 
2732  //============================================ Generate elements for all ten C3 axes next
2733  for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
2734  {
2735  //======================================== If this is a C3 axis
2736  if ( settings->allDetectedCAxes.at(axesList.at(grIt)).at(0) == 3 )
2737  {
2738  //==================================== Generate the elements
2739  std::vector<std::vector< proshade_double > > els = computeGroupElementsForGroup ( settings->allDetectedCAxes.at(axesList.at(grIt)).at(1),
2740  settings->allDetectedCAxes.at(axesList.at(grIt)).at(2),
2741  settings->allDetectedCAxes.at(axesList.at(grIt)).at(3),
2742  settings->allDetectedCAxes.at(axesList.at(grIt)).at(0) );
2743 
2744  //==================================== Join the elements to any already found
2745  ret = joinElementsFromDifferentGroups ( &els, &ret, matrixTolerance, false );
2746  }
2747  }
2748 
2749  //============================================ Generate elements for all fifteen C2 axes lastly
2750  for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
2751  {
2752  //======================================== If this is a C3 axis
2753  if ( settings->allDetectedCAxes.at(axesList.at(grIt)).at(0) == 2 )
2754  {
2755  //==================================== Generate the elements
2756  std::vector<std::vector< proshade_double > > els = computeGroupElementsForGroup ( settings->allDetectedCAxes.at(axesList.at(grIt)).at(1),
2757  settings->allDetectedCAxes.at(axesList.at(grIt)).at(2),
2758  settings->allDetectedCAxes.at(axesList.at(grIt)).at(3),
2759  settings->allDetectedCAxes.at(axesList.at(grIt)).at(0) );
2760 
2761  //==================================== Join the elements to any already found
2762  ret = joinElementsFromDifferentGroups ( &els, &ret, matrixTolerance, false );
2763  }
2764  }
2765 
2766  //============================================ Check the element to form a group
2767  if ( checkElementsFormGroup ( &ret, matrixTolerance ) ) { return ( ret ); }
2768  else
2769  {
2770  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." );
2771  }
2772  }
2773  else if ( groupType == "X" )
2774  {
2775  //============================================ User forced no checking for unspecified symmetry
2776  for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
2777  {
2778  //======================================== Compute group elements
2779  std::vector<std::vector< proshade_double > > els = computeGroupElementsForGroup ( settings->allDetectedCAxes.at(axesList.at(grIt)).at(1),
2780  settings->allDetectedCAxes.at(axesList.at(grIt)).at(2),
2781  settings->allDetectedCAxes.at(axesList.at(grIt)).at(3),
2782  settings->allDetectedCAxes.at(axesList.at(grIt)).at(0) );
2783 
2784  //======================================== Join the elements to any already found
2785  ret = joinElementsFromDifferentGroups ( &els, &ret, matrixTolerance, true );
2786  }
2787 
2788  //============================================ Check the element to form a group
2789  if ( checkElementsFormGroup ( &ret, matrixTolerance ) ) { return ( ret ); }
2790  else
2791  {
2792  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." );
2793  }
2794  }
2795  else
2796  {
2797  std::stringstream hlpSS;
2798  hlpSS << "Unknown symmetry type: >" << groupType << "<";
2799  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." );
2800  }
2801 
2802  //================================================ Done
2803  return ( ret );
2804 
2805 }
2806 
2814 void ProSHADE_internal_data::ProSHADE_data::deepCopyMap ( proshade_double*& saveTo, proshade_unsign verbose )
2815 {
2816  //================================================ Sanity check
2817  if ( saveTo != NULL )
2818  {
2819  ProSHADE_internal_messages::printWarningMessage ( verbose, "!!! ProSHADE WARNING !!! The deep copy pointer is not set to NULL. Cannot proceed and returning unmodified pointer.", "WB00040" );
2820  return ;
2821  }
2822 
2823  //================================================ Allocate the memory
2824  saveTo = new proshade_double[this->xDimIndices * this->yDimIndices * this->zDimIndices];
2825 
2826  //================================================ Check memory allocation
2827  ProSHADE_internal_misc::checkMemoryAllocation ( saveTo, __FILE__, __LINE__, __func__ );
2828 
2829  //================================================ Copy internal map to the new pointer
2830  for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
2831  {
2832  saveTo[iter] = this->internalMap[iter];
2833  }
2834 
2835  //================================================ Done
2836  return ;
2837 
2838 }
2839 
2847 {
2848  //================================================ Improve this!
2849  if ( settings->recommendedSymmetryType == "" )
2850  {
2851  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, "Did not detect any symmetry!" );
2852  }
2853  else
2854  {
2855  std::stringstream ssHlp;
2856  ssHlp << std::endl << "Detected " << settings->recommendedSymmetryType << " symmetry with fold " << settings->recommendedSymmetryFold << " .";
2857  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, ssHlp.str() );
2858 
2859  if ( settings->detectedSymmetry.size() > 0 )
2860  {
2861  ssHlp.clear(); ssHlp.str ( "" );
2862  ssHlp << " Fold X Y Z Angle Height";
2863  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, ssHlp.str() );
2864  }
2865  for ( proshade_unsign symIt = 0; symIt < static_cast<proshade_unsign> ( settings->detectedSymmetry.size() ); symIt++ )
2866  {
2867  ssHlp.clear(); ssHlp.str ( "" );
2868  ssHlp << std::showpos << std::fixed << std::setprecision(0) << " " << settings->detectedSymmetry.at(symIt)[0] << std::setprecision(5) << " " << settings->detectedSymmetry.at(symIt)[1] << " " << settings->detectedSymmetry.at(symIt)[2] << " " << settings->detectedSymmetry.at(symIt)[3] << " " << settings->detectedSymmetry.at(symIt)[4] << " " << settings->detectedSymmetry.at(symIt)[5];
2869  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, ssHlp.str() );
2870  }
2871 
2872  std::stringstream hlpSS3;
2873  ssHlp.clear(); ssHlp.str ( "" );
2874  hlpSS3 << std::endl << "However, since the selection of the recommended symmetry needs improvement, here is a list of all detected C symmetries:";
2875  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, hlpSS3.str() );
2876 
2877  if ( settings->allDetectedCAxes.size() > 0 )
2878  {
2879  ssHlp.clear(); ssHlp.str ( "" );
2880  ssHlp << " Fold X Y Z Angle Height";
2881  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, ssHlp.str() );
2882  }
2883  for ( proshade_unsign symIt = 0; symIt < static_cast<proshade_unsign> ( settings->allDetectedCAxes.size() ); symIt++ )
2884  {
2885  ssHlp.clear(); ssHlp.str ( "" );
2886  ssHlp << std::showpos << std::fixed << std::setprecision(0) << " " << settings->allDetectedCAxes.at(symIt)[0] << std::setprecision(5) << " " << settings->allDetectedCAxes.at(symIt)[1] << " " << settings->allDetectedCAxes.at(symIt)[2] << " " << settings->allDetectedCAxes.at(symIt)[3] << " " << settings->allDetectedCAxes.at(symIt)[4] << " " << settings->allDetectedCAxes.at(symIt)[5];
2887  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, ssHlp.str() );
2888  }
2889 
2890  hlpSS3.clear(); hlpSS3.str ( "" );
2891  hlpSS3 << std::endl << "Also, for the same reason, here is a list of all detected D symmetries:";
2892  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, hlpSS3.str() );
2893 
2894  if ( settings->allDetectedDAxes.size() > 0 )
2895  {
2896  ssHlp.clear(); ssHlp.str ( "" );
2897  ssHlp << " Fold X Y Z Angle Height";
2898  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, ssHlp.str() );
2899  }
2900  for ( proshade_unsign symIt = 0; symIt < static_cast<proshade_unsign> ( settings->allDetectedDAxes.size() ); symIt++ )
2901  {
2902  ssHlp.clear(); ssHlp.str ( "" );
2903  ssHlp << std::showpos << std::fixed << std::setprecision(0) << " " << settings->allDetectedCAxes.at(settings->allDetectedDAxes.at(symIt).at(0))[0] << std::setprecision(5) << " " << settings->allDetectedCAxes.at(settings->allDetectedDAxes.at(symIt).at(0))[1] << " " << settings->allDetectedCAxes.at(settings->allDetectedDAxes.at(symIt).at(0))[2] << " " << settings->allDetectedCAxes.at(settings->allDetectedDAxes.at(symIt).at(0))[3] << " " << settings->allDetectedCAxes.at(settings->allDetectedDAxes.at(symIt).at(0))[4] << " " << settings->allDetectedCAxes.at(settings->allDetectedDAxes.at(symIt).at(0))[5];
2904  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, ssHlp.str() );
2905 
2906  for ( proshade_unsign axIt = 1; axIt < static_cast<proshade_unsign> ( settings->allDetectedDAxes.at(symIt).size() ); axIt++ )
2907  {
2908  ssHlp.clear(); ssHlp.str ( "" );
2909  ssHlp << std::showpos << std::fixed << std::setprecision(0) << " " << settings->allDetectedCAxes.at(settings->allDetectedDAxes.at(symIt).at(axIt))[0] << std::setprecision(5) << " " << settings->allDetectedCAxes.at(settings->allDetectedDAxes.at(symIt).at(axIt))[1] << " " << settings->allDetectedCAxes.at(settings->allDetectedDAxes.at(symIt).at(axIt))[2] << " " << settings->allDetectedCAxes.at(settings->allDetectedDAxes.at(symIt).at(axIt))[3] << " " << settings->allDetectedCAxes.at(settings->allDetectedDAxes.at(symIt).at(axIt))[4] << " " << settings->allDetectedCAxes.at(settings->allDetectedDAxes.at(symIt).at(axIt))[5];
2910  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, ssHlp.str() );
2911  }
2912 
2913  ssHlp.clear(); ssHlp.str ( "" );
2914  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, ssHlp.str() );
2915  }
2916 
2917  }
2918 
2919  //================================================ Done
2920  return ;
2921 
2922 }
2923 
2929 {
2930  //================================================ Initialise variables
2931  this->xCom = 0.0;
2932  this->yCom = 0.0;
2933  this->zCom = 0.0;
2934  proshade_double totNonZeroPoints = 0.0;
2935  proshade_signed mapIt = 0;
2936 
2937  //================================================ Compute COM from 0 ; 0 ; 0
2938  for ( proshade_signed xIt = 0; xIt < static_cast<proshade_signed> ( this->xDimIndices ); xIt++ )
2939  {
2940  for ( proshade_signed yIt = 0; yIt < static_cast<proshade_signed> ( this->yDimIndices ); yIt++ )
2941  {
2942  for ( proshade_signed zIt = 0; zIt < static_cast<proshade_signed> ( this->zDimIndices ); zIt++ )
2943  {
2944  //==================================== Find map index
2945  mapIt = zIt + this->zDimIndices * ( yIt + this->yDimIndices * xIt );
2946 
2947  //==================================== Use only positive density
2948  if ( this->internalMap[mapIt] <= 0.0 ) { continue; }
2949 
2950  //==================================== Compute Index COM
2951  this->xCom += this->internalMap[mapIt] * static_cast<proshade_double> ( xIt + this->xFrom );
2952  this->yCom += this->internalMap[mapIt] * static_cast<proshade_double> ( yIt + this->yFrom );
2953  this->zCom += this->internalMap[mapIt] * static_cast<proshade_double> ( zIt + this->zFrom );
2954  totNonZeroPoints += this->internalMap[mapIt];
2955  }
2956  }
2957  }
2958 
2959  this->xCom /= totNonZeroPoints;
2960  this->yCom /= totNonZeroPoints;
2961  this->zCom /= totNonZeroPoints;
2962 
2963  //================================================ Convert to real world
2964  this->xCom = ( static_cast<proshade_double> ( this->xFrom ) * ( this->xDimSizeOriginal / static_cast<proshade_double> ( this->xDimIndicesOriginal ) ) ) +
2965  ( ( this->xCom - static_cast<proshade_double> ( this->xFrom ) ) *
2966  ( this->xDimSizeOriginal / static_cast<proshade_double> ( this->xDimIndicesOriginal ) ) );
2967  this->yCom = ( static_cast<proshade_double> ( this->yFrom ) * ( this->yDimSizeOriginal / static_cast<proshade_double> ( this->yDimIndicesOriginal ) ) ) +
2968  ( ( this->yCom - static_cast<proshade_double> ( this->yFrom ) ) *
2969  ( this->yDimSizeOriginal / static_cast<proshade_double> ( this->yDimIndicesOriginal ) ) );
2970  this->zCom = ( static_cast<proshade_double> ( this->zFrom ) * ( this->zDimSizeOriginal / static_cast<proshade_double> ( this->zDimIndicesOriginal ) ) ) +
2971  ( ( this->zCom - static_cast<proshade_double> ( this->zFrom ) ) *
2972  ( this->zDimSizeOriginal / static_cast<proshade_double> ( this->zDimIndicesOriginal ) ) );
2973 
2974  //================================================ Done
2975  return ;
2976 
2977 }
2978 
2984 {
2985  //================================================ Return the value
2986  return ( this->noSpheres );
2987 }
2988 
2994 proshade_double ProSHADE_internal_data::ProSHADE_data::getMapValue ( proshade_unsign pos )
2995 {
2996  //================================================ Return the value
2997  return ( this->internalMap[pos] );
2998 }
2999 
3005 {
3006  //================================================ Return the value
3007  return ( this->maxShellBand );
3008 }
3009 
3014 proshade_double ProSHADE_internal_data::ProSHADE_data::getRRPValue ( proshade_unsign band, proshade_unsign sh1, proshade_unsign sh2 )
3015 {
3016  //================================================ Return the value
3017  return ( this->rrpMatrices[band][sh1][sh2] );
3018 }
3019 
3030 bool ProSHADE_internal_data::ProSHADE_data::shellBandExists ( proshade_unsign shell, proshade_unsign bandVal )
3031 {
3032  if ( this->spheres[shell]->getLocalBandwidth( ) >= bandVal )
3033  {
3034  return ( true );
3035  }
3036  else
3037  {
3038  return ( false );
3039  }
3040 }
3041 
3051 {
3052  //================================================ Report function start
3053  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Centering map onto its COM." );
3054 
3055  //================================================ Copy map for processing
3056  fftw_complex* mapCoeffs = new fftw_complex[this->xDimIndices * this->yDimIndices * this->zDimIndices];
3057  fftw_complex* pattersonMap = new fftw_complex[this->xDimIndices * this->yDimIndices * this->zDimIndices];
3058 
3059  //================================================ Check memory allocation
3060  ProSHADE_internal_misc::checkMemoryAllocation ( mapCoeffs, __FILE__, __LINE__, __func__ );
3061  ProSHADE_internal_misc::checkMemoryAllocation ( pattersonMap, __FILE__, __LINE__, __func__ );
3062 
3063  //================================================ Copy data to mask
3064  for ( proshade_unsign iter = 0; iter < (this->xDimIndices * this->yDimIndices * this->zDimIndices); iter++ )
3065  {
3066  pattersonMap[iter][0] = this->internalMap[iter];
3067  pattersonMap[iter][1] = 0.0;
3068  }
3069 
3070  //================================================ Prepare FFTW plans
3071  fftw_plan forward = fftw_plan_dft_3d ( this->xDimIndices, this->yDimIndices, this->zDimIndices,
3072  pattersonMap, mapCoeffs, FFTW_FORWARD, FFTW_ESTIMATE );
3073  fftw_plan inverse = fftw_plan_dft_3d ( this->xDimIndices, this->yDimIndices, this->zDimIndices,
3074  mapCoeffs, pattersonMap, FFTW_BACKWARD, FFTW_ESTIMATE );
3075 
3076  //================================================ Run forward Fourier
3077  fftw_execute ( forward );
3078 
3079  //================================================ Remove the phase
3080  ProSHADE_internal_mapManip::removeMapPhase ( mapCoeffs, this->xDimIndices, this->yDimIndices, this->zDimIndices );
3081 
3082  //================================================ Run inverse Fourier
3083  fftw_execute ( inverse );
3084 
3085  //================================================ Save the results
3086  proshade_signed mapIt, patIt, patX, patY, patZ;
3087  for ( proshade_signed xIt = 0; xIt < static_cast<proshade_signed> ( this->xDimIndices ); xIt++ )
3088  {
3089  for ( proshade_signed yIt = 0; yIt < static_cast<proshade_signed> ( this->yDimIndices ); yIt++ )
3090  {
3091  for ( proshade_signed zIt = 0; zIt < static_cast<proshade_signed> ( this->zDimIndices ); zIt++ )
3092  {
3093  //==================================== Centre patterson map
3094  patX = xIt - ( static_cast<proshade_signed> ( this->xDimIndices ) / 2 ); if ( patX < 0 ) { patX += this->xDimIndices; }
3095  patY = yIt - ( static_cast<proshade_signed> ( this->yDimIndices ) / 2 ); if ( patY < 0 ) { patY += this->yDimIndices; }
3096  patZ = zIt - ( static_cast<proshade_signed> ( this->zDimIndices ) / 2 ); if ( patZ < 0 ) { patZ += this->zDimIndices; }
3097 
3098  //==================================== Find indices
3099  mapIt = zIt + this->zDimIndices * ( yIt + this->yDimIndices * xIt );
3100  patIt = patZ + this->zDimIndices * ( patY + this->yDimIndices * patX );
3101 
3102  //==================================== Copy
3103  this->internalMap[mapIt] = pattersonMap[patIt][0];
3104  }
3105  }
3106  }
3107 
3108  //================================================ Release memory
3109  delete[] pattersonMap;
3110  delete[] mapCoeffs;
3111 
3112  //================================================ Delete FFTW plans
3113  fftw_destroy_plan ( forward );
3114  fftw_destroy_plan ( inverse );
3115 
3116  //================================================ Report function completion
3117  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 2, "Phase information removed." );
3118 
3119  //================================================ Done
3120  return ;
3121 
3122 }
3123 
3128 proshade_double* ProSHADE_internal_data::ProSHADE_data::getRealSphHarmValue ( proshade_unsign band, proshade_unsign order, proshade_unsign shell )
3129 {
3130  //================================================ Done
3131  return ( &this->sphericalHarmonics[shell][seanindex ( static_cast<proshade_signed> ( order ) - static_cast<proshade_signed> ( band ),
3132  band,
3133  this->spheres[shell]->getLocalBandwidth() )][0] );
3134 
3135 }
3136 
3141 proshade_double* ProSHADE_internal_data::ProSHADE_data::getImagSphHarmValue ( proshade_unsign band, proshade_unsign order, proshade_unsign shell )
3142 {
3143  //================================================ Done
3144  return ( &this->sphericalHarmonics[shell][seanindex ( static_cast<proshade_signed> ( order ) - static_cast<proshade_signed> ( band ),
3145  band,
3146  this->spheres[shell]->getLocalBandwidth() )][1] );
3147 
3148 }
3149 
3154 proshade_double ProSHADE_internal_data::ProSHADE_data::getAnySphereRadius ( proshade_unsign shell )
3155 {
3156  //================================================ Done
3157  return ( this->spheres[shell]->getShellRadius() );
3158 
3159 }
3160 
3166 {
3167  //================================================ Done
3168  return ( this->integrationWeight );
3169 
3170 }
3171 
3177 proshade_unsign ProSHADE_internal_data::ProSHADE_data::getShellBandwidth ( proshade_unsign shell )
3178 {
3179  //================================================ Done
3180  return ( this->spheres[shell]->getLocalBandwidth ( ) );
3181 
3182 }
3183 
3189 proshade_double ProSHADE_internal_data::ProSHADE_data::getSpherePosValue ( proshade_unsign shell )
3190 {
3191  //================================================ Done
3192  return ( this->spherePos.at(shell) );
3193 
3194 }
3195 
3201 proshade_complex** ProSHADE_internal_data::ProSHADE_data::getEMatrixByBand ( proshade_unsign band )
3202 {
3203  //================================================ Done
3204  return ( this->eMatrices[band] );
3205 
3206 }
3207 
3216 void ProSHADE_internal_data::ProSHADE_data::getEMatrixValue ( proshade_unsign band, proshade_unsign order1, proshade_unsign order2, proshade_double* valueReal, proshade_double* valueImag )
3217 {
3218  //================================================ Set pointer
3219  *valueReal = this->eMatrices[band][order1][order2][0];
3220  *valueImag = this->eMatrices[band][order1][order2][1];
3221 
3222  //================================================ Done
3223  return ;
3224 
3225 }
3226 
3232 {
3233  //================================================ Done
3234  return ( this->so3CoeffsInverse );
3235 
3236 }
3237 
3243 {
3244  //================================================ Done
3245  return ( this->so3Coeffs );
3246 
3247 }
3248 
3254 {
3255  //================================================ Done
3256  return ( this->maxCompBand );
3257 
3258 }
3259 
3268 void ProSHADE_internal_data::ProSHADE_data::getWignerMatrixValue ( proshade_unsign band, proshade_unsign order1, proshade_unsign order2, proshade_double* valueReal, proshade_double* valueImag )
3269 {
3270  //================================================ Set pointer
3271  *valueReal = this->wignerMatrices[band][order1][order2][0];
3272  *valueImag = this->wignerMatrices[band][order1][order2][1];
3273 
3274  //================================================ Done
3275  return ;
3276 
3277 }
3278 
3284 {
3285  //================================================ Return the requested value
3286  return ( this->xDimSize );
3287 }
3288 
3294 {
3295  //================================================ Return the requested value
3296  return ( this->yDimSize );
3297 }
3298 
3304 {
3305  //================================================ Return the requested value
3306  return ( this->zDimSize );
3307 }
3308 
3314 {
3315  //================================================ Return the requested value
3316  return ( this->xDimIndices );
3317 }
3318 
3324 {
3325  //================================================ Return the requested value
3326  return ( this->yDimIndices );
3327 }
3328 
3334 {
3335  //================================================ Return the requested value
3336  return ( this->zDimIndices );
3337 }
3338 
3344 {
3345  //================================================ Return the requested value
3346  return ( &this->xFrom );
3347 }
3348 
3354 {
3355  //================================================ Return the requested value
3356  return ( &this->yFrom );
3357 }
3358 
3364 {
3365  //================================================ Return the requested value
3366  return ( &this->zFrom );
3367 }
3368 
3374 {
3375  //================================================ Return the requested value
3376  return ( &this->xTo );
3377 }
3378 
3384 {
3385  //================================================ Return the requested value
3386  return ( &this->yTo );
3387 }
3388 
3394 {
3395  //================================================ Return the requested value
3396  return ( &this->zTo );
3397 }
3398 
3404 {
3405  //================================================ Return the requested value
3406  return ( &this->xAxisOrigin );
3407 }
3408 
3414 {
3415  //================================================ Return the requested value
3416  return ( &this->yAxisOrigin );
3417 }
3418 
3424 {
3425  //================================================ Return the requested value
3426  return ( &this->zAxisOrigin );
3427 }
3428 
3434 {
3435  //================================================ Return the requested value
3436  return ( this->internalMap );
3437 }
3438 
3444 {
3445  //================================================ Return the requested value
3446  return ( this->translationMap );
3447 }
3448 
3454 {
3455  //================================================ Mutate
3456  this->integrationWeight = intW;
3457 
3458  //================================================ Done
3459  return ;
3460 
3461 }
3462 
3468 {
3469  //================================================ Mutate
3470  this->integrationWeight += intW;
3471 
3472  //================================================ Done
3473  return ;
3474 
3475 }
3476 
3484 void ProSHADE_internal_data::ProSHADE_data::setEMatrixValue ( proshade_unsign band, proshade_unsign order1, proshade_unsign order2, proshade_complex val )
3485 {
3486  //================================================ Mutate
3487  this->eMatrices[band][order1][order2][0] = val[0];
3488  this->eMatrices[band][order1][order2][1] = val[1];
3489 
3490  //================================================ Done
3491  return ;
3492 
3493 }
3494 
3502 void ProSHADE_internal_data::ProSHADE_data::normaliseEMatrixValue ( proshade_unsign band, proshade_unsign order1, proshade_unsign order2, proshade_double normF )
3503 {
3504  //================================================ Mutate
3505  this->eMatrices[band][order1][order2][0] /= normF;
3506  this->eMatrices[band][order1][order2][1] /= normF;
3507 
3508  //================================================ Done
3509  return ;
3510 
3511 }
3512 
3518 void ProSHADE_internal_data::ProSHADE_data::setSO3CoeffValue ( proshade_unsign position, proshade_complex val )
3519 {
3520  //================================================ Mutate
3521  this->so3Coeffs[position][0] = val[0];
3522  this->so3Coeffs[position][1] = val[1];
3523 
3524  //================================================ Done
3525  return ;
3526 
3527 }
3528 
3536 void ProSHADE_internal_data::ProSHADE_data::setWignerMatrixValue ( proshade_complex val, proshade_unsign band, proshade_unsign order1, proshade_unsign order2 )
3537 {
3538  //================================================ Mutate
3539  this->wignerMatrices[band][order1][order2][0] = val[0];
3540  this->wignerMatrices[band][order1][order2][1] = val[1];
3541 
3542  //================================================ Done
3543  return ;
3544 
3545 }
3546 
3554 void ProSHADE_internal_data::ProSHADE_data::getRealEMatrixValuesForLM ( proshade_signed band, proshade_signed order1, double *eMatsLMReal, int len )
3555 {
3556  //================================================ Save the data into the output array
3557  for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
3558  {
3559  eMatsLMReal[iter] = static_cast<double> ( this->eMatrices[band][order1][iter][0] );
3560  }
3561 
3562  //================================================ Done
3563  return ;
3564 
3565 }
3566 
3574 void ProSHADE_internal_data::ProSHADE_data::getImagEMatrixValuesForLM ( proshade_signed band, proshade_signed order1, double *eMatsLMImag, int len )
3575 {
3576  //================================================ Save the data into the output array
3577  for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
3578  {
3579  eMatsLMImag[iter] = static_cast<double> ( this->eMatrices[band][order1][iter][1] );
3580  }
3581 
3582  //================================================ Done
3583  return ;
3584 
3585 }
3586 
3592 void ProSHADE_internal_data::ProSHADE_data::getRealSO3Coeffs ( double *so3CoefsReal, int len )
3593 {
3594  //================================================ Save the data into the output array
3595  for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
3596  {
3597  so3CoefsReal[iter] = static_cast<double> ( this->so3Coeffs[iter][0] );
3598  }
3599 
3600  //================================================ Done
3601  return ;
3602 
3603 }
3604 
3610 void ProSHADE_internal_data::ProSHADE_data::getImagSO3Coeffs ( double *so3CoefsImag, int len )
3611 {
3612  //================================================ Save the data into the output array
3613  for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
3614  {
3615  so3CoefsImag[iter] = static_cast<double> ( this->so3Coeffs[iter][1] );
3616  }
3617 
3618  //================================================ Done
3619  return ;
3620 
3621 }
3622 
3632 int ProSHADE_internal_data::ProSHADE_data::so3CoeffsArrayIndex ( proshade_signed order1, proshade_signed order2, proshade_signed band )
3633 {
3634  //================================================ Return the value
3635  return ( static_cast<int> ( so3CoefLoc ( order1, order2, band, this->getMaxBand() ) ) );
3636 }
3637 
3644 {
3645  //================================================ Save the data into the output array
3646  for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
3647  {
3648  rotFunReal[iter] = static_cast<double> ( this->so3CoeffsInverse[iter][0] );
3649  }
3650 
3651  //================================================ Done
3652  return ;
3653 
3654 }
3655 
3662 {
3663  //================================================ Save the data into the output array
3664  for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
3665  {
3666  rotFunImag[iter] = static_cast<double> ( this->so3CoeffsInverse[iter][1] );
3667  }
3668 
3669  //================================================ Done
3670  return ;
3671 
3672 }
3673 
3680 {
3681  //================================================ Save the data into the output array
3682  for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
3683  {
3684  trsFunReal[iter] = static_cast<double> ( this->translationMap[iter][0] );
3685  }
3686 
3687  //================================================ Done
3688  return ;
3689 
3690 }
3691 
3698 {
3699  //================================================ Save the data into the output array
3700  for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
3701  {
3702  trsFunImag[iter] = static_cast<double> ( this->translationMap[iter][1] );
3703  }
3704 
3705  //================================================ Done
3706  return ;
3707 
3708 }
3709 
3718 void ProSHADE_internal_data::ProSHADE_data::getRotMatrixFromRotFunInds ( proshade_signed aI, proshade_signed bI, proshade_signed gI, double *rotMat, int len )
3719 {
3720  //================================================ Get Euler angles
3721  proshade_double eA, eB, eG;
3722  ProSHADE_internal_maths::getEulerZXZFromSOFTPosition ( this->getMaxBand(), aI, bI, gI, &eA, &eB, &eG );
3723 
3724  //================================================ Prepare internal rotation matrix memory
3725  proshade_double* rMat = NULL;
3726  rMat = new proshade_double[9];
3727  ProSHADE_internal_misc::checkMemoryAllocation ( rMat, __FILE__, __LINE__, __func__ );
3728 
3729  //================================================ Convert to rotation matrix
3731 
3732  //================================================ Copy to output
3733  for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
3734  {
3735  rotMat[iter] = static_cast<double> ( rMat[iter] );
3736  }
3737 
3738  //================================================ Release internal memory
3739  delete[] rMat;
3740 
3741  //================================================ Done
3742  return ;
3743 
3744 }
3745 
3751 {
3752  //================================================ Return the value
3753  return ( settings->recommendedSymmetryType );
3754 
3755 }
3756 
3762 {
3763  //================================================ Return the value
3764  return ( settings->recommendedSymmetryFold );
3765 
3766 }
3767 
3774 {
3775  //================================================ Return the value
3776  return ( static_cast<proshade_unsign> ( settings->detectedSymmetry.size() ) );
3777 }
3778 
3785 std::vector< std::string > ProSHADE_internal_data::ProSHADE_data::getSymmetryAxis ( ProSHADE_settings* settings, proshade_unsign axisNo )
3786 {
3787  //================================================ Sanity checks
3788  if ( static_cast<proshade_unsign> ( settings->detectedSymmetry.size() ) <= axisNo )
3789  {
3790  ProSHADE_internal_messages::printWarningMessage ( settings->verbose, "!!! ProSHADE WARNING !!! Requested symmetry index does not exist. Returning empty vector.", "WS00039" );
3791  return ( std::vector< std::string > ( ) );
3792  }
3793 
3794  //================================================ Initialise local variables
3795  std::vector< std::string > ret;
3796 
3797  //================================================ Input the axis data as strings
3798  std::stringstream ssHlp;
3799  ssHlp << settings->detectedSymmetry.at(axisNo)[0];
3800  ProSHADE_internal_misc::addToStringVector ( &ret, ssHlp.str() );
3801  ssHlp.str ( "" );
3802 
3803  ssHlp << settings->detectedSymmetry.at(axisNo)[1];
3804  ProSHADE_internal_misc::addToStringVector ( &ret, ssHlp.str() );
3805  ssHlp.str ( "" );
3806 
3807  ssHlp << settings->detectedSymmetry.at(axisNo)[2];
3808  ProSHADE_internal_misc::addToStringVector ( &ret, ssHlp.str() );
3809  ssHlp.str ( "" );
3810 
3811  ssHlp << settings->detectedSymmetry.at(axisNo)[3];
3812  ProSHADE_internal_misc::addToStringVector ( &ret, ssHlp.str() );
3813  ssHlp.str ( "" );
3814 
3815  ssHlp << settings->detectedSymmetry.at(axisNo)[4];
3816  ProSHADE_internal_misc::addToStringVector ( &ret, ssHlp.str() );
3817  ssHlp.str ( "" );
3818 
3819  ssHlp << settings->detectedSymmetry.at(axisNo)[5];
3820  ProSHADE_internal_misc::addToStringVector ( &ret, ssHlp.str() );
3821  ssHlp.str ( "" );
3822 
3823  //================================================ Done
3824  return ( ret );
3825 
3826 }
3827 
3840 void ProSHADE_internal_data::ProSHADE_data::writeOutOverlayFiles ( ProSHADE_settings* settings, proshade_double eulA, proshade_double eulB, proshade_double eulG, std::vector< proshade_double >* rotCentre, std::vector< proshade_double >* ultimateTranslation )
3841 {
3842  //================================================ Write out rotated map
3843  std::stringstream fNameHlp;
3844  fNameHlp << settings->overlayStructureName << ".map";
3845  this->writeMap ( fNameHlp.str() );
3846 
3847  //================================================ Write out rotated co-ordinates if possible
3848  if ( ProSHADE_internal_io::isFilePDB ( this->fileName ) )
3849  {
3850  fNameHlp.str("");
3851  fNameHlp << settings->overlayStructureName << ".pdb";
3852  this->writePdb ( fNameHlp.str(), eulA, eulB, eulG, ultimateTranslation->at(0), ultimateTranslation->at(1), ultimateTranslation->at(2), settings->firstModelOnly );
3853  }
3854 
3855  //================================================ Write out the json file with the results
3856  ProSHADE_internal_io::writeRotationTranslationJSON ( rotCentre->at(0), rotCentre->at(1), rotCentre->at(2),
3857  eulA, eulB, eulG,
3858  ultimateTranslation->at(0), ultimateTranslation->at(1), ultimateTranslation->at(2),
3859  settings->rotTrsJSONFile );
3860 
3861  //================================================ Done
3862  return ;
3863 
3864 }
3865 
3874 void ProSHADE_internal_data::ProSHADE_data::reportOverlayResults ( ProSHADE_settings* settings, std::vector < proshade_double >* rotationCentre, std::vector < proshade_double >* eulerAngles, std::vector < proshade_double >* finalTranslation )
3875 {
3876  //================================================ Empty line
3878 
3879  //================================================ Write out rotation centre translation results
3880  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);
3881  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, rotCen.str() );
3882 
3883  //================================================ Write out rotation matrix about origin
3884  proshade_double* rotMat = new proshade_double[9];
3885  ProSHADE_internal_misc::checkMemoryAllocation ( rotMat, __FILE__, __LINE__, __func__ );
3886  ProSHADE_internal_maths::getRotationMatrixFromEulerZXZAngles ( eulerAngles->at(0), eulerAngles->at(1), eulerAngles->at(2), rotMat );
3887 
3888  std::stringstream rotMatSS;
3889  rotMatSS << std::setprecision (3) << std::showpos << "The rotation matrix about origin is : " << rotMat[0] << " " << rotMat[1] << " " << rotMat[2] << std::endl;
3890  rotMatSS << std::setprecision (3) << std::showpos << " : " << rotMat[3] << " " << rotMat[4] << " " << rotMat[5] << std::endl;
3891  rotMatSS << std::setprecision (3) << std::showpos << " : " << rotMat[6] << " " << rotMat[7] << " " << rotMat[8];
3892  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, rotMatSS.str() );
3893 
3894  delete[] rotMat;
3895 
3896  //================================================ Write out origin to overlay translation results
3897  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);
3898  ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, finTrs.str() );
3899 
3900  //================================================ Done
3901  return ;
3902 
3903 }
ProSHADE_internal_data::ProSHADE_data::originalMapYCom
proshade_double originalMapYCom
The COM of the first map to be loaded/computed without any furhter changes being reflacted along the ...
Definition: ProSHADE_data.hpp:92
ProSHADE_settings::maxBandwidth
proshade_unsign maxBandwidth
The bandwidth of spherical harmonics decomposition for the largest sphere.
Definition: ProSHADE_settings.hpp:109
ProSHADE_internal_mapManip::addExtraBoundSpace
void addExtraBoundSpace(proshade_unsign xDim, proshade_unsign yDim, proshade_unsign zDim, proshade_single xAngs, proshade_single yAngs, proshade_single zAngs, proshade_signed *&bounds, proshade_single extraSpace)
This function takes a set of bounds and adds a given number of Angstroms to them.
Definition: ProSHADE_mapManip.cpp:1122
ProSHADE_internal_data::ProSHADE_data::computeSphericalHarmonics
void computeSphericalHarmonics(ProSHADE_settings *settings)
This function computes the spherical harmonics decomposition for the whole structure.
Definition: ProSHADE_data.cpp:1608
ProSHADE_internal_data::ProSHADE_data::mapMovFromsChangeX
proshade_double mapMovFromsChangeX
When the map is translated, the xFrom and xTo values are changed. This variable holds how much they h...
Definition: ProSHADE_data.hpp:94
ProSHADE_settings::recommendedSymmetryType
std::string recommendedSymmetryType
The symmetry type that ProSHADE finds the best fitting for the structure. Possible values are "" for ...
Definition: ProSHADE_settings.hpp:175
ProSHADE_internal_data::ProSHADE_data::getEMatrixByBand
proshade_complex ** getEMatrixByBand(proshade_unsign band)
This function allows access to E matrix for a particular band.
Definition: ProSHADE_data.cpp:3201
ProSHADE_internal_mapManip::determinePDBRanges
void determinePDBRanges(gemmi::Structure pdbFile, proshade_single *xFrom, proshade_single *xTo, proshade_single *yFrom, proshade_single *yTo, proshade_single *zFrom, proshade_single *zTo, bool firstModel)
Function for finding the PDB file ranges.
Definition: ProSHADE_mapManip.cpp:57
ProSHADE_internal_data::ProSHADE_data::fileName
std::string fileName
This is the original file from which the data were obtained.
Definition: ProSHADE_data.hpp:52
ProSHADE_internal_data::ProSHADE_data::zFrom
proshade_signed zFrom
This is the starting index along the z axis.
Definition: ProSHADE_data.hpp:112
ProSHADE_settings::rotTrsJSONFile
std::string rotTrsJSONFile
The filename to which the rotation and translation operations are to be saved into.
Definition: ProSHADE_settings.hpp:185
ProSHADE_internal_data::ProSHADE_data::xDimIndices
proshade_unsign xDimIndices
This is the size of the map cell x dimension in indices.
Definition: ProSHADE_data.hpp:65
ProSHADE_internal_data::ProSHADE_data::getZDimSize
proshade_single getZDimSize(void)
This function allows access to the map size in angstroms along the Z axis.
Definition: ProSHADE_data.cpp:3303
ProSHADE_internal_mapManip::changePDBBFactors
void changePDBBFactors(gemmi::Structure *pdbFile, proshade_double newBFactorValue, bool firstModel)
Function for changing the PDB B-factor values to a specific single value.
Definition: ProSHADE_mapManip.cpp:425
ProSHADE_internal_data::ProSHADE_data::zDimSizeOriginal
proshade_single zDimSizeOriginal
This is the size of the map cell z dimension in Angstroms.
Definition: ProSHADE_data.hpp:84
ProSHADE_internal_maths::vectorMeanAndSD
void vectorMeanAndSD(std::vector< proshade_double > *vec, proshade_double *&ret)
Function to get vector mean and standard deviation.
Definition: ProSHADE_maths.cpp:121
ProSHADE_internal_data::ProSHADE_data::createNewMapFromBounds
void createNewMapFromBounds(ProSHADE_settings *settings, ProSHADE_data *&newStr, proshade_signed *newBounds)
This function creates a new structure from the calling structure and new bounds values.
Definition: ProSHADE_data.cpp:1156
ProSHADE_internal_io::isFilePDB
bool isFilePDB(std::string fName)
Function determining if the input data type is PDB.
Definition: ProSHADE_io.cpp:32
ProSHADE_internal_data::ProSHADE_data::xGridIndices
proshade_unsign xGridIndices
As far as I know, this is identical to the xDimIndices.
Definition: ProSHADE_data.hpp:68
ProSHADE_internal_data::ProSHADE_data::translationMap
proshade_complex * translationMap
This is where the translation map will be held, if at all used.
Definition: ProSHADE_data.hpp:133
ProSHADE_internal_data::joinElementsFromDifferentGroups
std::vector< std::vector< proshade_double > > joinElementsFromDifferentGroups(std::vector< std::vector< proshade_double > > *first, std::vector< std::vector< proshade_double > > *second, proshade_double matrixTolerance, bool combine)
This function joins two group element lists using only unique elements.
Definition: ProSHADE_data.cpp:2486
ProSHADE_internal_data::ProSHADE_data::xAxisOrder
proshade_unsign xAxisOrder
This is the order of the x axis.
Definition: ProSHADE_data.hpp:71
ProSHADE_internal_data::ProSHADE_data::rotSphericalHarmonics
proshade_complex ** rotSphericalHarmonics
A set of rotated spherical harmonics values arrays for each sphere, used only if map rotation is requ...
Definition: ProSHADE_data.hpp:122
ProSHADE_internal_data::ProSHADE_data::getReBoxBoundaries
void getReBoxBoundaries(ProSHADE_settings *settings, proshade_signed *&ret)
This function finds the boundaries enclosing positive map values and adds some extra space.
Definition: ProSHADE_data.cpp:1101
ProSHADE_internal_data::ProSHADE_data::findIScore
proshade_double findIScore(std::vector< proshade_double * > *ISym)
This function takes the list of icosahedral axes and returns a score for deciding whether I symmetry ...
Definition: ProSHADE_data.cpp:2096
ProSHADE_internal_data::ProSHADE_data::getComparisonBand
proshade_unsign getComparisonBand(void)
This function allows access to the maximum band for the comparison.
Definition: ProSHADE_data.cpp:3253
ProSHADE_internal_data::ProSHADE_data::getRecommendedSymmetryFold
proshade_unsign getRecommendedSymmetryFold(ProSHADE_settings *settings)
This function simply returns the detected recommended symmetry fold.
Definition: ProSHADE_data.cpp:3761
ProSHADE_internal_data::ProSHADE_data::sphericalHarmonics
proshade_complex ** sphericalHarmonics
A set of spherical harmonics values arrays for each sphere.
Definition: ProSHADE_data.hpp:121
ProSHADE_internal_data::ProSHADE_data::setIntegrationWeight
void setIntegrationWeight(proshade_double intW)
This function allows setting the integration weight for the object.
Definition: ProSHADE_data.cpp:3453
ProSHADE_internal_data::ProSHADE_data::cAngle
proshade_single cAngle
This is the angle c of the map cell in degrees.
Definition: ProSHADE_data.hpp:64
ProSHADE_internal_data::ProSHADE_data::so3CoeffsInverse
proshade_complex * so3CoeffsInverse
The inverse coefficients obtained by inverse SO(3) Fourier Transform (SOFT) - i.e....
Definition: ProSHADE_data.hpp:130
ProSHADE_internal_data::ProSHADE_data::saveRequestedSymmetryD
void saveRequestedSymmetryD(ProSHADE_settings *settings, std::vector< proshade_double * > *DSym, std::vector< proshade_double * > *axes)
This function takes the D symmetries and searched for the requested symmetry.
Definition: ProSHADE_data.cpp:2280
ProSHADE_internal_data::ProSHADE_data::getXAxisOrigin
proshade_signed * getXAxisOrigin(void)
This function allows access to the map X axis origin value.
Definition: ProSHADE_data.cpp:3403
ProSHADE_internal_data::ProSHADE_data::normaliseEMatrixValue
void normaliseEMatrixValue(proshade_unsign band, proshade_unsign order1, proshade_unsign order2, proshade_double normF)
This function allows normalising the E matrix value.
Definition: ProSHADE_data.cpp:3502
ProSHADE_internal_data::ProSHADE_data::yCom
proshade_double yCom
The COM of the map after processing along the Y-axis.
Definition: ProSHADE_data.hpp:78
ProSHADE_settings::boundsExtraSpace
proshade_single boundsExtraSpace
The number of extra angstroms to be added to all re-boxing bounds just for safety.
Definition: ProSHADE_settings.hpp:140
ProSHADE_exception
This class is the representation of ProSHADE exception.
Definition: ProSHADE_exceptions.hpp:37
ProSHADE_internal_data::ProSHADE_data::getImagTranslationFunction
void getImagTranslationFunction(double *trsFunImag, int len)
This function fills the input array with the imaginary translation function values.
Definition: ProSHADE_data.cpp:3697
ProSHADE_internal_data::ProSHADE_data::setWignerMatrixValue
void setWignerMatrixValue(proshade_complex val, proshade_unsign band, proshade_unsign order1, proshade_unsign order2)
This function allows setting the Wigner D matrix value by its band, order1 and order2 co-ordinate.
Definition: ProSHADE_data.cpp:3536
ProSHADE_settings::allDetectedDAxes
std::vector< std::vector< proshade_unsign > > allDetectedDAxes
The vector of all detected dihedral symmetry axes indices in allDetectedCAxes.
Definition: ProSHADE_settings.hpp:194
ProSHADE_settings::blurFactor
proshade_single blurFactor
This is the amount by which B-factors should be increased to create the blurred map for masking.
Definition: ProSHADE_settings.hpp:129
ProSHADE_internal_data::ProSHADE_data::saveDetectedSymmetries
void saveDetectedSymmetries(ProSHADE_settings *settings, std::vector< proshade_double * > *CSyms, std::vector< std::vector< proshade_double > > *allCs)
This function takes the results of point group searches and saves then into the output variables.
Definition: ProSHADE_data.cpp:1896
ProSHADE_settings::maskMap
bool maskMap
Should the map be masked from noise?
Definition: ProSHADE_settings.hpp:131
ProSHADE_settings::requestedSymmetryFold
proshade_unsign requestedSymmetryFold
The fold of the requested symmetry (only applicable to C and D symmetry types).
Definition: ProSHADE_settings.hpp:178
ProSHADE_settings::requestedSymmetryType
std::string requestedSymmetryType
The symmetry type requested by the user. Allowed values are C, D, T, O and I.
Definition: ProSHADE_settings.hpp:177
ProSHADE_internal_data::ProSHADE_data::getEMatrixValue
void getEMatrixValue(proshade_unsign band, proshade_unsign order1, proshade_unsign order2, proshade_double *valueReal, proshade_double *valueImag)
This function allows access to E matrix by knowing the band, order1 and order2 indices.
Definition: ProSHADE_data.cpp:3216
ProSHADE_internal_data::ProSHADE_data::getXDimSize
proshade_single getXDimSize(void)
This function allows access to the map size in angstroms along the X axis.
Definition: ProSHADE_data.cpp:3283
ProSHADE_internal_data::ProSHADE_data::getInternalMap
proshade_double *& getInternalMap(void)
This function allows access to the first map array value address.
Definition: ProSHADE_data.cpp:3433
ProSHADE_internal_data::ProSHADE_data
This class contains all inputed and derived data for a single structure.
Definition: ProSHADE_data.hpp:49
ProSHADE_internal_data::ProSHADE_data::noSpheres
proshade_unsign noSpheres
The number of spheres with map projected onto them.
Definition: ProSHADE_data.hpp:119
ProSHADE_internal_data::ProSHADE_data::getYDimSize
proshade_single getYDimSize(void)
This function allows access to the map size in angstroms along the Y axis.
Definition: ProSHADE_data.cpp:3293
ProSHADE_internal_mapManip::getMaskFromBlurr
void getMaskFromBlurr(proshade_double *&blurMap, proshade_double *&outMap, proshade_unsign xDimS, proshade_unsign yDimS, proshade_unsign zDimS, proshade_single noIQRs)
Function for computing mask from blurred map.
Definition: ProSHADE_mapManip.cpp:1012
ProSHADE_internal_data::ProSHADE_data::zDimSize
proshade_single zDimSize
This is the size of the map cell z dimension in Angstroms.
Definition: ProSHADE_data.hpp:61
ProSHADE_internal_data::ProSHADE_data::so3Coeffs
proshade_complex * so3Coeffs
The coefficients obtained by SO(3) Fourier Transform (SOFT), in this case derived from the E matrices...
Definition: ProSHADE_data.hpp:129
ProSHADE_internal_data::ProSHADE_data::getMaxSpheres
proshade_unsign getMaxSpheres(void)
This function returns the number of spheres which contain the whole object.
Definition: ProSHADE_data.cpp:2983
ProSHADE_internal_data::ProSHADE_data::setSO3CoeffValue
void setSO3CoeffValue(proshade_unsign position, proshade_complex val)
This function allows setting the SOFT coefficient values using array position and value.
Definition: ProSHADE_data.cpp:3518
ProSHADE_settings::saveMask
bool saveMask
Should the mask be saved?
Definition: ProSHADE_settings.hpp:135
ProSHADE_settings::requestedResolution
proshade_single requestedResolution
The resolution to which the calculations are to be done.
Definition: ProSHADE_settings.hpp:101
ProSHADE_internal_data::ProSHADE_data::mapCOMProcessChangeX
proshade_double mapCOMProcessChangeX
The change in X axis between the creation of the structure (originalMapXCom) and just before rotation...
Definition: ProSHADE_data.hpp:97
ProSHADE_internal_mapManip::findMAPCOMValues
void findMAPCOMValues(proshade_double *map, proshade_double *xCom, proshade_double *yCom, proshade_double *zCom, proshade_single xAngs, proshade_single yAngs, proshade_single zAngs, proshade_signed xFrom, proshade_signed xTo, proshade_signed yFrom, proshade_signed yTo, proshade_signed zFrom, proshade_signed zTo)
This function finds the Centre of Mass for a map.
Definition: ProSHADE_mapManip.cpp:225
ProSHADE_internal_mapManip::blurSharpenMap
void blurSharpenMap(proshade_double *&map, proshade_double *&maskedMap, proshade_unsign xDimS, proshade_unsign yDimS, proshade_unsign zDimS, proshade_single xAngs, proshade_single yAngs, proshade_single zAngs, proshade_single blurringFactor)
Function for blurring/sharpening maps.
Definition: ProSHADE_mapManip.cpp:912
ProSHADE_internal_data::ProSHADE_data::originalMapXCom
proshade_double originalMapXCom
The COM of the first map to be loaded/computed without any furhter changes being reflacted along the ...
Definition: ProSHADE_data.hpp:91
ProSHADE_internal_data::ProSHADE_data::getRotMatrixFromRotFunInds
void getRotMatrixFromRotFunInds(proshade_signed aI, proshade_signed bI, proshade_signed gI, double *rotMat, int len)
This function takes rotation function indices, converts them to Euler angles and these to rotation ma...
Definition: ProSHADE_data.cpp:3718
ProSHADE_settings::setDetectedSymmetry
void setDetectedSymmetry(proshade_double *sym)
Sets the final detected symmetry axes information.
Definition: ProSHADE.cpp:1077
ProSHADE_internal_data::ProSHADE_data::xDimIndicesOriginal
proshade_unsign xDimIndicesOriginal
This is the size of the map cell x dimension in indices.
Definition: ProSHADE_data.hpp:85
ProSHADE_internal_mapManip::moveMapByFourier
void moveMapByFourier(proshade_double *&map, proshade_single xMov, proshade_single yMov, proshade_single zMov, proshade_single xAngs, proshade_single yAngs, proshade_single zAngs, proshade_signed xDim, proshade_signed yDim, proshade_signed zDim)
Function for moving map back to original PDB location by using Fourier transformation.
Definition: ProSHADE_mapManip.cpp:792
ProSHADE_internal_data::ProSHADE_data::getAnySphereRadius
proshade_double getAnySphereRadius(proshade_unsign shell)
This function allows access to the radius of any particular sphere.
Definition: ProSHADE_data.cpp:3154
ProSHADE_settings::progressiveSphereMapping
bool progressiveSphereMapping
If true, each shell will have its own angular resolution dependent on the actual number of map points...
Definition: ProSHADE_settings.hpp:152
ProSHADE_internal_mapManip::movePDBForMapCalc
void movePDBForMapCalc(gemmi::Structure *pdbFile, proshade_single xMov, proshade_single yMov, proshade_single zMov, bool firstModel)
Function for moving co-ordinate atoms to better suit theoretical map computation.
Definition: ProSHADE_mapManip.cpp:554
ProSHADE_internal_data::ProSHADE_data::getSO3Coeffs
proshade_complex * getSO3Coeffs(void)
This function allows access to the SO(3) coefficients array.
Definition: ProSHADE_data.cpp:3242
ProSHADE_settings::maxSphereDists
proshade_single maxSphereDists
The distance between spheres in spherical mapping for the largest sphere.
Definition: ProSHADE_settings.hpp:116
ProSHADE_internal_data::ProSHADE_data::maxShellBand
proshade_unsign maxShellBand
The maximum band for any shell of the object.
Definition: ProSHADE_data.hpp:123
ProSHADE_internal_data::ProSHADE_data::originalPdbRotCenY
proshade_double originalPdbRotCenY
The centre of rotation as it relates to the original PDB positions (and not the ProSHADE internal map...
Definition: ProSHADE_data.hpp:103
ProSHADE_internal_data::ProSHADE_data::getSpherePositions
void getSpherePositions(ProSHADE_settings *settings)
This function determines the sphere positions (radii) for sphere mapping.
Definition: ProSHADE_data.cpp:1507
ProSHADE_internal_data::ProSHADE_data::invertMirrorMap
void invertMirrorMap(ProSHADE_settings *settings)
Function for inverting the map to its mirror image.
Definition: ProSHADE_data.cpp:960
ProSHADE_internal_maths::getRotationMatrixFromEulerZXZAngles
void getRotationMatrixFromEulerZXZAngles(proshade_double eulerAlpha, proshade_double eulerBeta, proshade_double eulerGamma, proshade_double *matrix)
Function to find the rotation matrix from Euler angles (ZXZ convention).
Definition: ProSHADE_maths.cpp:1005
checkElementsFormGroup
bool checkElementsFormGroup(std::vector< std::vector< proshade_double > > *elements, proshade_double matrixTolerance)
This function checks if all group element products produce another group element.
Definition: ProSHADE_data.cpp:2445
ProSHADE_internal_data::ProSHADE_data::getSpherePosValue
proshade_double getSpherePosValue(proshade_unsign shell)
This function allows access to sphere positions.
Definition: ProSHADE_data.cpp:3189
ProSHADE_internal_data::ProSHADE_data::findBestCScore
proshade_double findBestCScore(std::vector< proshade_double * > *CSym, proshade_unsign *symInd)
This function locates the best scoring C symmetry axis, returning the score and best symmetry index.
Definition: ProSHADE_data.cpp:1938
ProSHADE_internal_data::ProSHADE_data::mapCOMProcessChangeZ
proshade_double mapCOMProcessChangeZ
The change in Z axis between the creation of the structure (originalMapZCom) and just before rotation...
Definition: ProSHADE_data.hpp:99
ProSHADE_settings::maskingThresholdIQRs
proshade_single maskingThresholdIQRs
Number of inter-quartile ranges from the median to be used for thresholding the blurred map for maski...
Definition: ProSHADE_settings.hpp:130
ProSHADE_settings::usePhase
bool usePhase
If true, the full data will be used, if false, Patterson maps will be used instead and phased data wi...
Definition: ProSHADE_settings.hpp:113
ProSHADE_internal_data::ProSHADE_data::deepCopyMap
void deepCopyMap(proshade_double *&saveTo, proshade_unsign verbose)
This function copies the internal map into the supplied pointer, which it also allocates.
Definition: ProSHADE_data.cpp:2814
ProSHADE_internal_data::ProSHADE_data::xDimSizeOriginal
proshade_single xDimSizeOriginal
This is the size of the map cell x dimension in Angstroms.
Definition: ProSHADE_data.hpp:82
ProSHADE_internal_messages::printWarningMessage
void printWarningMessage(proshade_signed verbose, std::string message, std::string warnCode)
General stderr message printing (used for warnings).
Definition: ProSHADE_messages.cpp:101
ProSHADE_internal_data::ProSHADE_data::getIntegrationWeight
proshade_double getIntegrationWeight(void)
This function allows access to the integration weight for the object.
Definition: ProSHADE_data.cpp:3165
ProSHADE_internal_io::figureDataType
InputType figureDataType(std::string fName)
Function determining input data type.
Definition: ProSHADE_io.cpp:292
ProSHADE_internal_data::ProSHADE_data::setIntegrationWeightCumul
void setIntegrationWeightCumul(proshade_double intW)
This function allows setting the cumulative integration weight for the object.
Definition: ProSHADE_data.cpp:3467
ProSHADE_internal_mapManip::reSampleMapToResolutionTrilinear
void reSampleMapToResolutionTrilinear(proshade_double *&map, proshade_single resolution, proshade_unsign xDimS, proshade_unsign yDimS, proshade_unsign zDimS, proshade_single xAngs, proshade_single yAngs, proshade_single zAngs, proshade_single *&corrs)
This function re-samples a map to conform to given resolution using tri-linear interpolation.
Definition: ProSHADE_mapManip.cpp:1158
ProSHADE_internal_data::ProSHADE_data::zAxisOriginOriginal
proshade_signed zAxisOriginOriginal
This is the origin position along the z axis.
Definition: ProSHADE_data.hpp:90
ProSHADE_internal_spheres::ProSHADE_sphere
This class contains all inputed and derived data for a single sphere.
Definition: ProSHADE_spheres.hpp:49
ProSHADE_internal_data::ProSHADE_data::getSymmetryAxis
std::vector< std::string > getSymmetryAxis(ProSHADE_settings *settings, proshade_unsign axisNo)
This function returns a single symmetry axis as a vector of strings from the recommended symmetry axe...
Definition: ProSHADE_data.cpp:3785
ProSHADE_settings::maskFileName
std::string maskFileName
The filename to which mask should be saved.
Definition: ProSHADE_settings.hpp:136
ProSHADE_internal_data::ProSHADE_data::eMatrices
proshade_complex *** eMatrices
The trace sigma and full rotation function c*conj(c) integral tables.
Definition: ProSHADE_data.hpp:127
ProSHADE_internal_data::ProSHADE_data::centreMapOnCOM
void centreMapOnCOM(ProSHADE_settings *settings)
This function shits the map so that its COM is in the centre of the map.
Definition: ProSHADE_data.cpp:1294
ProSHADE_internal_data::ProSHADE_data::getXFromPtr
proshade_signed * getXFromPtr(void)
This function allows access to the map start along the X axis.
Definition: ProSHADE_data.cpp:3343
ProSHADE_settings::verbose
proshade_signed verbose
Should the software report on the progress, or just be quiet? Value between -1 (nothing) and 4 (loud)
Definition: ProSHADE_settings.hpp:188
ProSHADE_internal_mapManip::beautifyBoundaries
void beautifyBoundaries(proshade_signed *&bounds, proshade_unsign xDim, proshade_unsign yDim, proshade_unsign zDim, proshade_signed boundsDiffThres, proshade_signed verbose)
Function for modifying boundaries to a mathematically more pleasant values.
Definition: ProSHADE_mapManip.cpp:1897
ProSHADE_internal_data::ProSHADE_data::yDimIndices
proshade_unsign yDimIndices
This is the size of the map cell y dimension in indices.
Definition: ProSHADE_data.hpp:66
ProSHADE_internal_data::ProSHADE_data::xAxisOriginOriginal
proshade_signed xAxisOriginOriginal
This is the origin position along the x axis.
Definition: ProSHADE_data.hpp:88
ProSHADE_internal_data::ProSHADE_data::saveRecommendedSymmetry
void 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)
This function takes all the detected symmetry results and decides on which are to be recommended for ...
Definition: ProSHADE_data.cpp:2135
ProSHADE_internal_data::ProSHADE_data::getWignerMatrixValue
void getWignerMatrixValue(proshade_unsign band, proshade_unsign order1, proshade_unsign order2, proshade_double *valueReal, proshade_double *valueImag)
This function allows access to the Wigner D matrix by knowing the band, order1 and order2 indices.
Definition: ProSHADE_data.cpp:3268
ProSHADE_internal_data::ProSHADE_data::getShellBandwidth
proshade_unsign getShellBandwidth(proshade_unsign shell)
This function allows access to the bandwidth of a particular shell.
Definition: ProSHADE_data.cpp:3177
ProSHADE_internal_data::ProSHADE_data::yGridIndices
proshade_unsign yGridIndices
As far as I know, this is identical to the yDimIndices.
Definition: ProSHADE_data.hpp:69
ProSHADE_settings::changeMapResolutionTriLinear
bool changeMapResolutionTriLinear
Should maps be re-sampled to obtain the required resolution?
Definition: ProSHADE_settings.hpp:103
ProSHADE_internal_data::ProSHADE_data::zAxisOrigin
proshade_signed zAxisOrigin
This is the origin position along the z axis.
Definition: ProSHADE_data.hpp:76
ProSHADE_internal_misc::addToDoubleVector
void addToDoubleVector(std::vector< proshade_double > *vecToAddTo, proshade_double elementToAdd)
Adds the element to the vector.
Definition: ProSHADE_misc.cpp:77
ProSHADE_internal_data::ProSHADE_data::getNoRecommendedSymmetryAxes
proshade_unsign getNoRecommendedSymmetryAxes(ProSHADE_settings *settings)
This function returns the number of detected recommended symmetry axes.
Definition: ProSHADE_data.cpp:3773
ProSHADE_internal_data::ProSHADE_data::setPDBMapValues
void setPDBMapValues(void)
Function for determining iterator start and stop positions.
Definition: ProSHADE_data.cpp:744
ProSHADE_internal_data::ProSHADE_data::findMapCOM
void findMapCOM(void)
This function finds the centre of mass of the internal map representation.
Definition: ProSHADE_data.cpp:2928
ProSHADE_internal_data::ProSHADE_data::getRealRotFunction
void getRealRotFunction(double *rotFunReal, int len)
This function fills the input array with the real rotation function values.
Definition: ProSHADE_data.cpp:3643
ProSHADE_internal_data::ProSHADE_data::yDimIndicesOriginal
proshade_unsign yDimIndicesOriginal
This is the size of the map cell y dimension in indices.
Definition: ProSHADE_data.hpp:86
ProSHADE_internal_data::ProSHADE_data::getXDim
proshade_unsign getXDim(void)
This function allows access to the map size in indices along the X axis.
Definition: ProSHADE_data.cpp:3313
ProSHADE_internal_mapManip::removeWaters
void removeWaters(gemmi::Structure *pdbFile, bool firstModel)
This function removed all waters from PDB input file.
Definition: ProSHADE_mapManip.cpp:485
ProSHADE_internal_data::ProSHADE_data::originalPdbTransX
proshade_double originalPdbTransX
The optimal translation vector as it relates to the original PDB positions (and not the ProSHADE inte...
Definition: ProSHADE_data.hpp:105
ProSHADE_data.hpp
This is the header file containing internal data representation and manipulation structures and funct...
ProSHADE_internal_data::ProSHADE_data::zTo
proshade_signed zTo
This is the final index along the z axis.
Definition: ProSHADE_data.hpp:115
ProSHADE_internal_data::ProSHADE_data::xTo
proshade_signed xTo
This is the final index along the x axis.
Definition: ProSHADE_data.hpp:113
ProSHADE_internal_data::ProSHADE_data::writeMask
void writeMask(std::string fName, proshade_double *mask)
Function for writing out a mask in MRC MAP format.
Definition: ProSHADE_data.cpp:923
ProSHADE_internal_data::ProSHADE_data::ProSHADE_data
ProSHADE_data(ProSHADE_settings *settings)
Constructor for getting empty ProSHADE_data class.
Definition: ProSHADE_data.cpp:39
ProSHADE_internal_data::ProSHADE_data::integrationWeight
proshade_double integrationWeight
The Pearson's c.c. type weighting for the integration.
Definition: ProSHADE_data.hpp:128
ProSHADE_internal_data::ProSHADE_data::saveRequestedSymmetryC
void saveRequestedSymmetryC(ProSHADE_settings *settings, std::vector< proshade_double * > *CSym, std::vector< proshade_double * > *axes)
This function takes the C symmetries and searched for the requested symmetry.
Definition: ProSHADE_data.cpp:2229
ProSHADE_internal_data::ProSHADE_data::mapToSpheres
void mapToSpheres(ProSHADE_settings *settings)
This function converts the internal map onto a set of concentric spheres.
Definition: ProSHADE_data.cpp:1564
ProSHADE_internal_data::ProSHADE_data::xAxisOrigin
proshade_signed xAxisOrigin
This is the origin position along the x axis.
Definition: ProSHADE_data.hpp:74
ProSHADE_internal_data::ProSHADE_data::originalPdbTransY
proshade_double originalPdbTransY
The optimal translation vector as it relates to the original PDB positions (and not the ProSHADE inte...
Definition: ProSHADE_data.hpp:106
ProSHADE_internal_data::ProSHADE_data::rrpMatrices
proshade_double *** rrpMatrices
The energy levels descriptor shell correlation tables.
Definition: ProSHADE_data.hpp:126
ProSHADE_internal_data::ProSHADE_data::yTo
proshade_signed yTo
This is the final index along the y axis.
Definition: ProSHADE_data.hpp:114
ProSHADE_settings::forceP1
bool forceP1
Should the P1 spacegroup be forced on the input PDB files?
Definition: ProSHADE_settings.hpp:96
ProSHADE_internal_data::ProSHADE_data::xDimSize
proshade_single xDimSize
This is the size of the map cell x dimension in Angstroms.
Definition: ProSHADE_data.hpp:59
ProSHADE_internal_mapManip::findPDBCOMValues
void findPDBCOMValues(gemmi::Structure pdbFile, proshade_double *xCom, proshade_double *yCom, proshade_double *zCom, bool firstModel)
This function finds the Centre of Mass for the co-ordinate file.
Definition: ProSHADE_mapManip.cpp:142
ProSHADE_internal_data::ProSHADE_data::mapMovFromsChangeY
proshade_double mapMovFromsChangeY
When the map is translated, the yFrom and yTo values are changed. This variable holds how much they h...
Definition: ProSHADE_data.hpp:95
ProSHADE_internal_misc::sortDSymHlpInv
bool sortDSymHlpInv(const proshade_double *a, const proshade_double *b)
This function compares two arrays of the ProSHADE dihedral symmetry list based on combination of axes...
Definition: ProSHADE_misc.cpp:256
ProSHADE_internal_data::ProSHADE_data::yAxisOrigin
proshade_signed yAxisOrigin
This is the origin position along the y axis.
Definition: ProSHADE_data.hpp:75
ProSHADE_internal_misc::deepCopyAxisToDblPtrVector
void deepCopyAxisToDblPtrVector(std::vector< proshade_double * > *dblPtrVec, proshade_double *axis)
Does a deep copy of a double array to a vector of double arrays.
Definition: ProSHADE_misc.cpp:287
ProSHADE_internal_data::ProSHADE_data::yAxisOrder
proshade_unsign yAxisOrder
This is the order of the y axis.
Definition: ProSHADE_data.hpp:72
ProSHADE_internal_data::ProSHADE_data::getRealSphHarmValue
proshade_double * getRealSphHarmValue(proshade_unsign band, proshade_unsign order, proshade_unsign shell)
This function allows access to the private internal real spherical harmonics values.
Definition: ProSHADE_data.cpp:3128
ProSHADE_internal_data::ProSHADE_data::detectSymmetryInStructurePython
void detectSymmetryInStructurePython(ProSHADE_settings *settings)
This function runs the symmetry detection algorithms on this structure saving the axes in the setting...
Definition: ProSHADE_data.cpp:1750
ProSHADE_internal_data::ProSHADE_data::internalMap
proshade_double * internalMap
The internal map data representation, which may be amended as the run progresses.
Definition: ProSHADE_data.hpp:56
ProSHADE_internal_data::ProSHADE_data::zDimIndicesOriginal
proshade_unsign zDimIndicesOriginal
This is the size of the map cell z dimension in indices.
Definition: ProSHADE_data.hpp:87
ProSHADE_internal_data::ProSHADE_data::reportOverlayResults
void reportOverlayResults(ProSHADE_settings *settings, std::vector< proshade_double > *rotationCentre, std::vector< proshade_double > *eulerAngles, std::vector< proshade_double > *finalTranslation)
This function reports the results of the overlay mode.
Definition: ProSHADE_data.cpp:3874
ProSHADE_internal_data::ProSHADE_data::xFrom
proshade_signed xFrom
This is the starting index along the x axis.
Definition: ProSHADE_data.hpp:110
ProSHADE_internal_maths::getRotationMatrixFromAngleAxis
void getRotationMatrixFromAngleAxis(proshade_double *rotMat, proshade_double x, proshade_double y, proshade_double z, proshade_double ang)
This function converts the axis-angle representation to the rotation matrix representation.
Definition: ProSHADE_maths.cpp:1343
ProSHADE_internal_data::ProSHADE_data::writeMap
void writeMap(std::string fName, std::string title="Created by ProSHADE and written by GEMMI", int mode=2)
Function for writing out the internal structure representation in MRC MAP format.
Definition: ProSHADE_data.cpp:807
ProSHADE_internal_data::ProSHADE_data::shellBandExists
bool shellBandExists(proshade_unsign shell, proshade_unsign bandVal)
This function checks if particular shell has a particular band.
Definition: ProSHADE_data.cpp:3030
ProSHADE_internal_data::ProSHADE_data::getMaxBand
proshade_unsign getMaxBand(void)
This function returns the maximum band value for the object.
Definition: ProSHADE_data.cpp:3004
ProSHADE_settings::normaliseMap
bool normaliseMap
Should the map be normalised to mean 0 sd 1?
Definition: ProSHADE_settings.hpp:123
ProSHADE_settings::addExtraSpace
proshade_single addExtraSpace
If this value is non-zero, this many angstroms of empty space will be added to the internal map.
Definition: ProSHADE_settings.hpp:149
ProSHADE_internal_mapManip::getNonZeroBounds
void getNonZeroBounds(proshade_double *map, proshade_signed xDim, proshade_signed yDim, proshade_signed zDim, proshade_single xAngs, proshade_single yAngs, proshade_single zAngs, proshade_signed *&ret)
Function for finding the map boundaries enclosing positive only values.
Definition: ProSHADE_mapManip.cpp:1065
ProSHADE_internal_data::ProSHADE_data::getYDim
proshade_unsign getYDim(void)
This function allows access to the map size in indices along the Y axis.
Definition: ProSHADE_data.cpp:3323
ProSHADE_internal_data::ProSHADE_data::maxCompBand
proshade_unsign maxCompBand
The largest comparison band - this variable tells how large arrays will be allocated for the comparis...
Definition: ProSHADE_data.hpp:132
ProSHADE_internal_data::ProSHADE_data::getImagEMatrixValuesForLM
void getImagEMatrixValuesForLM(proshade_signed band, proshade_signed order1, double *eMatsLMImag, int len)
This function fills the input array with the imaginary E matrix values for particular band and order1...
Definition: ProSHADE_data.cpp:3574
ProSHADE_internal_data::ProSHADE_data::maskMap
void maskMap(ProSHADE_settings *settings)
Function for computing the map mask using blurring and X IQRs from median.
Definition: ProSHADE_data.cpp:1061
ProSHADE_internal_data::ProSHADE_data::~ProSHADE_data
~ProSHADE_data(void)
Destructor for the ProSHADE_data class.
Definition: ProSHADE_data.cpp:295
ProSHADE_settings
This class stores all the settings and is passed to the executive classes instead of a multitude of p...
Definition: ProSHADE_settings.hpp:89
ProSHADE_internal_data::ProSHADE_data::xCom
proshade_double xCom
The COM of the map after processing along the X-axis.
Definition: ProSHADE_data.hpp:77
ProSHADE_internal_mapManip::copyMapByBounds
void copyMapByBounds(proshade_signed xFrom, proshade_signed xTo, proshade_signed yFrom, proshade_signed yTo, proshade_signed zFrom, proshade_signed zTo, proshade_signed origXFrom, proshade_signed origYFrom, proshade_signed origZFrom, proshade_signed yDimIndices, proshade_signed zDimIndices, proshade_signed origXDimIndices, proshade_signed origYDimIndices, proshade_signed origZDimIndices, proshade_double *&newMap, proshade_double *origMap)
This function copies an old map to a new map with different boundaries.
Definition: ProSHADE_mapManip.cpp:2063
ProSHADE_internal_data::ProSHADE_data::getRealTranslationFunction
void getRealTranslationFunction(double *trsFunReal, int len)
This function fills the input array with the real translation function values.
Definition: ProSHADE_data.cpp:3679
ProSHADE_internal_data::ProSHADE_data::getImagSphHarmValue
proshade_double * getImagSphHarmValue(proshade_unsign band, proshade_unsign order, proshade_unsign shell)
This function allows access to the private internal imaginary spherical harmonics values.
Definition: ProSHADE_data.cpp:3141
ProSHADE_internal_data::ProSHADE_data::originalPdbTransZ
proshade_double originalPdbTransZ
The optimal translation vector as it relates to the original PDB positions (and not the ProSHADE inte...
Definition: ProSHADE_data.hpp:107
ProSHADE_internal_data::ProSHADE_data::writeOutOverlayFiles
void writeOutOverlayFiles(ProSHADE_settings *settings, proshade_double eulA, proshade_double eulB, proshade_double eulG, std::vector< proshade_double > *rotCentre, std::vector< proshade_double > *ultimateTranslation)
This function writes out the rotated map, co-ordinates and transformation JSON file.
Definition: ProSHADE_data.cpp:3840
ProSHADE_internal_data::ProSHADE_data::findBestDScore
proshade_double findBestDScore(std::vector< proshade_double * > *DSym, proshade_unsign *symInd)
This function locates the best scoring D symmetry axis, returning the score and best symmetry index.
Definition: ProSHADE_data.cpp:1982
ProSHADE_internal_data::ProSHADE_data::getImagRotFunction
void getImagRotFunction(double *rotFunImag, int len)
This function fills the input array with the imaginary rotation function values.
Definition: ProSHADE_data.cpp:3661
ProSHADE_internal_data::ProSHADE_data::processInternalMap
void processInternalMap(ProSHADE_settings *settings)
This function simply clusters several other functions which should be called together.
Definition: ProSHADE_data.cpp:1464
ProSHADE_internal_io::readInMapData
void readInMapData(gemmi::Ccp4< float > *gemmiMap, proshade_double *&map, proshade_unsign xDimInds, proshade_unsign yDimInds, proshade_unsign zDimInds, proshade_unsign xAxOrder, proshade_unsign yAxOrder, proshade_unsign zAxOrder)
This function converts the gemmi Ccp4 object data to ProSHADE internal map representation.
Definition: ProSHADE_io.cpp:172
ProSHADE_internal_data::ProSHADE_data::getTranslationFnPointer
proshade_complex * getTranslationFnPointer(void)
This function allows access to the translation function through a pointer.
Definition: ProSHADE_data.cpp:3443
ProSHADE_settings::setRecommendedSymmetry
void setRecommendedSymmetry(std::string val)
Sets the ProSHADE detected symmetry type.
Definition: ProSHADE.cpp:1009
ProSHADE_internal_data::ProSHADE_data::zCom
proshade_double zCom
The COM of the map after processing along the Z-axis.
Definition: ProSHADE_data.hpp:79
ProSHADE_internal_data::ProSHADE_data::spherePos
std::vector< proshade_single > spherePos
Vector of sphere radii from the centre of the map.
Definition: ProSHADE_data.hpp:118
ProSHADE_settings::invertMap
bool invertMap
Should the map be inverted? Only use this if you think you have the wrong hand in your map.
Definition: ProSHADE_settings.hpp:126
ProSHADE_internal_data::ProSHADE_data::getZDim
proshade_unsign getZDim(void)
This function allows access to the map size in indices along the Z axis.
Definition: ProSHADE_data.cpp:3333
ProSHADE_internal_data::ProSHADE_data::findOScore
proshade_double findOScore(std::vector< proshade_double * > *OSym)
This function takes the list of octahedral axes and returns a score for deciding whether O symmetry s...
Definition: ProSHADE_data.cpp:2063
ProSHADE_internal_mapManip::removeMapPhase
void removeMapPhase(fftw_complex *&mapCoeffs, proshade_unsign xDim, proshade_unsign yDim, proshade_unsign zDim)
This function removes the phase from reciprocal (frequency) map.
Definition: ProSHADE_mapManip.cpp:1611
ProSHADE_settings::boundsSimilarityThreshold
proshade_signed boundsSimilarityThreshold
Number of indices which can be added just to make sure same size in indices is achieved.
Definition: ProSHADE_settings.hpp:141
ProSHADE_internal_data::ProSHADE_data::writePdb
void writePdb(std::string fName, proshade_double euA=0.0, proshade_double euB=0.0, proshade_double euG=0.0, proshade_double trsX=0.0, proshade_double trsY=0.0, proshade_double trsZ=0.0, bool firstModel=true)
This function writes out the PDB formatted file coresponding to the structure so that its COM is at s...
Definition: ProSHADE_data.cpp:872
ProSHADE_settings::changeMapResolution
bool changeMapResolution
Should maps be re-sampled to obtain the required resolution?
Definition: ProSHADE_settings.hpp:102
ProSHADE_internal_data::ProSHADE_data::getRRPValue
proshade_double getRRPValue(proshade_unsign band, proshade_unsign sh1, proshade_unsign sh2)
This function allows access to the priva internal RRP matrices.
Definition: ProSHADE_data.cpp:3014
ProSHADE_settings::determineAllSHValues
void determineAllSHValues(proshade_unsign xDim, proshade_unsign yDim, proshade_unsign zDim, proshade_double xDimAngs, proshade_double yDimAngs, proshade_double zDimAngs)
This function determines all the required values for spherical harmonics computation.
Definition: ProSHADE.cpp:1320
ProSHADE_internal_io::writeRotationTranslationJSON
void writeRotationTranslationJSON(proshade_double trsX1, proshade_double trsY1, proshade_double trsZ1, proshade_double eulA, proshade_double eulB, proshade_double eulG, proshade_double trsX2, proshade_double trsY2, proshade_double trsZ2, std::string fileName)
Function for writing out the optimal rotation and translation into a JSON file.
Definition: ProSHADE_io.cpp:334
ProSHADE_internal_data::ProSHADE_data::mapMovFromsChangeZ
proshade_double mapMovFromsChangeZ
When the map is translated, the zFrom and zTo values are changed. This variable holds how much they h...
Definition: ProSHADE_data.hpp:96
axesToGroupTypeSanityCheck
void axesToGroupTypeSanityCheck(proshade_unsign requiredAxes, proshade_unsign obtainedAxes, std::string groupType)
This function checks that the required and obtained numbers of axes are correct, printing error if th...
Definition: ProSHADE_data.cpp:2397
ProSHADE_settings::overlayStructureName
std::string overlayStructureName
The filename to which the rotated and translated moving structure is to be saved.
Definition: ProSHADE_settings.hpp:184
ProSHADE_internal_data::ProSHADE_data::getMapValue
proshade_double getMapValue(proshade_unsign pos)
This function returns the internal map representation value of a particular array position.
Definition: ProSHADE_data.cpp:2994
ProSHADE_internal_data::ProSHADE_data::getImagSO3Coeffs
void getImagSO3Coeffs(double *so3CoefsImag, int len)
This function fills the input array with the imaginary SO(3) coefficient values.
Definition: ProSHADE_data.cpp:3610
ProSHADE_internal_data::ProSHADE_data::getYToPtr
proshade_signed * getYToPtr(void)
This function allows access to the map last position along the Y axis.
Definition: ProSHADE_data.cpp:3383
ProSHADE_settings::moveToCOM
bool moveToCOM
Logical value stating whether the structure should be moved to have its Centre Of Mass (COM) in the m...
Definition: ProSHADE_settings.hpp:146
ProSHADE_internal_data::ProSHADE_data::readInMAP
void readInMAP(ProSHADE_settings *settings)
Function for reading map data using gemmi library.
Definition: ProSHADE_data.cpp:501
ProSHADE_internal_data::ProSHADE_data::wignerMatrices
proshade_complex *** wignerMatrices
These matrices are computed for a particular rotation to be done in spherical harmonics.
Definition: ProSHADE_data.hpp:131
ProSHADE_internal_data::ProSHADE_data::detectSymmetryInStructure
void detectSymmetryInStructure(ProSHADE_settings *settings, std::vector< proshade_double * > *axes, std::vector< std::vector< proshade_double > > *allCs)
This function runs the symmetry detection algorithms on this structure and saves the results in the s...
Definition: ProSHADE_data.cpp:1653
ProSHADE_internal_data::ProSHADE_data::fileType
ProSHADE_internal_io::InputType fileType
This is the type of the input file.
Definition: ProSHADE_data.hpp:53
ProSHADE_internal_data::ProSHADE_data::getZAxisOrigin
proshade_signed * getZAxisOrigin(void)
This function allows access to the map Z axis origin value.
Definition: ProSHADE_data.cpp:3423
ProSHADE_internal_io::writeOutMapHeader
void writeOutMapHeader(gemmi::Ccp4< float > *map, proshade_unsign xDimInds, proshade_unsign yDimInds, proshade_unsign zDimInds, proshade_single xDim, proshade_single yDim, proshade_single zDim, proshade_single aAng, proshade_single bAng, proshade_single cAng, proshade_signed xFrom, proshade_signed yFrom, proshade_signed zFrom, proshade_signed xAxOrigin, proshade_signed yAxOrigin, proshade_signed zAxOrigin, proshade_unsign xAxOrder, proshade_unsign yAxOrder, proshade_unsign zAxOrder, proshade_unsign xGridInds, proshade_unsign yGridInds, proshade_unsign zGridInds, std::string title, int mode)
This function parses the CCP4 MAP file header as read in by gemmi.
Definition: ProSHADE_io.cpp:242
ProSHADE_internal_mapManip::myRound
proshade_signed myRound(proshade_double x)
Calls the appropriate version of round function depending on compiler version.
Definition: ProSHADE_mapManip.cpp:31
ProSHADE_internal_data::ProSHADE_data::yDimSizeOriginal
proshade_single yDimSizeOriginal
This is the size of the map cell y dimension in Angstroms.
Definition: ProSHADE_data.hpp:83
ProSHADE_internal_data::ProSHADE_data::zAxisOrder
proshade_unsign zAxisOrder
This is the order of the z axis.
Definition: ProSHADE_data.hpp:73
ProSHADE_internal_data::ProSHADE_data::reSampleMap
void reSampleMap(ProSHADE_settings *settings)
This function changes the internal map sampling to conform to particular resolution value.
Definition: ProSHADE_data.cpp:1222
ProSHADE_internal_mapManip::rotatePDBCoordinates
void rotatePDBCoordinates(gemmi::Structure *pdbFile, proshade_double euA, proshade_double euB, proshade_double euG, proshade_double xCom, proshade_double yCom, proshade_double zCom, bool firstModel)
Function for rotating the PDB file co-ordinates by Euler angles.
Definition: ProSHADE_mapManip.cpp:277
ProSHADE_internal_mapManip::generateMapFromPDB
void generateMapFromPDB(gemmi::Structure pdbFile, proshade_double *&map, proshade_single requestedResolution, proshade_single xCell, proshade_single yCell, proshade_single zCell, proshade_signed *xTo, proshade_signed *yTo, proshade_signed *zTo, bool forceP1, bool firstModel)
This function generates a theoretical map from co-ordinate input files.
Definition: ProSHADE_mapManip.cpp:625
ProSHADE_internal_maths::rotationMatrixSimilarity
bool rotationMatrixSimilarity(std::vector< proshade_double > *mat1, std::vector< proshade_double > *mat2, proshade_double tolerance=0.1)
This function compares the distance between two rotation matrices and decides if they are similar usi...
Definition: ProSHADE_maths.cpp:2195
ProSHADE_internal_misc::checkMemoryAllocation
void checkMemoryAllocation(chVar checkVar, std::string fileP, unsigned int lineP, std::string funcP, std::string infoP="This error may occurs when ProSHADE requests memory to be\n : allocated to it and this operation fails. This could\n : happen when not enough memory is available, either due to\n : other processes using a lot of memory, or when the machine\n : does not have sufficient memory available. Re-run to see\n : if this problem persists.")
Checks if memory was allocated properly.
Definition: ProSHADE_misc.hpp:65
ProSHADE_internal_data::ProSHADE_data::getXToPtr
proshade_signed * getXToPtr(void)
This function allows access to the map last position along the X axis.
Definition: ProSHADE_data.cpp:3373
ProSHADE_internal_data::ProSHADE_data::getYFromPtr
proshade_signed * getYFromPtr(void)
This function allows access to the map start along the Y axis.
Definition: ProSHADE_data.cpp:3353
ProSHADE_internal_mapManip::translatePDBCoordinates
void translatePDBCoordinates(gemmi::Structure *pdbFile, proshade_double transX, proshade_double transY, proshade_double transZ, bool firstModel)
Function for translating the PDB file co-ordinates by given distances in Angstroms.
Definition: ProSHADE_mapManip.cpp:362
ProSHADE_internal_data::ProSHADE_data::mapCOMProcessChangeY
proshade_double mapCOMProcessChangeY
The change in Y axis between the creation of the structure (originalMapYCom) and just before rotation...
Definition: ProSHADE_data.hpp:98
ProSHADE_internal_data::ProSHADE_data::bAngle
proshade_single bAngle
This is the angle b of the map cell in degrees.
Definition: ProSHADE_data.hpp:63
ProSHADE_internal_maths::getEulerZXZFromSOFTPosition
void getEulerZXZFromSOFTPosition(proshade_signed band, proshade_signed x, proshade_signed y, proshade_signed z, proshade_double *eulerAlpha, proshade_double *eulerBeta, proshade_double *eulerGamma)
Function to find Euler angles (ZXZ convention) from index position in the inverse SOFT map.
Definition: ProSHADE_maths.cpp:961
ProSHADE_internal_data::ProSHADE_data::yAxisOriginOriginal
proshade_signed yAxisOriginOriginal
This is the origin position along the y axis.
Definition: ProSHADE_data.hpp:89
ProSHADE_internal_data::ProSHADE_data::aAngle
proshade_single aAngle
This is the angle a of the map cell in degrees.
Definition: ProSHADE_data.hpp:62
ProSHADE_internal_misc::addToDoubleVectorVector
void addToDoubleVectorVector(std::vector< std::vector< proshade_double > > *vecToAddTo, std::vector< proshade_double > elementToAdd)
Adds the element to the vector of vectors.
Definition: ProSHADE_misc.cpp:210
ProSHADE_internal_data::ProSHADE_data::reportSymmetryResults
void reportSymmetryResults(ProSHADE_settings *settings)
This function takes prints the report for symmetry detection.
Definition: ProSHADE_data.cpp:2846
ProSHADE_internal_data::ProSHADE_data::findTScore
proshade_double findTScore(std::vector< proshade_double * > *TSym)
This function takes the list of tetrahedral axes and returns a score for deciding whether T symmetry ...
Definition: ProSHADE_data.cpp:2030
ProSHADE_internal_data::ProSHADE_data::figureIndexStartStop
void figureIndexStartStop(void)
Function for determining iterator start and stop positions.
Definition: ProSHADE_data.cpp:785
ProSHADE_internal_data::ProSHADE_data::isEmpty
bool isEmpty
This variable stated whether the class contains any information.
Definition: ProSHADE_data.hpp:139
ProSHADE_internal_data::ProSHADE_data::getInvSO3Coeffs
proshade_complex * getInvSO3Coeffs(void)
This function allows access to the inverse SO(3) coefficients array.
Definition: ProSHADE_data.cpp:3231
ProSHADE_settings::forceBounds
proshade_signed * forceBounds
These will be the boundaries to be forced upon the map.
Definition: ProSHADE_settings.hpp:143
ProSHADE_settings::detectedSymmetry
std::vector< proshade_double * > detectedSymmetry
The vector of detected symmetry axes.
Definition: ProSHADE_settings.hpp:192
ProSHADE_internal_data::ProSHADE_data::yFrom
proshade_signed yFrom
This is the starting index along the y axis.
Definition: ProSHADE_data.hpp:111
ProSHADE_settings::recommendedSymmetryFold
proshade_unsign recommendedSymmetryFold
The fold of the recommended symmetry C or D type, 0 otherwise.
Definition: ProSHADE_settings.hpp:176
ProSHADE_internal_mapManip::reSampleMapToResolutionFourier
void reSampleMapToResolutionFourier(proshade_double *&map, proshade_single resolution, proshade_unsign xDimS, proshade_unsign yDimS, proshade_unsign zDimS, proshade_single xAngs, proshade_single yAngs, proshade_single zAngs, proshade_single *&corrs)
This function re-samples a map to conform to given resolution using Fourier.
Definition: ProSHADE_mapManip.cpp:1359
ProSHADE_internal_data::ProSHADE_data::getYAxisOrigin
proshade_signed * getYAxisOrigin(void)
This function allows access to the map Y axis origin value.
Definition: ProSHADE_data.cpp:3413
ProSHADE_internal_data::ProSHADE_data::originalPdbRotCenZ
proshade_double originalPdbRotCenZ
The centre of rotation as it relates to the original PDB positions (and not the ProSHADE internal map...
Definition: ProSHADE_data.hpp:104
ProSHADE_internal_misc::addToSingleVector
void addToSingleVector(std::vector< proshade_single > *vecToAddTo, proshade_single elementToAdd)
Adds the element to the vector.
Definition: ProSHADE_misc.cpp:55
ProSHADE_settings::firstModelOnly
bool firstModelOnly
Shoud only the first PDB model be used, or should all models be used?
Definition: ProSHADE_settings.hpp:98
ProSHADE_settings::axisErrTolerance
proshade_double axisErrTolerance
Allowed error on vector axis in in dot product ( acos ( 1 - axErr ) is the allowed difference in radi...
Definition: ProSHADE_settings.hpp:172
ProSHADE_settings::useSameBounds
bool useSameBounds
Switch to say that the same boundaries as used for the first should be used for all input maps.
Definition: ProSHADE_settings.hpp:142
ProSHADE_internal_data::ProSHADE_data::zDimIndices
proshade_unsign zDimIndices
This is the size of the map cell z dimension in indices.
Definition: ProSHADE_data.hpp:67
ProSHADE_internal_data::computeGroupElementsForGroup
std::vector< std::vector< proshade_double > > computeGroupElementsForGroup(proshade_double xAx, proshade_double yAx, proshade_double zAx, proshade_signed fold)
This function computes the group elements as rotation matrices (except for the identity element) for ...
Definition: ProSHADE_data.cpp:2333
ProSHADE_settings::pdbBFactorNewVal
proshade_double pdbBFactorNewVal
Change all PDB B-factors to this value (for smooth maps).
Definition: ProSHADE_settings.hpp:106
ProSHADE_internal_data::ProSHADE_data::getRecommendedSymmetryType
std::string getRecommendedSymmetryType(ProSHADE_settings *settings)
This function simply returns the detected recommended symmetry type.
Definition: ProSHADE_data.cpp:3750
ProSHADE_internal_data::ProSHADE_data::zGridIndices
proshade_unsign zGridIndices
As far as I know, this is identical to the zDimIndices.
Definition: ProSHADE_data.hpp:70
ProSHADE_settings::setRecommendedFold
void setRecommendedFold(proshade_unsign val)
Sets the ProSHADE detected symmetry fold.
Definition: ProSHADE.cpp:1028
ProSHADE_settings::setVariablesLeftOnAuto
void setVariablesLeftOnAuto(void)
Function to determine general values that the user left on auto-determination.
Definition: ProSHADE.cpp:316
ProSHADE_internal_data::ProSHADE_data::setEMatrixValue
void setEMatrixValue(proshade_unsign band, proshade_unsign order1, proshade_unsign order2, proshade_complex val)
This function allows setting the E matrix value.
Definition: ProSHADE_data.cpp:3484
ProSHADE_settings::removeWaters
bool removeWaters
Should all waters be removed from input PDB files?
Definition: ProSHADE_settings.hpp:97
ProSHADE_internal_data::ProSHADE_data::spheres
ProSHADE_internal_spheres::ProSHADE_sphere ** spheres
The set of concentric spheres to which the intermal density map has been projected.
Definition: ProSHADE_data.hpp:120
ProSHADE_internal_data::ProSHADE_data::normaliseMap
void normaliseMap(ProSHADE_settings *settings)
Function for normalising the map values to mean 0 and sd 1..
Definition: ProSHADE_data.cpp:1014
ProSHADE_internal_data::ProSHADE_data::detectSymmetryFromAngleAxisSpace
void detectSymmetryFromAngleAxisSpace(ProSHADE_settings *settings, std::vector< proshade_double * > *axes, std::vector< std::vector< proshade_double > > *allCs)
This function runs the symmetry detection algorithms on this structure using the angle-axis space and...
Definition: ProSHADE_data.cpp:1773
ProSHADE_internal_data::ProSHADE_data::originalPdbRotCenX
proshade_double originalPdbRotCenX
The centre of rotation as it relates to the original PDB positions (and not the ProSHADE internal map...
Definition: ProSHADE_data.hpp:102
ProSHADE_internal_data::ProSHADE_data::originalMapZCom
proshade_double originalMapZCom
The COM of the first map to be loaded/computed without any furhter changes being reflacted along the ...
Definition: ProSHADE_data.hpp:93
ProSHADE_internal_messages::printProgressMessage
void printProgressMessage(proshade_signed verbose, proshade_signed messageLevel, std::string message)
General stdout message printing.
Definition: ProSHADE_messages.cpp:70
ProSHADE_internal_data::ProSHADE_data::getRealSO3Coeffs
void getRealSO3Coeffs(double *so3CoefsReal, int len)
This function fills the input array with the real SO(3) coefficient values.
Definition: ProSHADE_data.cpp:3592
ProSHADE_internal_data::ProSHADE_data::yDimSize
proshade_single yDimSize
This is the size of the map cell y dimension in Angstroms.
Definition: ProSHADE_data.hpp:60
ProSHADE_settings::setResolution
void setResolution(proshade_single resolution)
Sets the requested resolution in the appropriate variable.
Definition: ProSHADE.cpp:357
ProSHADE_settings::allDetectedCAxes
std::vector< std::vector< proshade_double > > allDetectedCAxes
The vector of all detected cyclic symmetry axes.
Definition: ProSHADE_settings.hpp:193
ProSHADE_internal_data::ProSHADE_data::removePhaseInormation
void removePhaseInormation(ProSHADE_settings *settings)
This function removes phase from the map, effectively converting it to Patterson map.
Definition: ProSHADE_data.cpp:3050
ProSHADE_internal_mapManip::moveMapByIndices
void moveMapByIndices(proshade_single *xMov, proshade_single *yMov, proshade_single *zMov, proshade_single xAngs, proshade_single yAngs, proshade_single zAngs, proshade_signed *xFrom, proshade_signed *xTo, proshade_signed *yFrom, proshade_signed *yTo, proshade_signed *zFrom, proshade_signed *zTo, proshade_signed *xOrigin, proshade_signed *yOrigin, proshade_signed *zOrigin)
Function for moving map back to original PDB location by changing the indices.
Definition: ProSHADE_mapManip.cpp:744
ProSHADE_internal_io::readInMapHeader
void readInMapHeader(gemmi::Ccp4< float > *map, proshade_unsign *xDimInds, proshade_unsign *yDimInds, proshade_unsign *zDimInds, proshade_single *xDim, proshade_single *yDim, proshade_single *zDim, proshade_single *aAng, proshade_single *bAng, proshade_single *cAng, proshade_signed *xFrom, proshade_signed *yFrom, proshade_signed *zFrom, proshade_signed *xAxOrigin, proshade_signed *yAxOrigin, proshade_signed *zAxOrigin, proshade_unsign *xAxOrder, proshade_unsign *yAxOrder, proshade_unsign *zAxOrder, proshade_unsign *xGridInds, proshade_unsign *yGridInds, proshade_unsign *zGridInds)
This function parses the CCP4 MAP file header as read in by gemmi.
Definition: ProSHADE_io.cpp:103
ProSHADE_internal_maths::multiplyGroupElementMatrices
std::vector< proshade_double > multiplyGroupElementMatrices(std::vector< proshade_double > *el1, std::vector< proshade_double > *el2)
This function computes matrix multiplication using the ProSHADE group element matrix format as input ...
Definition: ProSHADE_maths.cpp:2141
ProSHADE_internal_data::ProSHADE_data::readInStructure
void readInStructure(std::string fName, proshade_unsign inputO, ProSHADE_settings *settings)
This function initialises the basic ProSHADE_data variables and reads in a single structure.
Definition: ProSHADE_data.cpp:447
ProSHADE_internal_data::ProSHADE_data::getAllGroupElements
std::vector< std::vector< proshade_double > > getAllGroupElements(ProSHADE_settings *settings, std::vector< proshade_unsign > axesList, std::string groupType="", proshade_double matrixTolerance=0.05)
This function returns the group elements as rotation matrices of any defined point group.
Definition: ProSHADE_data.cpp:2552
ProSHADE_internal_data::ProSHADE_data::addExtraSpace
void addExtraSpace(ProSHADE_settings *settings)
This function increases the size of the map so that it can add empty space around it.
Definition: ProSHADE_data.cpp:1355
ProSHADE_internal_data::ProSHADE_data::getRealEMatrixValuesForLM
void getRealEMatrixValuesForLM(proshade_signed band, proshade_signed order1, double *eMatsLMReal, int len)
This function fills the input array with the real E matrix values for particular band and order1 (l a...
Definition: ProSHADE_data.cpp:3554
ProSHADE_internal_misc::addToStringVector
void addToStringVector(std::vector< std::string > *vecToAddTo, std::string elementToAdd)
Adds the element to the vector.
Definition: ProSHADE_misc.cpp:33
ProSHADE_internal_sphericalHarmonics::computeSphericalHarmonics
void computeSphericalHarmonics(proshade_unsign band, proshade_double *sphereMappedData, proshade_complex *&shArray)
This function computes the spherical harmonics of a aingle shell, saving them in supplied pointer.
Definition: ProSHADE_sphericalHarmonics.cpp:395
checkElementAlreadyExists
bool checkElementAlreadyExists(std::vector< std::vector< proshade_double > > *elements, std::vector< proshade_double > *elem, proshade_double matrixTolerance)
This function checks if the element list already contains a given matrix.
Definition: ProSHADE_data.cpp:2419
ProSHADE_internal_data::ProSHADE_data::readInPDB
void readInPDB(ProSHADE_settings *settings)
Function for reading pdb data.
Definition: ProSHADE_data.cpp:607
ProSHADE_internal_data::ProSHADE_data::getZFromPtr
proshade_signed * getZFromPtr(void)
This function allows access to the map start along the Z axis.
Definition: ProSHADE_data.cpp:3363
ProSHADE_internal_data::ProSHADE_data::getZToPtr
proshade_signed * getZToPtr(void)
This function allows access to the map last position along the Z axis.
Definition: ProSHADE_data.cpp:3393
ProSHADE_internal_data::ProSHADE_data::so3CoeffsArrayIndex
int so3CoeffsArrayIndex(proshade_signed order1, proshade_signed order2, proshade_signed band)
This function gets the SO(3) coefficients array index for a particular so(3) band,...
Definition: ProSHADE_data.cpp:3632