ProSHADE: src/proshade/ProSHADE_data.cpp Source File

| ProSHADE 0.7.5.1 (JAN 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
39 ProSHADE_internal_data::ProSHADE_data::ProSHADE_data ( ProSHADE_settings* settings )
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
295 ProSHADE_internal_data::ProSHADE_data::~ProSHADE_data ( )
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
501 void ProSHADE_internal_data::ProSHADE_data::readInMAP ( ProSHADE_settings* settings )
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
511 ProSHADE_internal_io::readInMapHeader ( &map,
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 this->reSampleMap ( settings );
538 }
539
540 //================================================ Save the original sizes
541 this->xDimSizeOriginal = this->xDimSize;
542 this->yDimSizeOriginal = this->yDimSize;
543 this->zDimSizeOriginal = this->zDimSize;
544
545 //================================================ Save the original index counts
546 this->xDimIndicesOriginal = this->xDimIndices;
547 this->yDimIndicesOriginal = this->yDimIndices;
548 this->zDimIndicesOriginal = this->zDimIndices;
549
550 //================================================ Save the original axis origins
551 this->xAxisOriginOriginal = this->xAxisOrigin;
552 this->yAxisOriginOriginal = this->yAxisOrigin;
553 this->zAxisOriginOriginal = this->zAxisOrigin;
554
555 //================================================ Compute and save the COM
556 this->findMapCOM ( );
557 this->originalMapXCom = this->xCom;
558 this->originalMapYCom = this->yCom;
559 this->originalMapZCom = this->zCom;
560
561 //================================================ Done
562
563 }
564
574 void ProSHADE_internal_data::ProSHADE_data::readInPDB ( ProSHADE_settings* settings )
575 {
576 //================================================ Set resolution if need be
577 if ( settings->requestedResolution < 0.0 )
578 {
579 settings->setResolution ( 8.0 );
580 }
581
582 //================================================ Open PDB file for reading
583 gemmi::Structure pdbFile = gemmi::read_structure ( gemmi::MaybeGzipped ( this->fileName ) );
584
585 //================================================ Change B-factors if need be
586 if ( settings->pdbBFactorNewVal >= 0.0 )
587 {
588 ProSHADE_internal_mapManip::changePDBBFactors ( &pdbFile, settings->pdbBFactorNewVal, settings->firstModelOnly );
589 }
590
591 //================================================ Remove waters if required
592 if ( settings->removeWaters )
593 {
594 ProSHADE_internal_mapManip::removeWaters ( &pdbFile, settings->firstModelOnly );
595 }
596
597 //================================================ Get PDB COM values
598 proshade_double xCOMPdb, yCOMPdb, zCOMPdb;
599 ProSHADE_internal_mapManip::findPDBCOMValues ( pdbFile, &xCOMPdb, &yCOMPdb, &zCOMPdb, settings->firstModelOnly );
600
601 //================================================ Find the ranges
602 proshade_single xF, xT, yF, yT, zF, zT;
603 ProSHADE_internal_mapManip::determinePDBRanges ( pdbFile, &xF, &xT, &yF, &yT, &zF, &zT, settings->firstModelOnly );
604
605 //================================================ Move ranges to have all FROM values 20
606 proshade_single xMov = 20.0 - xF;
607 proshade_single yMov = 20.0 - yF;
608 proshade_single zMov = 20.0 - zF;
609 ProSHADE_internal_mapManip::movePDBForMapCalc ( &pdbFile, xMov, yMov, zMov, settings->firstModelOnly );
610
611 //================================================ Set the angstrom sizes
612 this->xDimSize = xT - xF + 40.0;
613 this->yDimSize = yT - yF + 40.0;
614 this->zDimSize = zT - zF + 40.0;
615
616 //================================================ Generate map from nicely placed atoms (cell size will be range + 40)
617 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 );
618
619 //================================================ Set the internal variables to correct values
620 this->setPDBMapValues ( );
621
622 //================================================ Compute reverse movement based on COMs. If there is more than 1 models, simply moving back the xyzMov is not enough.
623 proshade_double xCOMMap, yCOMMap, zCOMMap;
624 ProSHADE_internal_mapManip::findMAPCOMValues ( this->internalMap, &xCOMMap, &yCOMMap, &zCOMMap,
625 this->xDimSize, this->yDimSize, this->zDimSize,
626 this->xFrom, this->xTo, this->yFrom, this->yTo, this->zFrom, this->zTo );
627
628 if ( pdbFile.models.size() > 1 )
629 {
630 xMov = xCOMMap - xCOMPdb;
631 yMov = yCOMMap - yCOMPdb;
632 zMov = zCOMMap - zCOMPdb;
633 }
634
635 //================================================ Move map back to the original PDB location
636 ProSHADE_internal_mapManip::moveMapByIndices ( &xMov, &yMov, &zMov, this->xDimSize, this->yDimSize, this->zDimSize,
637 &this->xFrom, &this->xTo, &this->yFrom, &this->yTo, &this->zFrom, &this->zTo,
638 &this->xAxisOrigin, &this->yAxisOrigin, &this->zAxisOrigin );
639 ProSHADE_internal_mapManip::moveMapByFourier ( this->internalMap, xMov, yMov, zMov, this->xDimSize, this->yDimSize, this->zDimSize,
640 this->xDimIndices, this->yDimIndices, this->zDimIndices );
641
642 //================================================ If specific resolution is requested, make sure the map has it
643 if ( settings->changeMapResolution || settings->changeMapResolutionTriLinear )
644 {
645 this->reSampleMap ( settings );
646 }
647
648 //================================================ Save the original sizes
649 this->xDimSizeOriginal = this->xDimSize;
650 this->yDimSizeOriginal = this->yDimSize;
651 this->zDimSizeOriginal = this->zDimSize;
652
653 //================================================ Save the original index counts
654 this->xDimIndicesOriginal = this->xDimIndices;
655 this->yDimIndicesOriginal = this->yDimIndices;
656 this->zDimIndicesOriginal = this->zDimIndices;
657
658 //================================================ Save the original axis origins
659 this->xAxisOriginOriginal = this->xAxisOrigin;
660 this->yAxisOriginOriginal = this->yAxisOrigin;
661 this->zAxisOriginOriginal = this->zAxisOrigin;
662
663 //================================================ Compute and save the COM
664 this->findMapCOM ( );
665 this->originalMapXCom = this->xCom;
666 this->originalMapYCom = this->yCom;
667 this->originalMapZCom = this->zCom;
668
669 //================================================ Done
670 return;
671
672 }
673
678 void ProSHADE_internal_data::ProSHADE_data::setPDBMapValues ( void )
679 {
680 //================================================ Set starts to 0
681 this->xFrom = 0;
682 this->yFrom = 0;
683 this->zFrom = 0;
684
685 //================================================ Set angles to 90 degrees
686 this->aAngle = 90.0;
687 this->bAngle = 90.0;
688 this->cAngle = 90.0;
689
690 //================================================ Set dimension sizes in indices
691 this->xDimIndices = this->xTo;
692 this->yDimIndices = this->yTo;
693 this->zDimIndices = this->zTo;
694
695 //================================================ Set grid indexing to cell indexing
696 this->xGridIndices = this->xDimIndices;
697 this->yGridIndices = this->yDimIndices;
698 this->zGridIndices = this->zDimIndices;
699
700 //================================================ Set axis order
701 this->xAxisOrder = 1;
702 this->yAxisOrder = 2;
703 this->zAxisOrder = 3;
704
705 //================================================ Set origin to the first index
706 this->xAxisOrigin = this->xFrom;
707 this->yAxisOrigin = this->yFrom;
708 this->zAxisOrigin = this->zFrom;
709
710 //================================================ Done
711 return ;
712
713 }
714
719 void ProSHADE_internal_data::ProSHADE_data::figureIndexStartStop ( void )
720 {
721 //================================================ Set ends to origin + size - 1
722 this->xTo = this->xFrom + this->xDimIndices - 1;
723 this->yTo = this->yFrom + this->yDimIndices - 1;
724 this->zTo = this->zFrom + this->zDimIndices - 1;
725
726 //================================================ Done
727 return ;
728
729 }
730
741 void ProSHADE_internal_data::ProSHADE_data::writeMap ( std::string fName, std::string title, int mode )
742 {
743 //================================================ Create and prepare new Grid gemmi object
744 gemmi::Grid<float> mapData;
745 mapData.set_unit_cell ( this->xDimSize, this->yDimSize, this->zDimSize, this->aAngle, this->bAngle, this->cAngle );
746 mapData.set_size_without_checking ( this->xDimIndices, this->yDimIndices, this->zDimIndices );
747 mapData.axis_order = gemmi::AxisOrder::XYZ;
748 mapData.spacegroup = &gemmi::get_spacegroup_p1();
749
750 //================================================ Create and prepare new Ccp4 gemmi object
751 gemmi::Ccp4<float> map;
752 map.grid = mapData;
753 map.update_ccp4_header ( mode );
754
755 //================================================ Fill in the header
756 ProSHADE_internal_io::writeOutMapHeader ( &map,
757 this->xDimIndices, this->yDimIndices, this->zDimIndices,
758 this->xDimSize, this->yDimSize, this->zDimSize,
759 this->aAngle, this->bAngle, this->cAngle,
760 this->xFrom, this->yFrom, this->zFrom,
761 this->xAxisOrigin, this->yAxisOrigin, this->zAxisOrigin,
762 this->xAxisOrder, this->yAxisOrder, this->zAxisOrder,
763 this->xGridIndices, this->yGridIndices, this->zGridIndices,
764 title, mode );
765
766 //================================================ Copy internal map to grid
767 proshade_unsign arrPos = 0;
768 for ( proshade_unsign uIt = 0; uIt < this->xDimIndices; uIt++ )
769 {
770 for ( proshade_unsign vIt = 0; vIt < this->yDimIndices; vIt++ )
771 {
772 for ( proshade_unsign wIt = 0; wIt < this->zDimIndices; wIt++ )
773 {
774 arrPos = wIt + this->zDimIndices * ( vIt + this->yDimIndices * uIt );
775 map.grid.set_value ( uIt, vIt, wIt, static_cast<float> ( this->internalMap[arrPos] ) );
776 }
777 }
778 }
779
780 //================================================ Update the statistics in the header
781 map.update_ccp4_header ( mode, true );
782
783 //================================================ Write out the map
784 map.write_ccp4_map ( fName );
785
786 //================================================ Done
787 return ;
788
789 }
790
806 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 )
807 {
808 //================================================ Check for co-ordinate origin
809 if ( !ProSHADE_internal_io::isFilePDB ( this->fileName ) )
810 {
811 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." );
812 }
813
814 //================================================ Open PDB file for reading
815 gemmi::Structure pdbFile = gemmi::read_structure ( gemmi::MaybeGzipped ( this->fileName ) );
816
817 //================================================ If the map was rotated, do the same for the co-ordinates, making sure we take into account the rotation centre of the map
818 if ( ( euA != 0.0 ) || ( euB != 0.0 ) || ( euG != 0.0 ) )
819 {
820 //============================================ Rotate the co-ordinates
821 ProSHADE_internal_mapManip::rotatePDBCoordinates ( &pdbFile, euA, euB, euG, this->originalPdbRotCenX, this->originalPdbRotCenY, this->originalPdbRotCenZ, firstModel );
822 }
823
824 //================================================ Translate by required translation and the map centering (if applied)
825 ProSHADE_internal_mapManip::translatePDBCoordinates ( &pdbFile, trsX, trsY, trsZ, firstModel );
826
827 //================================================ Write the PDB file
828 std::ofstream outCoOrdFile;
829 outCoOrdFile.open ( fName.c_str() );
830
831 if ( outCoOrdFile.is_open() )
832 {
833 gemmi::PdbWriteOptions opt;
834 write_pdb ( pdbFile, outCoOrdFile, opt );
835 }
836 else
837 {
838 std::stringstream hlpMessage;
839 hlpMessage << "Failed to open the PDB file " << fName << " for output.";
840 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." );
841 }
842
843 outCoOrdFile.close ( );
844
845 //================================================ Done
846 return ;
847 }
848
857 void ProSHADE_internal_data::ProSHADE_data::writeMask ( std::string fName, proshade_double* mask )
858 {
859 //================================================ Allocate the memory
860 proshade_double* hlpMap = new proshade_double[this->xDimIndices * this->yDimIndices * this->zDimIndices];
861 ProSHADE_internal_misc::checkMemoryAllocation ( hlpMap, __FILE__, __LINE__, __func__ );
862
863 //================================================ Copy original map and over-write with the mask
864 for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
865 {
866 hlpMap[iter] = this->internalMap[iter];
867 this->internalMap[iter] = mask[iter];
868 }
869
870 //================================================ Write out the mask
871 this->writeMap ( fName );
872
873 //================================================ Copy the original map values back
874 for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
875 {
876 this->internalMap[iter] = hlpMap[iter];
877 }
878
879 //================================================ Release memory
880 delete[] hlpMap;
881
882 //================================================ Done
883 return ;
884 }
885
894 void ProSHADE_internal_data::ProSHADE_data::invertMirrorMap ( ProSHADE_settings* settings )
895 {
896 //================================================ Report function start
897 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Map inversion." );
898
899 //================================================ Initialise variables
900 proshade_signed arrayPos, invPos;
901
902 //================================================ Create helper map
903 proshade_double* hlpMap = new proshade_double [this->xDimIndices * this->yDimIndices * this->zDimIndices];
904 ProSHADE_internal_misc::checkMemoryAllocation ( hlpMap, __FILE__, __LINE__, __func__ );
905
906 //================================================ Save map values to the helper map
907 for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
908 {
909 hlpMap[iter] = this->internalMap[iter];
910 }
911
912 //================================================ Invert the values
913 for ( proshade_signed xIt = 0; xIt < static_cast<proshade_signed> ( this->xDimIndices ); xIt++ )
914 {
915 for ( proshade_signed yIt = 0; yIt < static_cast<proshade_signed> ( this->yDimIndices ); yIt++ )
916 {
917 for ( proshade_signed zIt = 0; zIt < static_cast<proshade_signed> ( this->zDimIndices ); zIt++ )
918 {
919 //==================================== Var init
920 arrayPos = zIt + this->zDimIndices * ( yIt + this->yDimIndices * xIt );
921 invPos = ( (this->zDimIndices-1) - zIt ) + this->zDimIndices * ( ( (this->yDimIndices-1) - yIt ) + this->yDimIndices * ( (this->xDimIndices-1) - xIt ) );
922
923 //==================================== And save
924 this->internalMap[invPos] = hlpMap[arrayPos];
925 }
926 }
927 }
928
929 //================================================ Release memory
930 delete[] hlpMap;
931
932 //================================================ Report function completion
933 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 2, "Map inversion completed." );
934
935 //================================================ Done
936 return ;
937
938 }
939
948 void ProSHADE_internal_data::ProSHADE_data::normaliseMap ( ProSHADE_settings* settings )
949 {
950 //================================================ Report function start
951 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Map normalisation." );
952
953 //================================================ Initialise vector of map values
954 std::vector<proshade_double> mapVals ( this->xDimIndices * this->yDimIndices * this->zDimIndices, 0.0 );
955
956 //================================================ Get all map values
957 for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
958 {
959 mapVals.at(iter) = this->internalMap[iter];
960 }
961
962 //================================================ Get mean and sd
963 proshade_double* meanSD = new proshade_double[2];
964 ProSHADE_internal_maths::vectorMeanAndSD ( &mapVals, meanSD );
965
966 //================================================ Normalise the values
967 for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
968 {
969 this->internalMap[iter] = ( this->internalMap[iter] - meanSD[0] ) / meanSD[1];
970 }
971
972 //================================================ Clear the vector
973 mapVals.clear ( );
974
975 //================================================ Release memory
976 delete[] meanSD;
977
978 //================================================ Report function completion
979 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 2, "Map normalisation completed." );
980
981 //================================================ Done
982 return ;
983
984 }
985
986
995 void ProSHADE_internal_data::ProSHADE_data::maskMap ( ProSHADE_settings* settings )
996 {
997 //================================================ Report function start
998 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Computing mask." );
999
1000 //================================================ Initialise the blurred map
1001 proshade_double* blurredMap = new proshade_double[this->xDimIndices * this->yDimIndices * this->zDimIndices];
1002 ProSHADE_internal_misc::checkMemoryAllocation ( blurredMap, __FILE__, __LINE__, __func__ );
1003
1004 //================================================ Compute blurred map
1005 ProSHADE_internal_mapManip::blurSharpenMap ( this->internalMap, blurredMap, this->xDimIndices, this->yDimIndices, this->zDimIndices,
1006 this->xDimSize, this->yDimSize, this->zDimSize, settings->blurFactor );
1007
1008 //================================================ Compute mask from blurred map and save it into the original map
1009 ProSHADE_internal_mapManip::getMaskFromBlurr ( blurredMap, this->internalMap, this->xDimIndices, this->yDimIndices, this->zDimIndices, settings->maskingThresholdIQRs );
1010
1011 //================================================ Print the mask if need be
1012 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 ); } }
1013
1014 //================================================ Release memory
1015 delete[] blurredMap;
1016
1017 //================================================ Report function completion
1018 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 2, "Mask computed." );
1019
1020 //================================================ Done
1021 return ;
1022
1023 }
1024
1035 void ProSHADE_internal_data::ProSHADE_data::getReBoxBoundaries ( ProSHADE_settings* settings, proshade_signed*& ret )
1036 {
1037 //================================================ Report function start
1038 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Finding new boundaries." );
1039
1040 //================================================ If same bounds as first one are required, test if possible and return these instead
1041 if ( settings->useSameBounds && ( this->inputOrder != 0 ) )
1042 {
1043 for ( proshade_unsign iter = 0; iter < 6; iter++ ) { ret[iter] = settings->forceBounds[iter]; }
1044 }
1045 //================================================ In this case, bounds need to be found de novo
1046 else
1047 {
1048 //============================================ Find the non-zero bounds
1049 ProSHADE_internal_mapManip::getNonZeroBounds ( this->internalMap, this->xDimIndices, this->yDimIndices, this->zDimIndices,
1050 this->xDimSize, this->yDimSize, this->zDimSize, ret );
1051
1052 //============================================ Add the extra space
1053 ProSHADE_internal_mapManip::addExtraBoundSpace ( this->xDimIndices, this->yDimIndices, this->zDimIndices,
1054 this->xDimSize, this->yDimSize, this->zDimSize, ret, settings->boundsExtraSpace );
1055
1056 //============================================ Beautify boundaries
1057 ProSHADE_internal_mapManip::beautifyBoundaries ( ret, this->xDimIndices, this->yDimIndices, this->zDimIndices, settings->boundsSimilarityThreshold, settings->verbose );
1058
1059 //============================================ Report function results
1060 std::stringstream ssHlp;
1061 ssHlp << "New boundaries are: " << ret[1] - ret[0] + 1 << " x " << ret[3] - ret[2] + 1 << " x " << ret[5] - ret[4] + 1;
1062 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 3, ssHlp.str() );
1063
1064 //============================================ If need be, save boundaries to be used for all other structure
1065 if ( settings->useSameBounds && ( this->inputOrder == 0 ) )
1066 {
1067 for ( proshade_unsign iter = 0; iter < 6; iter++ ) { settings->forceBounds[iter] = ret[iter]; }
1068 }
1069 }
1070
1071 //================================================ Report function completion
1072 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 2, "New boundaries determined." );
1073
1074 //================================================ Done
1075 return ;
1076
1077 }
1078
1090 void ProSHADE_internal_data::ProSHADE_data::createNewMapFromBounds ( ProSHADE_settings* settings, ProSHADE_data*& newStr, proshade_signed* newBounds )
1091 {
1092 //================================================ Report function start
1093 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Creating new structure according to the new bounds." );
1094
1095 //================================================ Fill in basic info
1096 newStr->fileName = "N/A";
1097 newStr->fileType = ProSHADE_internal_io::MAP;
1098
1099 //================================================ Fill in new structure values
1100 newStr->xDimIndices = static_cast<proshade_signed> ( newBounds[1] ) - static_cast<proshade_signed> ( newBounds[0] ) + 1;
1101 newStr->yDimIndices = static_cast<proshade_signed> ( newBounds[3] ) - static_cast<proshade_signed> ( newBounds[2] ) + 1;
1102 newStr->zDimIndices = static_cast<proshade_signed> ( newBounds[5] ) - static_cast<proshade_signed> ( newBounds[4] ) + 1;
1103
1104 newStr->aAngle = this->aAngle;
1105 newStr->bAngle = this->aAngle;
1106 newStr->cAngle = this->aAngle;
1107
1108 newStr->xDimSize = static_cast<proshade_single> ( newStr->xDimIndices ) * ( this->xDimSize / static_cast<proshade_single> ( this->xDimIndices ) );
1109 newStr->yDimSize = static_cast<proshade_single> ( newStr->yDimIndices ) * ( this->yDimSize / static_cast<proshade_single> ( this->yDimIndices ) );
1110 newStr->zDimSize = static_cast<proshade_single> ( newStr->zDimIndices ) * ( this->zDimSize / static_cast<proshade_single> ( this->zDimIndices ) );
1111
1112 newStr->xGridIndices = newStr->xDimIndices;
1113 newStr->yGridIndices = newStr->yDimIndices;
1114 newStr->zGridIndices = newStr->zDimIndices;
1115
1116 newStr->xAxisOrder = this->xAxisOrder;
1117 newStr->yAxisOrder = this->yAxisOrder;
1118 newStr->zAxisOrder = this->zAxisOrder;
1119
1120 newStr->xAxisOrigin = this->xAxisOrigin + newBounds[0];
1121 newStr->yAxisOrigin = this->yAxisOrigin + newBounds[2];
1122 newStr->zAxisOrigin = this->zAxisOrigin + newBounds[4];
1123
1124 newStr->xFrom = this->xFrom + newBounds[0];
1125 newStr->yFrom = this->yFrom + newBounds[2];
1126 newStr->zFrom = this->zFrom + newBounds[4];
1127
1128 newStr->xTo = this->xTo - ( (this->xDimIndices-1) - newBounds[1] );
1129 newStr->yTo = this->yTo - ( (this->yDimIndices-1) - newBounds[3] );
1130 newStr->zTo = this->zTo - ( (this->zDimIndices-1) - newBounds[5] );
1131
1132 //================================================ Allocate new structure map
1133 newStr->internalMap = new proshade_double[newStr->xDimIndices * newStr->yDimIndices * newStr->zDimIndices];
1134 ProSHADE_internal_misc::checkMemoryAllocation ( newStr->internalMap, __FILE__, __LINE__, __func__ );
1135
1136 //================================================ Copy the map
1137 ProSHADE_internal_mapManip::copyMapByBounds ( newStr->xFrom, newStr->xTo, newStr->yFrom, newStr->yTo, newStr->zFrom, newStr->zTo,
1138 this->xFrom, this->yFrom, this->zFrom, newStr->yDimIndices, newStr->zDimIndices,
1139 this->xDimIndices, this->yDimIndices, this->zDimIndices, newStr->internalMap, this->internalMap );
1140
1141 //================================================ Report function completion
1142 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 2, "New structure created." );
1143
1144 //================================================ Done
1145 return ;
1146
1147 }
1148
1156 void ProSHADE_internal_data::ProSHADE_data::reSampleMap ( ProSHADE_settings* settings )
1157 {
1158 //================================================ Initialise the return variable
1159 proshade_single* changeVals = new proshade_single[6];
1160
1161 //================================================ Now re-sample the map
1162 if ( settings->changeMapResolution )
1163 {
1164 ProSHADE_internal_mapManip::reSampleMapToResolutionFourier ( this->internalMap, settings->requestedResolution, this->xDimIndices, this->yDimIndices, this->zDimIndices,
1165 this->xDimSize, this->yDimSize, this->zDimSize, changeVals );
1166
1167 if ( settings->changeMapResolutionTriLinear )
1168 {
1169 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" );
1170 }
1171 }
1172 if ( settings->changeMapResolutionTriLinear && !settings->changeMapResolution )
1173 {
1174 ProSHADE_internal_mapManip::reSampleMapToResolutionTrilinear ( this->internalMap, settings->requestedResolution, this->xDimIndices, this->yDimIndices, this->zDimIndices,
1175 this->xDimSize, this->yDimSize, this->zDimSize, changeVals );
1176
1177 }
1178
1179 //================================================ Set the internal values to reflect the new map size
1180 this->xDimIndices += static_cast<proshade_unsign> ( changeVals[0] );
1181 this->yDimIndices += static_cast<proshade_unsign> ( changeVals[1] );
1182 this->zDimIndices += static_cast<proshade_unsign> ( changeVals[2] );
1183
1184 this->xGridIndices = this->xDimIndices;
1185 this->yGridIndices = this->yDimIndices;
1186 this->zGridIndices = this->zDimIndices;
1187
1188 this->xTo += static_cast<proshade_unsign> ( changeVals[0] );
1189 this->yTo += static_cast<proshade_unsign> ( changeVals[1] );
1190 this->zTo += static_cast<proshade_unsign> ( changeVals[2] );
1191
1192 this->xDimSize = changeVals[3];
1193 this->yDimSize = changeVals[4];
1194 this->zDimSize = changeVals[5];
1195
1196 //================================================ Figure how much the new map moved
1197 proshade_single xMov = -( ( this->xFrom * ( this->xDimSize / static_cast<proshade_single> ( this->xDimIndices - changeVals[0] ) ) ) -
1198 ( this->xFrom * ( this->xDimSize / static_cast<proshade_single> ( this->xDimIndices ) ) ) );
1199 proshade_single yMov = -( ( this->yFrom * ( this->yDimSize / static_cast<proshade_single> ( this->yDimIndices - changeVals[1] ) ) ) -
1200 ( this->yFrom * ( this->yDimSize / static_cast<proshade_single> ( this->yDimIndices ) ) ) );
1201 proshade_single zMov = -( ( this->zFrom * ( this->zDimSize / static_cast<proshade_single> ( this->zDimIndices - changeVals[2] ) ) ) -
1202 ( this->zFrom * ( this->zDimSize / static_cast<proshade_single> ( this->zDimIndices ) ) ) );
1203
1204 //================================================ Move by indices (this should be sufficient)
1205 ProSHADE_internal_mapManip::moveMapByIndices ( &xMov, &yMov, &zMov, this->xDimSize, this->yDimSize, this->zDimSize, &this->xFrom, &this->xTo,
1206 &this->yFrom, &this->yTo, &this->zFrom, &this->zTo, &this->xAxisOrigin, &this->yAxisOrigin, &this->zAxisOrigin );
1207
1208 ProSHADE_internal_mapManip::moveMapByFourier ( this->internalMap, xMov, yMov, zMov, this->xDimSize, this->yDimSize, this->zDimSize,
1209 this->xDimIndices, this->yDimIndices, this->zDimIndices );
1210
1211 //================================================ Release memory
1212 delete[] changeVals;
1213
1214 //================================================ Done
1215 return ;
1216
1217 }
1218
1228 void ProSHADE_internal_data::ProSHADE_data::centreMapOnCOM ( ProSHADE_settings* settings )
1229 {
1230 //================================================ Report function start
1231 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Centering map onto its COM." );
1232
1233 //================================================ Initialise local variables
1234 proshade_unsign arrPos = 0;
1235 proshade_single xCOM = 0.0;
1236 proshade_single yCOM = 0.0;
1237 proshade_single zCOM = 0.0;
1238 proshade_single totDens = 0.0;
1239
1240 //================================================ Find the COM location
1241 for ( proshade_unsign xIt = 0; xIt < this->xDimIndices; xIt++ )
1242 {
1243 for ( proshade_unsign yIt = 0; yIt < this->yDimIndices; yIt++ )
1244 {
1245 for ( proshade_unsign zIt = 0; zIt < this->zDimIndices; zIt++ )
1246 {
1247 //==================================== Get index
1248 arrPos = zIt + this->zDimIndices * ( yIt + this->yDimIndices * xIt );
1249
1250 //==================================== Get COM
1251 if ( this->internalMap[arrPos] > 0.0 )
1252 {
1253 xCOM += static_cast<proshade_single> ( this->internalMap[arrPos] * xIt );
1254 yCOM += static_cast<proshade_single> ( this->internalMap[arrPos] * yIt );
1255 zCOM += static_cast<proshade_single> ( this->internalMap[arrPos] * zIt );
1256 totDens += static_cast<proshade_single> ( this->internalMap[arrPos] );
1257 }
1258 }
1259 }
1260 }
1261 xCOM /= totDens;
1262 yCOM /= totDens;
1263 zCOM /= totDens;
1264
1265 //================================================ Find distance from COM to map centre in Angstroms
1266 proshade_single xDist = ( static_cast<proshade_single> ( this->xDimIndices / 2.0 ) - xCOM ) * static_cast<proshade_single> ( this->xDimSize / this->xDimIndices );
1267 proshade_single yDist = ( static_cast<proshade_single> ( this->yDimIndices / 2.0 ) - yCOM ) * static_cast<proshade_single> ( this->yDimSize / this->yDimIndices );
1268 proshade_single zDist = ( static_cast<proshade_single> ( this->zDimIndices / 2.0 ) - zCOM ) * static_cast<proshade_single> ( this->zDimSize / this->zDimIndices );
1269
1270 //================================================ Move the map within the box
1271 ProSHADE_internal_mapManip::moveMapByFourier ( this->internalMap, xDist, yDist, zDist, this->xDimSize, this->yDimSize, this->zDimSize, this->xDimIndices, this->yDimIndices, this->zDimIndices );
1272
1273 //================================================ Report function completion
1274 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 2, "Map centered." );
1275
1276 //================================================ Done
1277 return ;
1278
1279 }
1280
1289 void ProSHADE_internal_data::ProSHADE_data::addExtraSpace ( ProSHADE_settings* settings )
1290 {
1291 //================================================ Report function start
1292 std::stringstream hlpSS;
1293 hlpSS << "Adding extra " << settings->addExtraSpace << " angstroms.";
1294 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, hlpSS.str() );
1295
1296 //================================================ Figure how much indices need to change
1297 proshade_unsign xAddIndices = ProSHADE_internal_mapManip::myRound ( settings->addExtraSpace / static_cast<proshade_single> ( this->xDimSize / this->xDimIndices ) );
1298 proshade_unsign yAddIndices = ProSHADE_internal_mapManip::myRound ( settings->addExtraSpace / static_cast<proshade_single> ( this->yDimSize / this->yDimIndices ) );
1299 proshade_unsign zAddIndices = ProSHADE_internal_mapManip::myRound ( settings->addExtraSpace / static_cast<proshade_single> ( this->zDimSize / this->zDimIndices ) );
1300
1301 //================================================ Update internal data variables
1302 this->xDimSize += static_cast<proshade_single> ( 2 * xAddIndices ) * static_cast<proshade_single> ( this->xDimSize / this->xDimIndices );
1303 this->yDimSize += static_cast<proshade_single> ( 2 * yAddIndices ) * static_cast<proshade_single> ( this->yDimSize / this->yDimIndices );
1304 this->zDimSize += static_cast<proshade_single> ( 2 * zAddIndices ) * static_cast<proshade_single> ( this->zDimSize / this->zDimIndices );
1305
1306 this->xDimIndices += 2 * xAddIndices;
1307 this->yDimIndices += 2 * yAddIndices;
1308 this->zDimIndices += 2 * zAddIndices;
1309
1310 this->xGridIndices = this->xDimIndices;
1311 this->yGridIndices = this->yDimIndices;
1312 this->zGridIndices = this->zDimIndices;
1313
1314 this->xAxisOrigin -= xAddIndices;
1315 this->yAxisOrigin -= yAddIndices;
1316 this->zAxisOrigin -= zAddIndices;
1317
1318 this->xFrom -= xAddIndices;
1319 this->yFrom -= yAddIndices;
1320 this->zFrom -= zAddIndices;
1321
1322 this->xTo += xAddIndices;
1323 this->yTo += yAddIndices;
1324 this->zTo += zAddIndices;
1325
1326 //================================================ Allocate new map
1327 proshade_double* newMap = new proshade_double[this->xDimIndices * this->yDimIndices * this->zDimIndices];
1328 ProSHADE_internal_misc::checkMemoryAllocation ( newMap, __FILE__, __LINE__, __func__ );
1329
1330 //================================================ Set new map to zeroes
1331 for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
1332 {
1333 newMap[iter] = 0.0;
1334 }
1335
1336 //================================================ Update the map
1337 proshade_unsign newMapIndex, oldMapIndex;
1338 for ( proshade_unsign xIt = 0; xIt < (this->xDimIndices - xAddIndices); xIt++ )
1339 {
1340 //============================================ Check if point is applicable
1341 if ( xIt < xAddIndices ) { continue; }
1342
1343 for ( proshade_unsign yIt = 0; yIt < (this->yDimIndices - yAddIndices); yIt++ )
1344 {
1345 //======================================== Check if point is applicable
1346 if ( yIt < yAddIndices ) { continue; }
1347
1348 for ( proshade_unsign zIt = 0; zIt < (this->zDimIndices - zAddIndices); zIt++ )
1349 {
1350 //==================================== Check if point is applicable
1351 if ( zIt < zAddIndices ) { continue; }
1352
1353 //==================================== Var init
1354 newMapIndex = zIt + this->zDimIndices * ( yIt + this->yDimIndices * xIt );
1355 oldMapIndex = (zIt - zAddIndices) + (this->zDimIndices - ( 2 * zAddIndices ) ) * ( (yIt - yAddIndices) + (this->yDimIndices - ( 2 * yAddIndices ) ) * (xIt - xAddIndices) );
1356
1357 newMap[newMapIndex] = this->internalMap[oldMapIndex];
1358 }
1359 }
1360 }
1361
1362 //================================================ Copy new to old
1363 delete[] this->internalMap;
1364
1365 this->internalMap = new proshade_double[this->xDimIndices * this->yDimIndices * this->zDimIndices];
1366 ProSHADE_internal_misc::checkMemoryAllocation ( this->internalMap, __FILE__, __LINE__, __func__ );
1367
1368 for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
1369 {
1370 this->internalMap[iter] = newMap[iter];
1371 }
1372
1373 //================================================ Release memory
1374 delete[] newMap;
1375
1376 //================================================ Report function completion
1377 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 2, "Extra space added." );
1378
1379 //================================================ Done
1380 return ;
1381
1382 }
1383
1398 void ProSHADE_internal_data::ProSHADE_data::processInternalMap ( ProSHADE_settings* settings )
1399 {
1400 //================================================ Invert map
1401 if ( settings->invertMap ) { this->invertMirrorMap ( settings ); }
1402 else { ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Map inversion (mirror image) not requested." ); }
1403
1404 //================================================ Normalise map
1405 if ( settings->normaliseMap ) { this->normaliseMap ( settings ); }
1406 else { ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Map normalisation not requested." ); }
1407
1408 //================================================ Compute mask
1409 //if ( settings->maskMap ) { if ( settings->useCorrelationMasking ) { this->maskMapCorrelation ( settings ); } else { this->maskMap ( settings ); } }
1410 if ( settings->maskMap ) { this->maskMap ( settings ); }
1411 else { ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Masking not requested." ); }
1412
1413 //================================================ Centre map
1414 if ( settings->moveToCOM ) { this->centreMapOnCOM ( settings ); }
1415 else { ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Map centering not requested." ); }
1416
1417 //================================================ Add extra space
1418 if ( settings->addExtraSpace != 0.0 ) { this->addExtraSpace ( settings ); }
1419 else { ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Extra space not requested." ); }
1420
1421 //================================================ Remove phase, if required
1422 if ( !settings->usePhase ) { this->removePhaseInormation ( settings ); ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Phase information removed from the data." ); }
1423 else { ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Phase information retained in the data." ); }
1424
1425 //================================================ Set settings values which were left on AUTO by user and will not be set later
1426 settings->setVariablesLeftOnAuto ( );
1427
1428 //================================================ Done
1429 return ;
1430
1431 }
1432
1442 void ProSHADE_internal_data::ProSHADE_data::getSpherePositions ( ProSHADE_settings* settings )
1443 {
1444 //================================================ Check the current settings value is set to auto
1445 if ( this->spherePos.size() != 0 )
1446 {
1447 std::stringstream hlpSS;
1448 hlpSS << "The sphere distances were determined as " << this->spherePos.at(0);
1449 for ( proshade_unsign iter = 1; iter < static_cast<proshade_unsign> ( this->spherePos.size() ); iter++ ) { hlpSS << "; " << this->spherePos.at(iter); }
1450 hlpSS << " Angstroms.";
1451 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 3, hlpSS.str() );
1452 return ;
1453 }
1454
1455 //================================================ Find maximum diagonal
1456 proshade_unsign maxDim = std::max ( this->xDimSize, std::max ( this->yDimSize, this->zDimSize ) );
1457 proshade_unsign minDim = std::min ( this->xDimSize, std::min ( this->yDimSize, this->zDimSize ) );
1458 proshade_unsign midDim = 0;
1459 if ( ( this->xDimSize < maxDim ) && ( this->xDimSize > minDim ) ) { midDim = this->xDimSize; }
1460 else if ( ( this->yDimSize < maxDim ) && ( this->yDimSize > minDim ) ) { midDim = this->yDimSize; }
1461 else { midDim = this->zDimSize; }
1462
1463 proshade_single maxDiag = std::sqrt ( std::pow ( static_cast<proshade_single> ( maxDim ), 2.0 ) +
1464 std::pow ( static_cast<proshade_single> ( midDim ), 2.0 ) );
1465
1466 //================================================ Set between the points
1467 for ( proshade_single iter = 0.5; ( iter * settings->maxSphereDists ) < ( maxDiag / 2.0 ); iter += 1.0 )
1468 {
1469 ProSHADE_internal_misc::addToSingleVector ( &this->spherePos, ( iter * settings->maxSphereDists ) );
1470 }
1471
1472 //================================================ Save the number of spheres
1473 this->noSpheres = static_cast<proshade_unsign> ( this->spherePos.size() );
1474
1475 //================================================ Report progress
1476 std::stringstream hlpSS;
1477 hlpSS << "The sphere distances were determined as " << this->spherePos.at(0);
1478 for ( proshade_unsign iter = 1; iter < static_cast<proshade_unsign> ( this->spherePos.size() ); iter++ ) { hlpSS << "; " << this->spherePos.at(iter); }
1479 hlpSS << " Angstroms.";
1480 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 3, hlpSS.str() );
1481
1482 //================================================ Done
1483 return ;
1484
1485 }
1486
1487
1499 void ProSHADE_internal_data::ProSHADE_data::mapToSpheres ( ProSHADE_settings* settings )
1500 {
1501 //================================================ Report progress
1502 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Starting sphere mapping procedure." );
1503
1504 //================================================ Determine spherical harmonics variables
1505 settings->determineAllSHValues ( this->xDimIndices, this->yDimIndices, this->zDimIndices );
1506 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 2, "Sphere settings determined." );
1507
1508 //================================================ Find number of spheres supported
1509 this->getSpherePositions ( settings );
1510 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 2, "Sphere positions obtained." );
1511
1512 //================================================ Create sphere objects and map the density
1513 this->spheres = new ProSHADE_internal_spheres::ProSHADE_sphere* [ this->noSpheres ];
1514 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( this->spherePos.size() ); iter++ )
1515 {
1516 std::stringstream ss;
1517 ss << "Now mapping sphere " << iter << " .";
1518 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 4, ss.str() );
1519
1520 this->spheres[iter] = new ProSHADE_internal_spheres::ProSHADE_sphere ( this->xDimIndices, this->yDimIndices, this->zDimIndices,
1521 this->xDimSize, this->yDimSize, this->zDimSize, iter,
1522 &this->spherePos, settings->progressiveSphereMapping, settings->maxBandwidth,
1523 this->internalMap, &this->maxShellBand );
1524 }
1525
1526 //================================================ Report completion
1527 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 2, "Sphere mapping procedure completed." );
1528
1529 //================================================ Done
1530 return ;
1531
1532 }
1533
1542 void ProSHADE_internal_data::ProSHADE_data::computeSphericalHarmonics ( ProSHADE_settings* settings )
1543 {
1544 //================================================ Report progress
1545 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Starting spherical harmonics decomposition." );
1546
1547 //================================================ Initialise memory
1548 this->sphericalHarmonics = new proshade_complex* [this->noSpheres];
1549 ProSHADE_internal_misc::checkMemoryAllocation ( this->sphericalHarmonics, __FILE__, __LINE__, __func__ );
1550 for ( proshade_unsign iter = 0; iter < this->noSpheres; iter++ )
1551 {
1552 this->sphericalHarmonics[iter] = new proshade_complex [(this->spheres[iter]->getLocalBandwidth() * 2) * (this->spheres[iter]->getLocalBandwidth() * 2)];
1553 ProSHADE_internal_misc::checkMemoryAllocation ( this->sphericalHarmonics[iter], __FILE__, __LINE__, __func__ );
1554 }
1555
1556 //================================================ Compute the spherical harmonics
1557 for ( proshade_unsign iter = 0; iter < this->noSpheres; iter++ )
1558 {
1559 //============================================ Report progress
1560 std::stringstream ss;
1561 ss << "Now decomposing sphere " << iter << ". " << "( Band is: " << this->spheres[iter]->getLocalBandwidth() << ").";
1562 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 4, ss.str() );
1563
1564 //============================================ Compute
1565 ProSHADE_internal_sphericalHarmonics::computeSphericalHarmonics ( this->spheres[iter]->getLocalBandwidth(), this->spheres[iter]->getMappedData(), this->sphericalHarmonics[iter] );
1566 }
1567
1568 //================================================ Report completion
1569 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 2, "Spherical harmonics decomposition complete." );
1570
1571 //======================================== Done
1572 return ;
1573
1574 }
1575
1587 void ProSHADE_internal_data::ProSHADE_data::detectSymmetryInStructure ( ProSHADE_settings* settings, std::vector< proshade_double* >* axes, std::vector < std::vector< proshade_double > >* allCs )
1588 {
1589 //================================================ Initialise variables
1590 std::vector< proshade_double* > CSyms = this->getCyclicSymmetriesList ( settings );
1591
1592 //================================================ Was any particular symmetry requested?
1593 if ( settings->requestedSymmetryType == "" )
1594 {
1595 //============================================ Run the symmetry detection functions for C, D, T, O and I symmetries
1596 std::vector< proshade_double* > DSyms = this->getDihedralSymmetriesList ( settings, &CSyms );
1597 std::vector< proshade_double* > ISyms = this->getIcosahedralSymmetriesList ( settings, &CSyms );
1598 std::vector< proshade_double* > OSyms; std::vector< proshade_double* > TSyms;
1599 if ( ISyms.size() < 31 ) { OSyms = this->getOctahedralSymmetriesList ( settings, &CSyms ); if ( OSyms.size() < 13 ) { TSyms = this->getTetrahedralSymmetriesList ( settings, &CSyms ); } }
1600
1601 //============================================ Decide on recommended symmetry
1602 this->saveRecommendedSymmetry ( settings, &CSyms, &DSyms, &TSyms, &OSyms, &ISyms, axes );
1603 }
1604
1605 if ( settings->requestedSymmetryType == "C" )
1606 {
1607 //============================================ Run only the C symmetry detection and search for requested fold
1608 this->saveRequestedSymmetryC ( settings, &CSyms, axes );
1609 }
1610
1611 if ( settings->requestedSymmetryType == "D" )
1612 {
1613 //============================================ Run only the D symmetry detection and search for requested fold
1614 std::vector< proshade_double* > DSyms = this->getDihedralSymmetriesList ( settings, &CSyms );
1615 this->saveRequestedSymmetryD ( settings, &DSyms, axes );
1616 }
1617
1618 if ( settings->requestedSymmetryType == "T" )
1619 {
1620 //============================================ Run only the T symmetry detection and search for requested fold
1621 std::vector< proshade_double* > TSyms = this->getTetrahedralSymmetriesList ( settings, &CSyms );
1622 settings->setRecommendedFold ( 0 );
1623 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) ); } }
1624 else { settings->setRecommendedSymmetry ( "" ); }
1625 }
1626
1627 if ( settings->requestedSymmetryType == "O" )
1628 {
1629 //============================================ Run only the O symmetry detection and search for requested fold
1630 std::vector< proshade_double* > OSyms = this->getOctahedralSymmetriesList ( settings, &CSyms );
1631 settings->setRecommendedFold ( 0 );
1632 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) ); } }
1633 else { settings->setRecommendedSymmetry ( "" ); }
1634 }
1635
1636 if ( settings->requestedSymmetryType == "I" )
1637 {
1638 //============================================ Run only the T symmetry detection and search for requested fold
1639 std::vector< proshade_double* > ISyms = this->getIcosahedralSymmetriesList ( settings, &CSyms );
1640 settings->setRecommendedFold ( 0 );
1641 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) ); } }
1642 else { settings->setRecommendedSymmetry ( "" ); }
1643 }
1644
1645 if ( ( settings->requestedSymmetryType != "" ) && ( settings->requestedSymmetryType != "C" ) && ( settings->requestedSymmetryType != "D" ) && ( settings->requestedSymmetryType != "T" ) && ( settings->requestedSymmetryType != "O" ) && ( settings->requestedSymmetryType != "I" ) )
1646 {
1647 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." );
1648 }
1649
1650 //================================================ Save C symmetries to argument and if different from settings, to the settings as well
1651 bool isArgSameAsSettings = true;
1652 for ( proshade_unsign cIt = 0; cIt < static_cast<proshade_unsign> ( CSyms.size() ); cIt++ )
1653 {
1654 std::vector< proshade_double > nextSym;
1655 ProSHADE_internal_misc::addToDoubleVector ( &nextSym, CSyms.at(cIt)[0] );
1656 ProSHADE_internal_misc::addToDoubleVector ( &nextSym, CSyms.at(cIt)[1] );
1657 ProSHADE_internal_misc::addToDoubleVector ( &nextSym, CSyms.at(cIt)[2] );
1658 ProSHADE_internal_misc::addToDoubleVector ( &nextSym, CSyms.at(cIt)[3] );
1659 ProSHADE_internal_misc::addToDoubleVector ( &nextSym, CSyms.at(cIt)[4] );
1660 ProSHADE_internal_misc::addToDoubleVector ( &nextSym, CSyms.at(cIt)[5] );
1661 ProSHADE_internal_misc::addToDoubleVectorVector ( allCs, nextSym );
1662
1663 if ( ( cIt == 0 ) && ( settings->allDetectedCAxes.size() == 0 ) ) { isArgSameAsSettings = false; }
1664 if ( !isArgSameAsSettings ) { ProSHADE_internal_misc::addToDoubleVectorVector ( &settings->allDetectedCAxes, nextSym ); }
1665
1666 nextSym.clear ( );
1667 }
1668
1669 //================================================ Release memory
1670 for ( proshade_unsign it = 0; it < static_cast<proshade_unsign> ( CSyms.size() ); it++ ) { delete[] CSyms.at(it); }
1671
1672 //================================================ Done
1673 return ;
1674
1675 }
1676
1684 void ProSHADE_internal_data::ProSHADE_data::detectSymmetryInStructurePython ( ProSHADE_settings* settings )
1685 {
1686 //================================================ Run the algorithm
1687 this->detectSymmetryInStructure ( settings, &settings->detectedSymmetry, &settings->allDetectedCAxes );
1688
1689 //================================================ Done
1690 return ;
1691
1692 }
1693
1707 void ProSHADE_internal_data::ProSHADE_data::detectSymmetryFromAngleAxisSpace ( ProSHADE_settings* settings, std::vector< proshade_double* >* axes, std::vector < std::vector< proshade_double > >* allCs )
1708 {
1709 //================================================ Modify axis tolerance and matrix tolerance by sampling, if required by user
1710 if ( settings->axisErrToleranceDefault )
1711 {
1712 settings->axisErrTolerance = std::max ( 0.01, ( 2.0 * M_PI ) / this->maxShellBand );
1713 }
1714 // proshade_double matrixTolerance = ( M_PI / ( this->maxShellBand ) );
1715
1716 //================================================ If C was requested, we will do it immediately - this allows for a significant speed-up.
1717 if ( settings->requestedSymmetryType == "C" )
1718 {
1719 //============================================ Report progress
1720 std::stringstream hlpSS;
1721 hlpSS << "Starting detection of cyclic point group C" << settings->requestedSymmetryFold;
1722 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, hlpSS.str() );
1723
1724 //============================================ Do simplified search only in the applicable data
1725 proshade_double symThres = 0.0;
1726 std::vector< proshade_double* > CSyms = this->findRequestedCSymmetryFromAngleAxis ( settings, settings->requestedSymmetryFold, &symThres );
1727
1728 //============================================ Save the best axis as the recommended one
1729 if ( settings->detectedSymmetry.size() == 0 ) { if ( CSyms.size() > 0 ) { settings->setDetectedSymmetry ( CSyms.at(0) ); } }
1730 if ( CSyms.size() > 0 )
1731 {
1732 settings->setRecommendedSymmetry ( "C" );
1733 settings->setRecommendedFold ( settings->requestedSymmetryFold );
1734
1735 ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( axes, CSyms.at(0) );
1736 this->saveDetectedSymmetries ( settings, &CSyms, allCs );
1737 }
1738 else
1739 {
1740 settings->setRecommendedSymmetry ( "" );
1741 settings->setRecommendedFold ( 0 );
1742 }
1743
1744 //============================================ Done
1745 return ;
1746 }
1747
1748 //============================================ Report progress
1749 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Starting C symmetry detection." );
1750
1751 //================================================ Initialise variables
1752 std::vector< proshade_double* > CSyms = getCyclicSymmetriesListFromAngleAxis ( settings );
1753
1754 //================================================ Sanity check - was the rotation function mapped properly?
1755 if ( this->sphereMappedRotFun.size() < 1 )
1756 {
1757 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." );
1758 }
1759
1760 //================================================ Sanity check - was any symmetry requested?
1761 if ( ( settings->requestedSymmetryType != "" ) && ( settings->requestedSymmetryType != "C" ) && ( settings->requestedSymmetryType != "D" ) && ( settings->requestedSymmetryType != "T" ) && ( settings->requestedSymmetryType != "O" ) && ( settings->requestedSymmetryType != "I" ) )
1762 {
1763 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." );
1764 }
1765
1766 //================================================ Are we doing general search?
1767 if ( settings->requestedSymmetryType == "" )
1768 {
1769 //============================================ Run the symmetry detection functions for C, D, T, O and I symmetries
1770 std::vector< proshade_double* > DSyms = this->getDihedralSymmetriesList ( settings, &CSyms );
1771 std::vector< proshade_double* > ISyms = this->getIcosahedralSymmetriesList ( settings, &CSyms ); //, matrixTolerance );
1772 std::vector< proshade_double* > OSyms; std::vector< proshade_double* > TSyms;
1773 if ( ISyms.size() < 31 ) { OSyms = this->getOctahedralSymmetriesList ( settings, &CSyms ); //, matrixTolerance );
1774 if ( OSyms.size() < 13 ) { TSyms = this->getTetrahedralSymmetriesList ( settings, &CSyms ); } }
1775
1776 //============================================ Decide on recommended symmetry
1777 this->saveRecommendedSymmetry ( settings, &CSyms, &DSyms, &TSyms, &OSyms, &ISyms, axes );
1778 }
1779
1780 if ( settings->requestedSymmetryType == "D" )
1781 {
1782 //============================================ Run only the D symmetry detection and search for requested fold
1783 std::vector< proshade_double* > DSyms = this->getDihedralSymmetriesList ( settings, &CSyms );
1784 this->saveRequestedSymmetryD ( settings, &DSyms, axes );
1785 }
1786
1787 if ( settings->requestedSymmetryType == "T" )
1788 {
1789 //============================================ Run only the T symmetry detection and search for requested fold
1790 std::cerr << "Sadly, this functionality is not yet implemented. Please use the -z option to use the original peak searching symmetry detection algorithm." << std::endl;
1791 // std::vector< proshade_double* > TSyms = this->getTetrahedralSymmetriesList ( settings, &CSyms );
1792 // settings->setRecommendedFold ( 0 );
1793 // 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) ); } }
1794 // else { settings->setRecommendedSymmetry ( "" ); }
1795 }
1796
1797 if ( settings->requestedSymmetryType == "O" )
1798 {
1799 std::cerr << "Sadly, this functionality is not yet implemented. Please use the -z option to use the original peak searching symmetry detection algorithm." << std::endl;
1800 }
1801
1802 if ( settings->requestedSymmetryType == "I" )
1803 {
1804 std::cerr << "Sadly, this functionality is not yet implemented. Please use the -z option to use the original peak searching symmetry detection algorithm." << std::endl;
1805 }
1806
1807 //================================================ Save C symmetries to argument and if different from settings, to the settings as well
1808 this->saveDetectedSymmetries ( settings, &CSyms, allCs );
1809
1810 //================================================ Done
1811 return ;
1812
1813 }
1814
1828 void ProSHADE_internal_data::ProSHADE_data::saveDetectedSymmetries ( ProSHADE_settings* settings, std::vector< proshade_double* >* CSyms, std::vector < std::vector< proshade_double > >* allCs )
1829 {
1830 //================================================ Initialise variables
1831 bool isArgSameAsSettings = true;
1832
1833 //================================================ For each detected point group
1834 for ( proshade_unsign cIt = 0; cIt < static_cast<proshade_unsign> ( CSyms->size() ); cIt++ )
1835 {
1836 //============================================ Create vector to replace the pointer
1837 std::vector< proshade_double > nextSym;
1838 ProSHADE_internal_misc::addToDoubleVector ( &nextSym, CSyms->at(cIt)[0] );
1839 ProSHADE_internal_misc::addToDoubleVector ( &nextSym, CSyms->at(cIt)[1] );
1840 ProSHADE_internal_misc::addToDoubleVector ( &nextSym, CSyms->at(cIt)[2] );
1841 ProSHADE_internal_misc::addToDoubleVector ( &nextSym, CSyms->at(cIt)[3] );
1842 ProSHADE_internal_misc::addToDoubleVector ( &nextSym, CSyms->at(cIt)[4] );
1843 ProSHADE_internal_misc::addToDoubleVector ( &nextSym, CSyms->at(cIt)[5] );
1844 ProSHADE_internal_misc::addToDoubleVectorVector ( allCs, nextSym );
1845
1846 //============================================ Copy the vector to output variable and if different, then also to settings object
1847 if ( ( cIt == 0 ) && ( settings->allDetectedCAxes.size() == 0 ) ) { isArgSameAsSettings = false; }
1848 if ( !isArgSameAsSettings ) { ProSHADE_internal_misc::addToDoubleVectorVector ( &settings->allDetectedCAxes, nextSym ); }
1849
1850 //============================================ Release memory
1851 nextSym.clear ( );
1852 delete[] CSyms->at(cIt);
1853 }
1854
1855 //================================================ Done
1856 return ;
1857
1858 }
1859
1860
1870 proshade_double ProSHADE_internal_data::ProSHADE_data::findBestCScore ( std::vector< proshade_double* >* CSym, proshade_unsign* symInd )
1871 {
1872 //================================================ Sanity check
1873 if ( CSym->size() == 0 ) { *symInd = 0; return ( 0.0 ); }
1874
1875 //================================================ Initalise variables
1876 proshade_double ret = CSym->at(0)[5];
1877 *symInd = 0;
1878 proshade_double frac = 0.0;
1879
1880 //================================================ Check all other axes
1881 // THIS NEEDS TO BE IMPROVED USING THE MAXIMUM LIKELIHOOD FOR THIS FOLD
1882 for ( proshade_unsign ind = 1; ind < static_cast<proshade_unsign>( CSym->size() ); ind++ )
1883 {
1884 //============================================ If higher fold than already leading one (do not care for lower fold and lower average height axes)
1885 if ( CSym->at(ind)[0] > CSym->at(*symInd)[0] )
1886 {
1887 //======================================== How much higher fold is it? Also, adding some protection against large syms supported only by a subset and a minimum requirement.
1888 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] );
1889
1890 //======================================== Check if the new is "better" according to this criteria.
1891 if ( frac >= 1.0 && ( ( CSym->at(*symInd)[5] * 0.85 ) < CSym->at(ind)[5] ) )
1892 {
1893 //==================================== And it is! Save and try next one.
1894 *symInd = ind;
1895 ret = CSym->at(ind)[5];
1896 }
1897 }
1898 }
1899
1900 //================================================ Done
1901 return ( ret );
1902
1903 }
1904
1914 proshade_double ProSHADE_internal_data::ProSHADE_data::findBestDScore ( std::vector< proshade_double* >* DSym, proshade_unsign* symInd )
1915 {
1916 //================================================ Sort the vector
1917 std::sort ( DSym->begin(), DSym->end(), ProSHADE_internal_misc::sortDSymHlpInv );
1918
1919 //================================================ Initalise variables
1920 proshade_double ret = 0.0;
1921 proshade_double frac = 0.0;
1922 if ( DSym->size() > 0 )
1923 {
1924 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] );
1925 *symInd = 0;
1926 }
1927 else { return ( ret ); }
1928
1929 //================================================ Check all other axes
1930 // THIS NEEDS TO BE IMPROVED USING THE MAXIMUM LIKELIHOOD FOR THIS FOLD
1931 for ( proshade_unsign ind = 1; ind < static_cast<proshade_unsign>( DSym->size() ); ind++ )
1932 {
1933 //============================================ If higher fold than already leading one (do not care for lower fold and lower average height axes)
1934 if ( ( DSym->at(ind)[0] + DSym->at(ind)[6] ) > ( DSym->at(*symInd)[0] + DSym->at(*symInd)[6] ) )
1935 {
1936 //======================================== How much higher fold is it? Also, adding some protection against large syms supported only by a subset and a minimum requirement.
1937 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 );
1938
1939 //======================================== Check if the new is "better" according to this criteria.
1940 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] ) )
1941 {
1942 //==================================== And it is! Save and try next one.
1943 *symInd = ind;
1944 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] );
1945 }
1946 }
1947 }
1948
1949 //================================================ Done
1950 return ( ret );
1951
1952 }
1953
1962 proshade_double ProSHADE_internal_data::ProSHADE_data::findTScore ( std::vector< proshade_double* >* TSym )
1963 {
1964 //================================================ Initialise variables
1965 proshade_double ret = 0.0;
1966 proshade_double foldSum = 0.0;
1967
1968 //================================================ Check the T symmetry for being complete
1969 if ( TSym->size() == 7 )
1970 {
1971 //============================================ Compute the weighted fold
1972 for ( proshade_unsign cIt = 0; cIt < static_cast<proshade_unsign> ( TSym->size() ); cIt++ )
1973 {
1974 ret += TSym->at(cIt)[0] * TSym->at(cIt)[5];
1975 foldSum += TSym->at(cIt)[0];
1976 }
1977
1978 //============================================ Weight
1979 ret /= foldSum;
1980 }
1981
1982 //================================================ Done
1983 return ( ret );
1984
1985 }
1986
1995 proshade_double ProSHADE_internal_data::ProSHADE_data::findOScore ( std::vector< proshade_double* >* OSym )
1996 {
1997 //================================================ Initialise variables
1998 proshade_double ret = 0.0;
1999 proshade_double foldSum = 0.0;
2000
2001 //================================================ Check the O symmetry for being complete
2002 if ( OSym->size() == 13 )
2003 {
2004 //============================================ Compute the weighted fold
2005 for ( proshade_unsign cIt = 0; cIt < static_cast<proshade_unsign> ( OSym->size() ); cIt++ )
2006 {
2007 ret += OSym->at(cIt)[0] * OSym->at(cIt)[5];
2008 foldSum += OSym->at(cIt)[0];
2009 }
2010
2011 //============================================ Weight
2012 ret /= foldSum;
2013 }
2014
2015 //================================================ Done
2016 return ( ret );
2017
2018 }
2019
2028 proshade_double ProSHADE_internal_data::ProSHADE_data::findIScore ( std::vector< proshade_double* >* ISym )
2029 {
2030 //================================================ Initialise variables
2031 proshade_double ret = 0.0;
2032 proshade_double foldSum = 0.0;
2033
2034 //================================================ Check the T symmetry for being complete
2035 if ( ISym->size() == 31 )
2036 {
2037 //============================================ Compute the weighted fold
2038 for ( proshade_unsign cIt = 0; cIt < static_cast<proshade_unsign> ( ISym->size() ); cIt++ )
2039 {
2040 ret += ISym->at(cIt)[0] * ISym->at(cIt)[5];
2041 foldSum += ISym->at(cIt)[0];
2042 }
2043
2044 //============================================ Weight
2045 ret /= foldSum;
2046 }
2047
2048 //================================================ Done
2049 return ( ret );
2050
2051 }
2052
2067 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 )
2068 {
2069 //================================================ Initialise variables
2070 proshade_double cScore = 0.0, dScore = 0.0, tScore = 0.0, oScore = 0.0, iScore = 0.0;
2071 proshade_unsign bestCIndex, bestDIndex;
2072
2073 //================================================ Find a score for each input symmetry type.
2074 cScore = this->findBestCScore ( CSym, &bestCIndex );
2075 dScore = this->findBestDScore ( DSym, &bestDIndex );
2076 tScore = this->findTScore ( TSym );
2077 oScore = this->findOScore ( OSym );
2078 iScore = this->findIScore ( ISym );
2079
2080 //================================================ Find the best available score - !!! Modified weights for the predicted symmetries as they have heights 0.0 (predicted) ...
2081 proshade_double bestWeightedScore = std::max ( cScore, std::max ( dScore * 1.1, std::max ( tScore * 3000.0, std::max ( oScore * 4000.0, iScore * 5000.0 ) ) ) );
2082
2083 //================================================ No score? Well, no symmetry.
2084 if ( bestWeightedScore < 0.05 ) { settings->setRecommendedSymmetry ( "" ); return; }
2085
2086 if ( bestWeightedScore == cScore )
2087 {
2088 settings->setRecommendedSymmetry ( "C" );
2089 settings->setRecommendedFold ( CSym->at(bestCIndex)[0] );
2090 ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( axes, CSym->at(bestCIndex) );
2091 if ( settings->detectedSymmetry.size() == 0 ) { settings->setDetectedSymmetry ( CSym->at(bestCIndex) ); }
2092
2093 //============================================ Warn if resolution does not really support this fold
2094 if ( ( ( 360.0 / static_cast<double> ( CSym->at(bestCIndex)[0] ) ) - ( 360.0 / static_cast<double> ( CSym->at(bestCIndex)[0] + 1 ) ) ) <
2095 ( 360.0 / static_cast<double> ( settings->maxBandwidth * 4.0 ) ) )
2096 {
2097 std::stringstream hlpSS;
2098 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).";
2099 ProSHADE_internal_messages::printWarningMessage ( settings->verbose, hlpSS.str(), "WS00054" );
2100 }
2101 }
2102 if ( bestWeightedScore == dScore * 1.1 )
2103 {
2104 settings->setRecommendedSymmetry ( "D" );
2105 settings->setRecommendedFold ( std::max ( DSym->at(bestDIndex)[0], DSym->at(bestDIndex)[6] ) );
2106 ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( axes, DSym->at(bestDIndex) );
2107 ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( axes, &DSym->at(bestDIndex)[6] );
2108 if ( settings->detectedSymmetry.size() == 0 )
2109 {
2110 settings->setDetectedSymmetry ( DSym->at(bestDIndex) );
2111 settings->setDetectedSymmetry ( &DSym->at(bestDIndex)[6] );
2112 }
2113
2114 //============================================ Warn if resolution does not really support this fold
2115 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 ) ) ) <
2116 ( 360.0 / static_cast<double> ( settings->maxBandwidth * 4.0 ) ) )
2117 {
2118 std::stringstream hlpSS;
2119 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).";
2120 ProSHADE_internal_messages::printWarningMessage ( settings->verbose, hlpSS.str(), "WS00054" );
2121 }
2122 }
2123 if ( bestWeightedScore == tScore * 3000.0 )
2124 {
2125 settings->setRecommendedSymmetry ( "T" );
2126 settings->setRecommendedFold ( 0 );
2127 for ( proshade_unsign it = 0; it < static_cast<proshade_unsign> ( TSym->size() ); it++ ) { ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( axes, TSym->at(it) ); }
2128 if ( settings->detectedSymmetry.size() == 0 ) { for ( proshade_unsign it = 0; it < static_cast<proshade_unsign> ( TSym->size() ); it++ ) { settings->setDetectedSymmetry ( TSym->at(it) ); } }
2129 }
2130 if ( bestWeightedScore == oScore * 4000.0 )
2131 {
2132 settings->setRecommendedSymmetry ( "O" );
2133 settings->setRecommendedFold ( 0 );
2134 for ( proshade_unsign it = 0; it < static_cast<proshade_unsign> ( OSym->size() ); it++ ) { ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( axes, OSym->at(it) ); }
2135 if ( settings->detectedSymmetry.size() == 0 ) { for ( proshade_unsign it = 0; it < static_cast<proshade_unsign> ( OSym->size() ); it++ ) { settings->setDetectedSymmetry ( OSym->at(it) ); } }
2136 }
2137 if ( bestWeightedScore == iScore * 5000.0 )
2138 {
2139 settings->setRecommendedSymmetry ( "I" );
2140 settings->setRecommendedFold ( 0 );
2141 for ( proshade_unsign it = 0; it < static_cast<proshade_unsign> ( ISym->size() ); it++ ) { ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( axes, ISym->at(it) ); }
2142 if ( settings->detectedSymmetry.size() == 0 ) { for ( proshade_unsign it = 0; it < static_cast<proshade_unsign> ( ISym->size() ); it++ ) { settings->setDetectedSymmetry ( ISym->at(it) ); } }
2143 }
2144
2145 //================================================ Done
2146 return ;
2147
2148 }
2149
2161 void ProSHADE_internal_data::ProSHADE_data::saveRequestedSymmetryC ( ProSHADE_settings* settings, std::vector< proshade_double* >* CSym, std::vector< proshade_double* >* axes )
2162 {
2163 //================================================ Initialise variables
2164 proshade_unsign bestIndex = 0;
2165 proshade_double highestSym = 0.0;
2166
2167 //================================================ Search for best fold
2168 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( CSym->size() ); iter++ )
2169 {
2170 //============================================ Check if it is tbe correct fold
2171 if ( CSym->at(iter)[0] != settings->requestedSymmetryFold ) { continue; }
2172
2173 //============================================ If correct, is it the highest found?
2174 if ( CSym->at(iter)[5] > highestSym )
2175 {
2176 highestSym = CSym->at(iter)[5];
2177 bestIndex = iter;
2178 }
2179 }
2180
2181 //================================================ Found?
2182 if ( highestSym > 0.0 )
2183 {
2184 settings->setRecommendedSymmetry ( "C" );
2185 settings->setRecommendedFold ( CSym->at(bestIndex)[0] );
2186 ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( axes, CSym->at(bestIndex) );
2187
2188 if ( settings->detectedSymmetry.size() == 0 ) { settings->setDetectedSymmetry ( CSym->at(bestIndex) ); }
2189 }
2190 else
2191 {
2192 settings->setRecommendedSymmetry ( "" );
2193 settings->setRecommendedFold ( 0 );
2194 }
2195
2196 //================================================ Done
2197 return ;
2198
2199 }
2200
2212 void ProSHADE_internal_data::ProSHADE_data::saveRequestedSymmetryD ( ProSHADE_settings* settings, std::vector< proshade_double* >* DSym, std::vector< proshade_double* >* axes )
2213 {
2214 //================================================ Initialise variables
2215 proshade_unsign bestIndex = 0;
2216 proshade_double highestSym = 0.0;
2217
2218 //================================================ Search for best fold
2219 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( DSym->size() ); iter++ )
2220 {
2221 //============================================ Check if it is tbe correct fold
2222 if ( std::max ( DSym->at(iter)[0], DSym->at(iter)[6] ) != settings->requestedSymmetryFold ) { continue; }
2223
2224 //============================================ If correct, is it the highest found?
2225 if ( ( DSym->at(iter)[5] + DSym->at(iter)[11] ) > highestSym )
2226 {
2227 highestSym = ( DSym->at(iter)[5] + DSym->at(iter)[11] );
2228 bestIndex = iter;
2229 }
2230 }
2231
2232 //================================================ Found?
2233 if ( highestSym > 0.0 )
2234 {
2235 settings->setRecommendedSymmetry ( "D" );
2236 settings->setRecommendedFold ( std::max ( DSym->at(bestIndex)[0], DSym->at(bestIndex)[6] ) );
2237 ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( axes, DSym->at(bestIndex) );
2238 ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( axes, &DSym->at(bestIndex)[6] );
2239
2240 if ( settings->detectedSymmetry.size() == 0 )
2241 {
2242 settings->setDetectedSymmetry ( DSym->at(bestIndex) );
2243 settings->setDetectedSymmetry ( &DSym->at(bestIndex)[6] );
2244 }
2245 }
2246 else
2247 {
2248 settings->setRecommendedSymmetry ( "" );
2249 settings->setRecommendedFold ( 0 );
2250 }
2251
2252 //================================================ Done
2253 return ;
2254
2255 }
2256
2263 std::vector<std::vector< proshade_double > > ProSHADE_internal_data::ProSHADE_data::computeGroupElementsForGroup ( std::vector<std::vector< proshade_double > >* allCSyms, proshade_unsign grPosition )
2264 {
2265 //================================================ Sanity check
2266 if ( grPosition >= static_cast<proshade_unsign> ( allCSyms->size() ) )
2267 {
2268 std::stringstream hlpSS;
2269 hlpSS << "The request for group elements of group " << grPosition << " cannot be\n : processed, as the list of all groups does not have\n : group with this index.";
2270 throw ProSHADE_exception ( "Requested group elements for group which does not exist.", "ES00057", __FILE__, __LINE__, __func__, hlpSS.str() );
2271 }
2272
2273 //================================================ Initialise variables
2274 std::vector<std::vector< proshade_double > > ret;
2275 proshade_double groupAngle = ( 2 * M_PI ) / static_cast<proshade_double> ( allCSyms->at(grPosition).at(0) );
2276 proshade_double thisElementAngle;
2277 proshade_double* rotMat = new proshade_double[9];
2278 ProSHADE_internal_misc::checkMemoryAllocation ( rotMat, __FILE__, __LINE__, __func__ );
2279
2280 //================================================ Generate Cn elements
2281
2282 for ( proshade_unsign elIt = 1; elIt < static_cast<proshade_unsign> ( allCSyms->at(grPosition).at(0) ); elIt++ )
2283 {
2284 //============================================ Find the element angle
2285 thisElementAngle = static_cast<proshade_double> ( elIt ) * groupAngle;
2286
2287 //============================================ Combine it with the group axis and get rotation matrix
2288 ProSHADE_internal_maths::getRotationMatrixFromAngleAxis ( rotMat,
2289 allCSyms->at(grPosition).at(1),
2290 allCSyms->at(grPosition).at(2),
2291 allCSyms->at(grPosition).at(3),
2292 thisElementAngle );
2293
2294 //============================================ Save the element rotation matrix to the return vector
2295 std::vector<proshade_double> retEl;
2296 for ( unsigned int matIt = 0; matIt < 9; matIt++ )
2297 {
2298 ProSHADE_internal_misc::addToDoubleVector ( &retEl, rotMat[matIt] );
2299 }
2300 ProSHADE_internal_misc::addToDoubleVectorVector ( &ret, retEl );
2301 }
2302
2303 //================================================ Release memory
2304 delete[] rotMat;
2305
2306 //================================================ Done
2307 return ( ret );
2308
2309 }
2310
2317 std::vector<std::vector< proshade_double > > ProSHADE_internal_data::ProSHADE_data::computeGroupElementsForGroup ( std::vector< proshade_double* >* allCSyms, proshade_unsign grPosition )
2318 {
2319 //================================================ Sanity check
2320 if ( grPosition >= static_cast<proshade_unsign> ( allCSyms->size() ) )
2321 {
2322 std::stringstream hlpSS;
2323 hlpSS << "The request for group elements of group " << grPosition << " cannot be\n : processed, as the list of all groups does not have\n : group with this index.";
2324 throw ProSHADE_exception ( "Requested group elements for group which does not exist.", "ES00057", __FILE__, __LINE__, __func__, hlpSS.str() );
2325 }
2326
2327 //================================================ Initialise variables
2328 std::vector<std::vector< proshade_double > > ret;
2329 proshade_double groupAngle = ( 2 * M_PI ) / static_cast<proshade_double> ( allCSyms->at(grPosition)[0] );
2330 proshade_double thisElementAngle;
2331 proshade_double* rotMat = new proshade_double[9];
2332 ProSHADE_internal_misc::checkMemoryAllocation ( rotMat, __FILE__, __LINE__, __func__ );
2333
2334 //================================================ Generate Cn elements
2335
2336 for ( proshade_unsign elIt = 1; elIt < static_cast<proshade_unsign> ( allCSyms->at(grPosition)[0] ); elIt++ )
2337 {
2338 //============================================ Find the element angle
2339 thisElementAngle = static_cast<proshade_double> ( elIt ) * groupAngle;
2340
2341 //============================================ Combine it with the group axis and get rotation matrix
2342 ProSHADE_internal_maths::getRotationMatrixFromAngleAxis ( rotMat,
2343 allCSyms->at(grPosition)[1],
2344 allCSyms->at(grPosition)[2],
2345 allCSyms->at(grPosition)[3],
2346 thisElementAngle );
2347
2348 //============================================ Save the element rotation matrix to the return vector
2349 std::vector<proshade_double> retEl;
2350 for ( unsigned int matIt = 0; matIt < 9; matIt++ )
2351 {
2352 ProSHADE_internal_misc::addToDoubleVector ( &retEl, rotMat[matIt] );
2353 }
2354 ProSHADE_internal_misc::addToDoubleVectorVector ( &ret, retEl );
2355 }
2356
2357 //================================================ Release memory
2358 delete[] rotMat;
2359
2360 //================================================ Done
2361 return ( ret );
2362
2363 }
2364
2371 void axesToGroupTypeSanityCheck ( proshade_unsign requiredAxes, proshade_unsign obtainedAxes, std::string groupType )
2372 {
2373 //================================================ Sanity check
2374 if ( obtainedAxes != requiredAxes )
2375 {
2376 std::stringstream hlpSS;
2377 hlpSS << "The supplied number of axes for group element\n : detection ( >" << obtainedAxes << "< ) does not match the group type ( >" << groupType << "< ).";
2378 throw ProSHADE_exception ( "Mismatch between supplied number of axes and\n : symmetry type.", "ES00059", __FILE__, __LINE__, __func__, hlpSS.str() );
2379 }
2380
2381 //================================================ Done
2382 return ;
2383
2384 }
2385
2390 void prependIdentity ( std::vector<std::vector< proshade_double > >* vecToPrepend )
2391 {
2392 //================================================ Create the identity element
2393 std::vector< proshade_double > identity;
2394 ProSHADE_internal_misc::addToDoubleVector ( &identity, 1.0 );
2395 ProSHADE_internal_misc::addToDoubleVector ( &identity, 0.0 );
2396 ProSHADE_internal_misc::addToDoubleVector ( &identity, 0.0 );
2397 ProSHADE_internal_misc::addToDoubleVector ( &identity, 0.0 );
2398 ProSHADE_internal_misc::addToDoubleVector ( &identity, 1.0 );
2399 ProSHADE_internal_misc::addToDoubleVector ( &identity, 0.0 );
2400 ProSHADE_internal_misc::addToDoubleVector ( &identity, 0.0 );
2401 ProSHADE_internal_misc::addToDoubleVector ( &identity, 0.0 );
2402 ProSHADE_internal_misc::addToDoubleVector ( &identity, 1.0 );
2403
2404 //================================================ Prepend identity as first element
2405 vecToPrepend->insert ( vecToPrepend->begin() , identity );
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 {
2522 ProSHADE_internal_misc::addToDoubleVectorVector ( &ret, product );
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 = this->computeGroupElementsForGroup ( &settings->allDetectedCAxes, axesList.at(0) );
2565
2566 //============================================ Prepend identity element
2567 prependIdentity ( &ret );
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 = this->computeGroupElementsForGroup ( &settings->allDetectedCAxes, axesList.at(0) );
2583 std::vector<std::vector< proshade_double > > second = this->computeGroupElementsForGroup ( &settings->allDetectedCAxes, axesList.at(1) );
2584
2585 //============================================ Join the element lists
2586 ret = joinElementsFromDifferentGroups ( &first, &second, matrixTolerance, true );
2587
2588 //============================================ Prepend identity element
2589 prependIdentity ( &ret );
2590
2591 //============================================ Check the element to form a group
2592 if ( checkElementsFormGroup ( &ret, matrixTolerance ) ) { return ( ret ); }
2593 else
2594 {
2595 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." );
2596 }
2597 }
2598 else if ( groupType == "T" )
2599 {
2600 //============================================ Sanity check
2601 axesToGroupTypeSanityCheck ( 7, static_cast<proshade_unsign> ( axesList.size() ), groupType );
2602
2603 //============================================ Generate elements for all four C3 axes first
2604 for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
2605 {
2606 //======================================== If this is a C3 axis
2607 if ( settings->allDetectedCAxes.at(axesList.at(grIt)).at(0) == 3 )
2608 {
2609 //==================================== Generate the elements
2610 std::vector<std::vector< proshade_double > > els = this->computeGroupElementsForGroup ( &settings->allDetectedCAxes, axesList.at(grIt) );
2611
2612 //==================================== Join the elements to any already found
2613 ret = joinElementsFromDifferentGroups ( &els, &ret, matrixTolerance, false );
2614 }
2615 }
2616
2617 //============================================ Generate elements for all three C2 axes second
2618 for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
2619 {
2620 //======================================== If this is a C3 axis
2621 if ( settings->allDetectedCAxes.at(axesList.at(grIt)).at(0) == 2 )
2622 {
2623 //==================================== Generate the elements
2624 std::vector<std::vector< proshade_double > > els = this->computeGroupElementsForGroup ( &settings->allDetectedCAxes, axesList.at(grIt) );
2625
2626 //==================================== Join the elements to any already found
2627 ret = joinElementsFromDifferentGroups ( &els, &ret, matrixTolerance, false );
2628 }
2629 }
2630
2631 //============================================ Prepend identity element
2632 prependIdentity ( &ret );
2633
2634 //============================================ Check the element to form a group
2635 if ( checkElementsFormGroup ( &ret, matrixTolerance ) ) { return ( ret ); }
2636 else
2637 {
2638 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." );
2639 }
2640 }
2641 else if ( groupType == "O" )
2642 {
2643 //============================================ Sanity check
2644 axesToGroupTypeSanityCheck ( 13, static_cast<proshade_unsign> ( axesList.size() ), groupType );
2645
2646 //============================================ Generate elements for all three C4 axes first
2647 for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
2648 {
2649 //======================================== If this is a C3 axis
2650 if ( settings->allDetectedCAxes.at(axesList.at(grIt)).at(0) == 4 )
2651 {
2652 //==================================== Generate the elements
2653 std::vector<std::vector< proshade_double > > els = this->computeGroupElementsForGroup ( &settings->allDetectedCAxes, axesList.at(grIt) );
2654
2655 //==================================== Join the elements to any already found
2656 ret = joinElementsFromDifferentGroups ( &els, &ret, matrixTolerance, false );
2657 }
2658 }
2659
2660 //============================================ Generate elements for all four C3 axes first
2661 for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
2662 {
2663 //======================================== If this is a C3 axis
2664 if ( settings->allDetectedCAxes.at(axesList.at(grIt)).at(0) == 3 )
2665 {
2666 //==================================== Generate the elements
2667 std::vector<std::vector< proshade_double > > els = this->computeGroupElementsForGroup ( &settings->allDetectedCAxes, axesList.at(grIt) );
2668
2669 //==================================== Join the elements to any already found
2670 ret = joinElementsFromDifferentGroups ( &els, &ret, matrixTolerance, false );
2671 }
2672 }
2673
2674 //============================================ Generate elements for all six C2 axes next
2675 for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
2676 {
2677 //======================================== If this is a C3 axis
2678 if ( settings->allDetectedCAxes.at(axesList.at(grIt)).at(0) == 2 )
2679 {
2680 //==================================== Generate the elements
2681 std::vector<std::vector< proshade_double > > els = this->computeGroupElementsForGroup ( &settings->allDetectedCAxes, axesList.at(grIt) );
2682
2683 //==================================== Join the elements to any already found
2684 ret = joinElementsFromDifferentGroups ( &els, &ret, matrixTolerance, false );
2685 }
2686 }
2687
2688 //============================================ Prepend identity element
2689 prependIdentity ( &ret );
2690
2691 //============================================ Check the element to form a group
2692 if ( checkElementsFormGroup ( &ret, matrixTolerance ) ) { return ( ret ); }
2693 else
2694 {
2695 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." );
2696 }
2697 }
2698 else if ( groupType == "I" )
2699 {
2700 //============================================ Sanity check
2701 axesToGroupTypeSanityCheck ( 31, static_cast<proshade_unsign> ( axesList.size() ), groupType );
2702
2703 //============================================ Generate elements for all six C5 axes first
2704 for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
2705 {
2706 //======================================== If this is a C5 axis
2707 if ( settings->allDetectedCAxes.at(axesList.at(grIt)).at(0) == 5 )
2708 {
2709 //==================================== Generate the elements
2710 std::vector<std::vector< proshade_double > > els = this->computeGroupElementsForGroup ( &settings->allDetectedCAxes, axesList.at(grIt) );
2711
2712 //==================================== Join the elements to any already found
2713 ret = joinElementsFromDifferentGroups ( &els, &ret, matrixTolerance, false );
2714 }
2715 }
2716
2717 //============================================ Generate elements for all ten C3 axes next
2718 for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
2719 {
2720 //======================================== If this is a C3 axis
2721 if ( settings->allDetectedCAxes.at(axesList.at(grIt)).at(0) == 3 )
2722 {
2723 //==================================== Generate the elements
2724 std::vector<std::vector< proshade_double > > els = this->computeGroupElementsForGroup ( &settings->allDetectedCAxes, axesList.at(grIt) );
2725
2726 //==================================== Join the elements to any already found
2727 ret = joinElementsFromDifferentGroups ( &els, &ret, matrixTolerance, false );
2728 }
2729 }
2730
2731 //============================================ Generate elements for all fifteen C2 axes lastly
2732 for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
2733 {
2734 //======================================== If this is a C3 axis
2735 if ( settings->allDetectedCAxes.at(axesList.at(grIt)).at(0) == 2 )
2736 {
2737 //==================================== Generate the elements
2738 std::vector<std::vector< proshade_double > > els = this->computeGroupElementsForGroup ( &settings->allDetectedCAxes, axesList.at(grIt) );
2739
2740 //==================================== Join the elements to any already found
2741 ret = joinElementsFromDifferentGroups ( &els, &ret, matrixTolerance, false );
2742 }
2743 }
2744
2745 //============================================ Prepend identity element
2746 prependIdentity ( &ret );
2747
2748 //============================================ Check the element to form a group
2749 if ( checkElementsFormGroup ( &ret, matrixTolerance ) ) { return ( ret ); }
2750 else
2751 {
2752 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." );
2753 }
2754 }
2755 else if ( groupType == "X" )
2756 {
2757 //============================================ User forced no checking for unspecified symmetry
2758 for ( proshade_unsign grIt = 0; grIt < static_cast<proshade_unsign> ( axesList.size() ); grIt++ )
2759 {
2760 //======================================== Compute group elements
2761 std::vector<std::vector< proshade_double > > els = this->computeGroupElementsForGroup ( &settings->allDetectedCAxes, axesList.at(grIt) );
2762
2763 //======================================== Join the elements to any already found
2764 ret = joinElementsFromDifferentGroups ( &els, &ret, matrixTolerance, true );
2765 }
2766
2767 //============================================ Prepend identity element
2768 prependIdentity ( &ret );
2769
2770 //============================================ Check the element to form a group
2771 if ( checkElementsFormGroup ( &ret, matrixTolerance ) ) { return ( ret ); }
2772 else
2773 {
2774 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." );
2775 }
2776 }
2777 else
2778 {
2779 std::stringstream hlpSS;
2780 hlpSS << "Unknown symmetry type: >" << groupType << "<";
2781 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." );
2782 }
2783
2784 //================================================ Done
2785 return ( ret );
2786
2787 }
2788
2796 void ProSHADE_internal_data::ProSHADE_data::deepCopyMap ( proshade_double*& saveTo, proshade_unsign verbose )
2797 {
2798 //================================================ Sanity check
2799 if ( saveTo != NULL )
2800 {
2801 ProSHADE_internal_messages::printWarningMessage ( verbose, "!!! ProSHADE WARNING !!! The deep copy pointer is not set to NULL. Cannot proceed and returning unmodified pointer.", "WB00040" );
2802 return ;
2803 }
2804
2805 //================================================ Allocate the memory
2806 saveTo = new proshade_double[this->xDimIndices * this->yDimIndices * this->zDimIndices];
2807
2808 //================================================ Check memory allocation
2809 ProSHADE_internal_misc::checkMemoryAllocation ( saveTo, __FILE__, __LINE__, __func__ );
2810
2811 //================================================ Copy internal map to the new pointer
2812 for ( proshade_unsign iter = 0; iter < ( this->xDimIndices * this->yDimIndices * this->zDimIndices ); iter++ )
2813 {
2814 saveTo[iter] = this->internalMap[iter];
2815 }
2816
2817 //================================================ Done
2818 return ;
2819
2820 }
2821
2828 void ProSHADE_internal_data::ProSHADE_data::reportSymmetryResults ( ProSHADE_settings* settings )
2829 {
2830 //================================================ Improve this!
2831 if ( settings->recommendedSymmetryType == "" )
2832 {
2833 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, "Did not detect any symmetry!" );
2834 }
2835 else
2836 {
2837 std::stringstream ssHlp;
2838 ssHlp << std::endl << "Detected " << settings->recommendedSymmetryType << " symmetry with fold " << settings->recommendedSymmetryFold << " .";
2839 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, ssHlp.str() );
2840
2841 if ( settings->detectedSymmetry.size() > 0 )
2842 {
2843 ssHlp.clear(); ssHlp.str ( "" );
2844 ssHlp << " Fold X Y Z Angle Height";
2845 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, ssHlp.str() );
2846 }
2847 for ( proshade_unsign symIt = 0; symIt < static_cast<proshade_unsign> ( settings->detectedSymmetry.size() ); symIt++ )
2848 {
2849 ssHlp.clear(); ssHlp.str ( "" );
2850 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];
2851 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, ssHlp.str() );
2852 }
2853
2854 std::stringstream hlpSS3;
2855 ssHlp.clear(); ssHlp.str ( "" );
2856 hlpSS3 << std::endl << "However, since the selection of the recommended symmetry needs improvement, here is a list of all detected C symmetries:";
2857 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, hlpSS3.str() );
2858
2859 if ( settings->allDetectedCAxes.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->allDetectedCAxes.size() ); symIt++ )
2866 {
2867 ssHlp.clear(); ssHlp.str ( "" );
2868 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];
2869 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, ssHlp.str() );
2870 }
2871
2872 hlpSS3.clear(); hlpSS3.str ( "" );
2873 hlpSS3 << std::endl << "Also, for the same reason, here is a list of all detected D symmetries:";
2874 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, hlpSS3.str() );
2875
2876 if ( settings->allDetectedDAxes.size() > 0 )
2877 {
2878 ssHlp.clear(); ssHlp.str ( "" );
2879 ssHlp << " Fold X Y Z Angle Height";
2880 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, ssHlp.str() );
2881 }
2882 for ( proshade_unsign symIt = 0; symIt < static_cast<proshade_unsign> ( settings->allDetectedDAxes.size() ); symIt++ )
2883 {
2884 ssHlp.clear(); ssHlp.str ( "" );
2885 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];
2886 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, ssHlp.str() );
2887
2888 for ( proshade_unsign axIt = 1; axIt < static_cast<proshade_unsign> ( settings->allDetectedDAxes.at(symIt).size() ); axIt++ )
2889 {
2890 ssHlp.clear(); ssHlp.str ( "" );
2891 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];
2892 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, ssHlp.str() );
2893 }
2894
2895 ssHlp.clear(); ssHlp.str ( "" );
2896 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, ssHlp.str() );
2897 }
2898
2899 }
2900
2901 //================================================ Done
2902 return ;
2903
2904 }
2905
2910 void ProSHADE_internal_data::ProSHADE_data::findMapCOM ( )
2911 {
2912 //================================================ Initialise variables
2913 this->xCom = 0.0;
2914 this->yCom = 0.0;
2915 this->zCom = 0.0;
2916 proshade_double totNonZeroPoints = 0.0;
2917 proshade_signed mapIt = 0;
2918
2919 //================================================ Compute COM from 0 ; 0 ; 0
2920 for ( proshade_signed xIt = 0; xIt < static_cast<proshade_signed> ( this->xDimIndices ); xIt++ )
2921 {
2922 for ( proshade_signed yIt = 0; yIt < static_cast<proshade_signed> ( this->yDimIndices ); yIt++ )
2923 {
2924 for ( proshade_signed zIt = 0; zIt < static_cast<proshade_signed> ( this->zDimIndices ); zIt++ )
2925 {
2926 //==================================== Find map index
2927 mapIt = zIt + this->zDimIndices * ( yIt + this->yDimIndices * xIt );
2928
2929 //==================================== Use only positive density
2930 if ( this->internalMap[mapIt] <= 0.0 ) { continue; }
2931
2932 //==================================== Compute Index COM
2933 this->xCom += this->internalMap[mapIt] * static_cast<proshade_double> ( xIt + this->xFrom );
2934 this->yCom += this->internalMap[mapIt] * static_cast<proshade_double> ( yIt + this->yFrom );
2935 this->zCom += this->internalMap[mapIt] * static_cast<proshade_double> ( zIt + this->zFrom );
2936 totNonZeroPoints += this->internalMap[mapIt];
2937 }
2938 }
2939 }
2940
2941 this->xCom /= totNonZeroPoints;
2942 this->yCom /= totNonZeroPoints;
2943 this->zCom /= totNonZeroPoints;
2944
2945 //================================================ Convert to real world
2946 this->xCom = ( static_cast<proshade_double> ( this->xFrom ) * ( this->xDimSizeOriginal / static_cast<proshade_double> ( this->xDimIndicesOriginal ) ) ) +
2947 ( ( this->xCom - static_cast<proshade_double> ( this->xFrom ) ) *
2948 ( this->xDimSizeOriginal / static_cast<proshade_double> ( this->xDimIndicesOriginal ) ) );
2949 this->yCom = ( static_cast<proshade_double> ( this->yFrom ) * ( this->yDimSizeOriginal / static_cast<proshade_double> ( this->yDimIndicesOriginal ) ) ) +
2950 ( ( this->yCom - static_cast<proshade_double> ( this->yFrom ) ) *
2951 ( this->yDimSizeOriginal / static_cast<proshade_double> ( this->yDimIndicesOriginal ) ) );
2952 this->zCom = ( static_cast<proshade_double> ( this->zFrom ) * ( this->zDimSizeOriginal / static_cast<proshade_double> ( this->zDimIndicesOriginal ) ) ) +
2953 ( ( this->zCom - static_cast<proshade_double> ( this->zFrom ) ) *
2954 ( this->zDimSizeOriginal / static_cast<proshade_double> ( this->zDimIndicesOriginal ) ) );
2955
2956 //================================================ Done
2957 return ;
2958
2959 }
2960
2965 proshade_unsign ProSHADE_internal_data::ProSHADE_data::getMaxSpheres ( )
2966 {
2967 //================================================ Return the value
2968 return ( this->noSpheres );
2969 }
2970
2976 proshade_double ProSHADE_internal_data::ProSHADE_data::getMapValue ( proshade_unsign pos )
2977 {
2978 //================================================ Return the value
2979 return ( this->internalMap[pos] );
2980 }
2981
2986 proshade_unsign ProSHADE_internal_data::ProSHADE_data::getMaxBand ( )
2987 {
2988 //================================================ Return the value
2989 return ( this->maxShellBand );
2990 }
2991
2996 proshade_double ProSHADE_internal_data::ProSHADE_data::getRRPValue ( proshade_unsign band, proshade_unsign sh1, proshade_unsign sh2 )
2997 {
2998 //================================================ Return the value
2999 return ( this->rrpMatrices[band][sh1][sh2] );
3000 }
3001
3012 bool ProSHADE_internal_data::ProSHADE_data::shellBandExists ( proshade_unsign shell, proshade_unsign bandVal )
3013 {
3014 if ( this->spheres[shell]->getLocalBandwidth( ) >= bandVal )
3015 {
3016 return ( true );
3017 }
3018 else
3019 {
3020 return ( false );
3021 }
3022 }
3023
3032 void ProSHADE_internal_data::ProSHADE_data::removePhaseInormation ( ProSHADE_settings* settings )
3033 {
3034 //================================================ Report function start
3035 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 1, "Centering map onto its COM." );
3036
3037 //================================================ Copy map for processing
3038 fftw_complex* mapCoeffs = new fftw_complex[this->xDimIndices * this->yDimIndices * this->zDimIndices];
3039 fftw_complex* pattersonMap = new fftw_complex[this->xDimIndices * this->yDimIndices * this->zDimIndices];
3040
3041 //================================================ Check memory allocation
3042 ProSHADE_internal_misc::checkMemoryAllocation ( mapCoeffs, __FILE__, __LINE__, __func__ );
3043 ProSHADE_internal_misc::checkMemoryAllocation ( pattersonMap, __FILE__, __LINE__, __func__ );
3044
3045 //================================================ Copy data to mask
3046 for ( proshade_unsign iter = 0; iter < (this->xDimIndices * this->yDimIndices * this->zDimIndices); iter++ )
3047 {
3048 pattersonMap[iter][0] = this->internalMap[iter];
3049 pattersonMap[iter][1] = 0.0;
3050 }
3051
3052 //================================================ Prepare FFTW plans
3053 fftw_plan forward = fftw_plan_dft_3d ( this->xDimIndices, this->yDimIndices, this->zDimIndices,
3054 pattersonMap, mapCoeffs, FFTW_FORWARD, FFTW_ESTIMATE );
3055 fftw_plan inverse = fftw_plan_dft_3d ( this->xDimIndices, this->yDimIndices, this->zDimIndices,
3056 mapCoeffs, pattersonMap, FFTW_BACKWARD, FFTW_ESTIMATE );
3057
3058 //================================================ Run forward Fourier
3059 fftw_execute ( forward );
3060
3061 //================================================ Remove the phase
3062 ProSHADE_internal_mapManip::removeMapPhase ( mapCoeffs, this->xDimIndices, this->yDimIndices, this->zDimIndices );
3063
3064 //================================================ Run inverse Fourier
3065 fftw_execute ( inverse );
3066
3067 //================================================ Save the results
3068 proshade_signed mapIt, patIt, patX, patY, patZ;
3069 for ( proshade_signed xIt = 0; xIt < static_cast<proshade_signed> ( this->xDimIndices ); xIt++ )
3070 {
3071 for ( proshade_signed yIt = 0; yIt < static_cast<proshade_signed> ( this->yDimIndices ); yIt++ )
3072 {
3073 for ( proshade_signed zIt = 0; zIt < static_cast<proshade_signed> ( this->zDimIndices ); zIt++ )
3074 {
3075 //==================================== Centre patterson map
3076 patX = xIt - ( static_cast<proshade_signed> ( this->xDimIndices ) / 2 ); if ( patX < 0 ) { patX += this->xDimIndices; }
3077 patY = yIt - ( static_cast<proshade_signed> ( this->yDimIndices ) / 2 ); if ( patY < 0 ) { patY += this->yDimIndices; }
3078 patZ = zIt - ( static_cast<proshade_signed> ( this->zDimIndices ) / 2 ); if ( patZ < 0 ) { patZ += this->zDimIndices; }
3079
3080 //==================================== Find indices
3081 mapIt = zIt + this->zDimIndices * ( yIt + this->yDimIndices * xIt );
3082 patIt = patZ + this->zDimIndices * ( patY + this->yDimIndices * patX );
3083
3084 //==================================== Copy
3085 this->internalMap[mapIt] = pattersonMap[patIt][0];
3086 }
3087 }
3088 }
3089
3090 //================================================ Release memory
3091 delete[] pattersonMap;
3092 delete[] mapCoeffs;
3093
3094 //================================================ Delete FFTW plans
3095 fftw_destroy_plan ( forward );
3096 fftw_destroy_plan ( inverse );
3097
3098 //================================================ Report function completion
3099 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 2, "Phase information removed." );
3100
3101 //================================================ Done
3102 return ;
3103
3104 }
3105
3110 proshade_double* ProSHADE_internal_data::ProSHADE_data::getRealSphHarmValue ( proshade_unsign band, proshade_unsign order, proshade_unsign shell )
3111 {
3112 //================================================ Done
3113 return ( &this->sphericalHarmonics[shell][seanindex ( static_cast<proshade_signed> ( order ) - static_cast<proshade_signed> ( band ),
3114 band,
3115 this->spheres[shell]->getLocalBandwidth() )][0] );
3116
3117 }
3118
3123 proshade_double* ProSHADE_internal_data::ProSHADE_data::getImagSphHarmValue ( proshade_unsign band, proshade_unsign order, proshade_unsign shell )
3124 {
3125 //================================================ Done
3126 return ( &this->sphericalHarmonics[shell][seanindex ( static_cast<proshade_signed> ( order ) - static_cast<proshade_signed> ( band ),
3127 band,
3128 this->spheres[shell]->getLocalBandwidth() )][1] );
3129
3130 }
3131
3136 proshade_double ProSHADE_internal_data::ProSHADE_data::getAnySphereRadius ( proshade_unsign shell )
3137 {
3138 //================================================ Done
3139 return ( this->spheres[shell]->getShellRadius() );
3140
3141 }
3142
3147 proshade_double ProSHADE_internal_data::ProSHADE_data::getIntegrationWeight ( void )
3148 {
3149 //================================================ Done
3150 return ( this->integrationWeight );
3151
3152 }
3153
3159 proshade_unsign ProSHADE_internal_data::ProSHADE_data::getShellBandwidth ( proshade_unsign shell )
3160 {
3161 //================================================ Done
3162 return ( this->spheres[shell]->getLocalBandwidth ( ) );
3163
3164 }
3165
3171 proshade_double ProSHADE_internal_data::ProSHADE_data::getSpherePosValue ( proshade_unsign shell )
3172 {
3173 //================================================ Done
3174 return ( this->spherePos.at(shell) );
3175
3176 }
3177
3183 proshade_complex** ProSHADE_internal_data::ProSHADE_data::getEMatrixByBand ( proshade_unsign band )
3184 {
3185 //================================================ Done
3186 return ( this->eMatrices[band] );
3187
3188 }
3189
3198 void ProSHADE_internal_data::ProSHADE_data::getEMatrixValue ( proshade_unsign band, proshade_unsign order1, proshade_unsign order2, proshade_double* valueReal, proshade_double* valueImag )
3199 {
3200 //================================================ Set pointer
3201 *valueReal = this->eMatrices[band][order1][order2][0];
3202 *valueImag = this->eMatrices[band][order1][order2][1];
3203
3204 //================================================ Done
3205 return ;
3206
3207 }
3208
3213 proshade_complex* ProSHADE_internal_data::ProSHADE_data::getInvSO3Coeffs ( )
3214 {
3215 //================================================ Done
3216 return ( this->so3CoeffsInverse );
3217
3218 }
3219
3224 proshade_complex* ProSHADE_internal_data::ProSHADE_data::getSO3Coeffs ( )
3225 {
3226 //================================================ Done
3227 return ( this->so3Coeffs );
3228
3229 }
3230
3235 proshade_unsign ProSHADE_internal_data::ProSHADE_data::getComparisonBand ( )
3236 {
3237 //================================================ Done
3238 return ( this->maxCompBand );
3239
3240 }
3241
3250 void ProSHADE_internal_data::ProSHADE_data::getWignerMatrixValue ( proshade_unsign band, proshade_unsign order1, proshade_unsign order2, proshade_double* valueReal, proshade_double* valueImag )
3251 {
3252 //================================================ Set pointer
3253 *valueReal = this->wignerMatrices[band][order1][order2][0];
3254 *valueImag = this->wignerMatrices[band][order1][order2][1];
3255
3256 //================================================ Done
3257 return ;
3258
3259 }
3260
3265 proshade_single ProSHADE_internal_data::ProSHADE_data::getXDimSize ( )
3266 {
3267 //================================================ Return the requested value
3268 return ( this->xDimSize );
3269 }
3270
3275 proshade_single ProSHADE_internal_data::ProSHADE_data::getYDimSize ( )
3276 {
3277 //================================================ Return the requested value
3278 return ( this->yDimSize );
3279 }
3280
3285 proshade_single ProSHADE_internal_data::ProSHADE_data::getZDimSize ( )
3286 {
3287 //================================================ Return the requested value
3288 return ( this->zDimSize );
3289 }
3290
3295 proshade_unsign ProSHADE_internal_data::ProSHADE_data::getXDim ( )
3296 {
3297 //================================================ Return the requested value
3298 return ( this->xDimIndices );
3299 }
3300
3305 proshade_unsign ProSHADE_internal_data::ProSHADE_data::getYDim ( )
3306 {
3307 //================================================ Return the requested value
3308 return ( this->yDimIndices );
3309 }
3310
3315 proshade_unsign ProSHADE_internal_data::ProSHADE_data::getZDim ( )
3316 {
3317 //================================================ Return the requested value
3318 return ( this->zDimIndices );
3319 }
3320
3325 proshade_signed* ProSHADE_internal_data::ProSHADE_data::getXFromPtr ( )
3326 {
3327 //================================================ Return the requested value
3328 return ( &this->xFrom );
3329 }
3330
3335 proshade_signed* ProSHADE_internal_data::ProSHADE_data::getYFromPtr ( )
3336 {
3337 //================================================ Return the requested value
3338 return ( &this->yFrom );
3339 }
3340
3345 proshade_signed* ProSHADE_internal_data::ProSHADE_data::getZFromPtr ( )
3346 {
3347 //================================================ Return the requested value
3348 return ( &this->zFrom );
3349 }
3350
3355 proshade_signed* ProSHADE_internal_data::ProSHADE_data::getXToPtr ( )
3356 {
3357 //================================================ Return the requested value
3358 return ( &this->xTo );
3359 }
3360
3365 proshade_signed* ProSHADE_internal_data::ProSHADE_data::getYToPtr ( )
3366 {
3367 //================================================ Return the requested value
3368 return ( &this->yTo );
3369 }
3370
3375 proshade_signed* ProSHADE_internal_data::ProSHADE_data::getZToPtr ( )
3376 {
3377 //================================================ Return the requested value
3378 return ( &this->zTo );
3379 }
3380
3385 proshade_signed* ProSHADE_internal_data::ProSHADE_data::getXAxisOrigin ( )
3386 {
3387 //================================================ Return the requested value
3388 return ( &this->xAxisOrigin );
3389 }
3390
3395 proshade_signed* ProSHADE_internal_data::ProSHADE_data::getYAxisOrigin ( )
3396 {
3397 //================================================ Return the requested value
3398 return ( &this->yAxisOrigin );
3399 }
3400
3405 proshade_signed* ProSHADE_internal_data::ProSHADE_data::getZAxisOrigin ( )
3406 {
3407 //================================================ Return the requested value
3408 return ( &this->zAxisOrigin );
3409 }
3410
3415 proshade_double*& ProSHADE_internal_data::ProSHADE_data::getInternalMap ( )
3416 {
3417 //================================================ Return the requested value
3418 return ( this->internalMap );
3419 }
3420
3425 proshade_complex* ProSHADE_internal_data::ProSHADE_data::getTranslationFnPointer ( void )
3426 {
3427 //================================================ Return the requested value
3428 return ( this->translationMap );
3429 }
3430
3435 void ProSHADE_internal_data::ProSHADE_data::setIntegrationWeight ( proshade_double intW )
3436 {
3437 //================================================ Mutate
3438 this->integrationWeight = intW;
3439
3440 //================================================ Done
3441 return ;
3442
3443 }
3444
3449 void ProSHADE_internal_data::ProSHADE_data::setIntegrationWeightCumul ( proshade_double intW )
3450 {
3451 //================================================ Mutate
3452 this->integrationWeight += intW;
3453
3454 //================================================ Done
3455 return ;
3456
3457 }
3458
3466 void ProSHADE_internal_data::ProSHADE_data::setEMatrixValue ( proshade_unsign band, proshade_unsign order1, proshade_unsign order2, proshade_complex val )
3467 {
3468 //================================================ Mutate
3469 this->eMatrices[band][order1][order2][0] = val[0];
3470 this->eMatrices[band][order1][order2][1] = val[1];
3471
3472 //================================================ Done
3473 return ;
3474
3475 }
3476
3484 void ProSHADE_internal_data::ProSHADE_data::normaliseEMatrixValue ( proshade_unsign band, proshade_unsign order1, proshade_unsign order2, proshade_double normF )
3485 {
3486 //================================================ Mutate
3487 this->eMatrices[band][order1][order2][0] /= normF;
3488 this->eMatrices[band][order1][order2][1] /= normF;
3489
3490 //================================================ Done
3491 return ;
3492
3493 }
3494
3500 void ProSHADE_internal_data::ProSHADE_data::setSO3CoeffValue ( proshade_unsign position, proshade_complex val )
3501 {
3502 //================================================ Mutate
3503 this->so3Coeffs[position][0] = val[0];
3504 this->so3Coeffs[position][1] = val[1];
3505
3506 //================================================ Done
3507 return ;
3508
3509 }
3510
3518 void ProSHADE_internal_data::ProSHADE_data::setWignerMatrixValue ( proshade_complex val, proshade_unsign band, proshade_unsign order1, proshade_unsign order2 )
3519 {
3520 //================================================ Mutate
3521 this->wignerMatrices[band][order1][order2][0] = val[0];
3522 this->wignerMatrices[band][order1][order2][1] = val[1];
3523
3524 //================================================ Done
3525 return ;
3526
3527 }
3528
3536 void ProSHADE_internal_data::ProSHADE_data::getRealEMatrixValuesForLM ( proshade_signed band, proshade_signed order1, double *eMatsLMReal, int len )
3537 {
3538 //================================================ Save the data into the output array
3539 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
3540 {
3541 eMatsLMReal[iter] = static_cast<double> ( this->eMatrices[band][order1][iter][0] );
3542 }
3543
3544 //================================================ Done
3545 return ;
3546
3547 }
3548
3556 void ProSHADE_internal_data::ProSHADE_data::getImagEMatrixValuesForLM ( proshade_signed band, proshade_signed order1, double *eMatsLMImag, int len )
3557 {
3558 //================================================ Save the data into the output array
3559 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
3560 {
3561 eMatsLMImag[iter] = static_cast<double> ( this->eMatrices[band][order1][iter][1] );
3562 }
3563
3564 //================================================ Done
3565 return ;
3566
3567 }
3568
3574 void ProSHADE_internal_data::ProSHADE_data::getRealSO3Coeffs ( double *so3CoefsReal, 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 so3CoefsReal[iter] = static_cast<double> ( this->so3Coeffs[iter][0] );
3580 }
3581
3582 //================================================ Done
3583 return ;
3584
3585 }
3586
3592 void ProSHADE_internal_data::ProSHADE_data::getImagSO3Coeffs ( double *so3CoefsImag, 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 so3CoefsImag[iter] = static_cast<double> ( this->so3Coeffs[iter][1] );
3598 }
3599
3600 //================================================ Done
3601 return ;
3602
3603 }
3604
3614 int ProSHADE_internal_data::ProSHADE_data::so3CoeffsArrayIndex ( proshade_signed order1, proshade_signed order2, proshade_signed band )
3615 {
3616 //================================================ Return the value
3617 return ( static_cast<int> ( so3CoefLoc ( order1, order2, band, this->getMaxBand() ) ) );
3618 }
3619
3625 void ProSHADE_internal_data::ProSHADE_data::getRealRotFunction ( double *rotFunReal, int len )
3626 {
3627 //================================================ Save the data into the output array
3628 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
3629 {
3630 rotFunReal[iter] = static_cast<double> ( this->so3CoeffsInverse[iter][0] );
3631 }
3632
3633 //================================================ Done
3634 return ;
3635
3636 }
3637
3643 void ProSHADE_internal_data::ProSHADE_data::getImagRotFunction ( double *rotFunImag, int len )
3644 {
3645 //================================================ Save the data into the output array
3646 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
3647 {
3648 rotFunImag[iter] = static_cast<double> ( this->so3CoeffsInverse[iter][1] );
3649 }
3650
3651 //================================================ Done
3652 return ;
3653
3654 }
3655
3661 void ProSHADE_internal_data::ProSHADE_data::getRealTranslationFunction ( double *trsFunReal, int len )
3662 {
3663 //================================================ Save the data into the output array
3664 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
3665 {
3666 trsFunReal[iter] = static_cast<double> ( this->translationMap[iter][0] );
3667 }
3668
3669 //================================================ Done
3670 return ;
3671
3672 }
3673
3679 void ProSHADE_internal_data::ProSHADE_data::getImagTranslationFunction ( double *trsFunImag, int len )
3680 {
3681 //================================================ Save the data into the output array
3682 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
3683 {
3684 trsFunImag[iter] = static_cast<double> ( this->translationMap[iter][1] );
3685 }
3686
3687 //================================================ Done
3688 return ;
3689
3690 }
3691
3700 void ProSHADE_internal_data::ProSHADE_data::getRotMatrixFromRotFunInds ( proshade_signed aI, proshade_signed bI, proshade_signed gI, double *rotMat, int len )
3701 {
3702 //================================================ Get Euler angles
3703 proshade_double eA, eB, eG;
3704 ProSHADE_internal_maths::getEulerZXZFromSOFTPosition ( this->getMaxBand(), aI, bI, gI, &eA, &eB, &eG );
3705
3706 //================================================ Prepare internal rotation matrix memory
3707 proshade_double* rMat = NULL;
3708 rMat = new proshade_double[9];
3709 ProSHADE_internal_misc::checkMemoryAllocation ( rMat, __FILE__, __LINE__, __func__ );
3710
3711 //================================================ Convert to rotation matrix
3712 ProSHADE_internal_maths::getRotationMatrixFromEulerZXZAngles ( eA, eB, eG, rMat );
3713
3714 //================================================ Copy to output
3715 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++ )
3716 {
3717 rotMat[iter] = static_cast<double> ( rMat[iter] );
3718 }
3719
3720 //================================================ Release internal memory
3721 delete[] rMat;
3722
3723 //================================================ Done
3724 return ;
3725
3726 }
3727
3732 std::string ProSHADE_internal_data::ProSHADE_data::getRecommendedSymmetryType ( ProSHADE_settings* settings )
3733 {
3734 //================================================ Return the value
3735 return ( settings->recommendedSymmetryType );
3736
3737 }
3738
3743 proshade_unsign ProSHADE_internal_data::ProSHADE_data::getRecommendedSymmetryFold ( ProSHADE_settings* settings )
3744 {
3745 //================================================ Return the value
3746 return ( settings->recommendedSymmetryFold );
3747
3748 }
3749
3755 proshade_unsign ProSHADE_internal_data::ProSHADE_data::getNoRecommendedSymmetryAxes ( ProSHADE_settings* settings )
3756 {
3757 //================================================ Return the value
3758 return ( static_cast<proshade_unsign> ( settings->detectedSymmetry.size() ) );
3759 }
3760
3767 std::vector< std::string > ProSHADE_internal_data::ProSHADE_data::getSymmetryAxis ( ProSHADE_settings* settings, proshade_unsign axisNo )
3768 {
3769 //================================================ Sanity checks
3770 if ( static_cast<proshade_unsign> ( settings->detectedSymmetry.size() ) <= axisNo )
3771 {
3772 ProSHADE_internal_messages::printWarningMessage ( settings->verbose, "!!! ProSHADE WARNING !!! Requested symmetry index does not exist. Returning empty vector.", "WS00039" );
3773 return ( std::vector< std::string > ( ) );
3774 }
3775
3776 //================================================ Initialise local variables
3777 std::vector< std::string > ret;
3778
3779 //================================================ Input the axis data as strings
3780 std::stringstream ssHlp;
3781 ssHlp << settings->detectedSymmetry.at(axisNo)[0];
3782 ProSHADE_internal_misc::addToStringVector ( &ret, ssHlp.str() );
3783 ssHlp.str ( "" );
3784
3785 ssHlp << settings->detectedSymmetry.at(axisNo)[1];
3786 ProSHADE_internal_misc::addToStringVector ( &ret, ssHlp.str() );
3787 ssHlp.str ( "" );
3788
3789 ssHlp << settings->detectedSymmetry.at(axisNo)[2];
3790 ProSHADE_internal_misc::addToStringVector ( &ret, ssHlp.str() );
3791 ssHlp.str ( "" );
3792
3793 ssHlp << settings->detectedSymmetry.at(axisNo)[3];
3794 ProSHADE_internal_misc::addToStringVector ( &ret, ssHlp.str() );
3795 ssHlp.str ( "" );
3796
3797 ssHlp << settings->detectedSymmetry.at(axisNo)[4];
3798 ProSHADE_internal_misc::addToStringVector ( &ret, ssHlp.str() );
3799 ssHlp.str ( "" );
3800
3801 ssHlp << settings->detectedSymmetry.at(axisNo)[5];
3802 ProSHADE_internal_misc::addToStringVector ( &ret, ssHlp.str() );
3803 ssHlp.str ( "" );
3804
3805 //================================================ Done
3806 return ( ret );
3807
3808 }
3809
3822 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 )
3823 {
3824 //================================================ Write out rotated map
3825 std::stringstream fNameHlp;
3826 fNameHlp << settings->overlayStructureName << ".map";
3827 this->writeMap ( fNameHlp.str() );
3828
3829 //================================================ Write out rotated co-ordinates if possible
3830 if ( ProSHADE_internal_io::isFilePDB ( this->fileName ) )
3831 {
3832 fNameHlp.str("");
3833 fNameHlp << settings->overlayStructureName << ".pdb";
3834 this->writePdb ( fNameHlp.str(), eulA, eulB, eulG, ultimateTranslation->at(0), ultimateTranslation->at(1), ultimateTranslation->at(2), settings->firstModelOnly );
3835 }
3836
3837 //================================================ Write out the json file with the results
3838 ProSHADE_internal_io::writeRotationTranslationJSON ( rotCentre->at(0), rotCentre->at(1), rotCentre->at(2),
3839 eulA, eulB, eulG,
3840 ultimateTranslation->at(0), ultimateTranslation->at(1), ultimateTranslation->at(2),
3841 settings->rotTrsJSONFile );
3842
3843 //================================================ Done
3844 return ;
3845
3846 }
3847
3856 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 )
3857 {
3858 //================================================ Empty line
3859 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, "" );
3860
3861 //================================================ Write out rotation centre translation results
3862 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);
3863 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, rotCen.str() );
3864
3865 //================================================ Write out rotation matrix about origin
3866 proshade_double* rotMat = new proshade_double[9];
3867 ProSHADE_internal_misc::checkMemoryAllocation ( rotMat, __FILE__, __LINE__, __func__ );
3868 ProSHADE_internal_maths::getRotationMatrixFromEulerZXZAngles ( eulerAngles->at(0), eulerAngles->at(1), eulerAngles->at(2), rotMat );
3869
3870 std::stringstream rotMatSS;
3871 rotMatSS << std::setprecision (3) << std::showpos << "The rotation matrix about origin is : " << rotMat[0] << " " << rotMat[1] << " " << rotMat[2] << std::endl;
3872 rotMatSS << std::setprecision (3) << std::showpos << " : " << rotMat[3] << " " << rotMat[4] << " " << rotMat[5] << std::endl;
3873 rotMatSS << std::setprecision (3) << std::showpos << " : " << rotMat[6] << " " << rotMat[7] << " " << rotMat[8];
3874 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, rotMatSS.str() );
3875
3876 delete[] rotMat;
3877
3878 //================================================ Write out origin to overlay translation results
3879 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);
3880 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 0, finTrs.str() );
3881
3882 //================================================ Done
3883 return ;
3884
3885 }
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:106
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:1542
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:172
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:3183
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:182
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:3285
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:1090
ProSHADE_settings::determineAllSHValues
void determineAllSHValues(proshade_unsign xDim, proshade_unsign yDim, proshade_unsign zDim)
This function determines all the required values for spherical harmonics computation.
Definition: ProSHADE.cpp:1314
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:1035
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:2028
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:3235
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:3743
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:3435
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:2212
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:3385
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:3484
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:137
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:3679
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:3518
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:191
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:126
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:1828
ProSHADE_settings::maskMap
bool maskMap
Should the map be masked from noise?
Definition: ProSHADE_settings.hpp:128
ProSHADE_settings::requestedSymmetryFold
proshade_unsign requestedSymmetryFold
The fold of the requested symmetry (only applicable to C and D symmetry types).
Definition: ProSHADE_settings.hpp:175
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:174
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:3198
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:3265
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:3415
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:3275
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:2965
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:3500
ProSHADE_settings::saveMask
bool saveMask
Should the mask be saved?
Definition: ProSHADE_settings.hpp:132
ProSHADE_settings::requestedResolution
proshade_single requestedResolution
The resolution to which the calculations are to be done.
Definition: ProSHADE_settings.hpp:98
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:3700
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:3136
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:149
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:3224
ProSHADE_settings::maxSphereDists
proshade_single maxSphereDists
The distance between spheres in spherical mapping for the largest sphere.
Definition: ProSHADE_settings.hpp:113
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:1442
ProSHADE_internal_data::ProSHADE_data::invertMirrorMap
void invertMirrorMap(ProSHADE_settings *settings)
Function for inverting the map to its mirror image.
Definition: ProSHADE_data.cpp:894
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:3171
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:1870
ProSHADE_internal_data::ProSHADE_data::computeGroupElementsForGroup
std::vector< std::vector< proshade_double > > computeGroupElementsForGroup(std::vector< std::vector< proshade_double > > *allCSyms, proshade_unsign grPosition)
This function computes the group elements as rotation matrices (except for the identity element) for ...
Definition: ProSHADE_data.cpp:2263
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:127
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:110
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:2796
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:3147
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:3449
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:3767
ProSHADE_settings::maskFileName
std::string maskFileName
The filename to which mask should be saved.
Definition: ProSHADE_settings.hpp:133
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:1228
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:3325
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:185
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:2067
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:3250
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:3159
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:100
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:3755
ProSHADE_internal_data::ProSHADE_data::setPDBMapValues
void setPDBMapValues(void)
Function for determining iterator start and stop positions.
Definition: ProSHADE_data.cpp:678
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:2910
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:3625
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:3295
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:857
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:2161
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:1499
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:93
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:3110
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:1684
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:3856
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:741
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:3012
ProSHADE_internal_data::ProSHADE_data::getMaxBand
proshade_unsign getMaxBand(void)
This function returns the maximum band value for the object.
Definition: ProSHADE_data.cpp:2986
ProSHADE_settings::normaliseMap
bool normaliseMap
Should the map be normalised to mean 0 sd 1?
Definition: ProSHADE_settings.hpp:120
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:146
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:3305
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:3556
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:995
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:86
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:3661
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:3123
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:3822
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:1914
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:3643
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:1398
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:3425
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:123
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:3315
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:1995
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:138
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:806
ProSHADE_settings::changeMapResolution
bool changeMapResolution
Should maps be re-sampled to obtain the required resolution?
Definition: ProSHADE_settings.hpp:99
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:2996
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:2371
prependIdentity
void prependIdentity(std::vector< std::vector< proshade_double > > *vecToPrepend)
This function adds identity matrix as the first element of the vector of vectors of doubles.
Definition: ProSHADE_data.cpp:2390
ProSHADE_settings::overlayStructureName
std::string overlayStructureName
The filename to which the rotated and translated moving structure is to be saved.
Definition: ProSHADE_settings.hpp:181
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:2976
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:3592
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:3365
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:143
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:1587
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:3405
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:1156
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:1979
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:3355
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:3335
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:2828
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:1962
ProSHADE_internal_data::ProSHADE_data::figureIndexStartStop
void figureIndexStartStop(void)
Function for determining iterator start and stop positions.
Definition: ProSHADE_data.cpp:719
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:3213
ProSHADE_settings::forceBounds
proshade_signed * forceBounds
These will be the boundaries to be forced upon the map.
Definition: ProSHADE_settings.hpp:140
ProSHADE_settings::detectedSymmetry
std::vector< proshade_double * > detectedSymmetry
The vector of detected symmetry axes.
Definition: ProSHADE_settings.hpp:189
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:173
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:3395
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:95
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:169
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:139
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_settings::pdbBFactorNewVal
proshade_double pdbBFactorNewVal
Change all PDB B-factors to this value (for smooth maps).
Definition: ProSHADE_settings.hpp:103
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:3732
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:3466
ProSHADE_settings::removeWaters
bool removeWaters
Should all waters be removed from input PDB files?
Definition: ProSHADE_settings.hpp:94
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:948
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:1707
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:3574
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:190
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:3032
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:1925
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:1289
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:3536
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:393
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:574
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:3345
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:3375
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:3614