ProSHADE  0.7.6.1 (AUG 2021)
Protein Shape Detection
ProSHADE.cpp
Go to the documentation of this file.
1 
25 //==================================================== ProSHADE
26 #include "ProSHADE.hpp"
27 
34 #if defined ( _WIN64 ) || defined ( _WIN32 )
35 __declspec(dllexport) ProSHADE_settings::ProSHADE_settings ( )
36 #else
38 #endif
39 {
40  //================================================ Settings regarding the task at hand
41  this->task = NA;
42 
43  //================================================ Settings regarding input files
44  this->forceP1 = true;
45  this->removeWaters = true;
46  this->firstModelOnly = true;
47  this->removeNegativeDensity = true;
48 
49  //================================================ Settings regarding the resolution of calculations
50  this->requestedResolution = -1.0;
51  this->changeMapResolution = false;
52  this->changeMapResolutionTriLinear = false;
53 
54  //================================================ Settings regarding the PDB B-factor change
55  this->pdbBFactorNewVal = -1.0;
56 
57  //================================================ Settings regarding the bandwidth of calculations
58  this->maxBandwidth = 0;
59  this->rotationUncertainty = 0;
60 
61  //================================================ Settings regarding the phase
62  this->usePhase = true;
63 
64  //================================================ Settings regarding the spheres
65  this->maxSphereDists = 0.0;
66 
67  //================================================ Settings regarding the Gauss-Legendre integration
68  this->integOrder = 0;
69  this->taylorSeriesCap = 10;
70 
71  //================================================ Settings regarding map normalisation
72  this->normaliseMap = false;
73 
74  //================================================ Settings regarding map inversion
75  this->invertMap = false;
76 
77  //================================================ Settings regarding map masking
78  this->blurFactor = 350.0;
79  this->maskingThresholdIQRs = 3.0;
80  this->maskMap = false;
81  this->useCorrelationMasking = false;
82  this->halfMapKernel = 0.0;
83  this->correlationKernel = 0.0;
84  this->saveMask = false;
85  this->maskFileName = "maskFile";
86  this->appliedMaskFileName = "";
87 
88  //================================================ Settings regarding Fourier weights
89  this->fourierWeightsFileName = "";
90 
91  //================================================ Settings regarding re-boxing
92  this->reBoxMap = false;
93  this->boundsExtraSpace = 3.0;
94  this->boundsSimilarityThreshold = 0;
95  this->useSameBounds = false;
96  this->forceBounds = new proshade_signed [6];
97 
98  //================================================ Settings regarding COM
99  this->moveToCOM = false;
100 
101  //================================================ Settings regarding extra cell space
102  this->addExtraSpace = 10.0;
103 
104  //================================================ Settings regarding shell settings
105  this->progressiveSphereMapping = false;
106 
107  //================================================ Settings regarding output file name
108  this->outName = "reBoxed";
109 
110  //================================================ Settings regarding distances computation
111  this->computeEnergyLevelsDesc = true;
112  this->computeTraceSigmaDesc = true;
113  this->computeRotationFuncDesc = true;
114  this->enLevMatrixPowerWeight = 1.0;
115 
116  //================================================ Settings regarding peak searching
117  this->peakNeighbours = 1;
118  this->noIQRsFromMedianNaivePeak = -999.9;
119 
120  //================================================ Settings regarding 1D grouping
121  this->smoothingFactor = 15.0;
122 
123  //================================================ Settings regarding the symmetry detection
124  this->useBiCubicInterpolationOnPeaks = true;
125  this->maxSymmetryFold = 30;
126  this->fscThreshold = 0.65;
127  this->peakThresholdMin = 0.80;
128  this->symMissPeakThres = 0.3;
129  this->axisErrTolerance = 0.01;
130  this->axisErrToleranceDefault = true;
131  this->minSymPeak = 0.3;
132  this->recommendedSymmetryType = "";
133  this->recommendedSymmetryFold = 0;
134  this->requestedSymmetryType = "";
135  this->requestedSymmetryFold = 0;
136  this->detectedSymmetry.clear ( );
137 
138  //================================================ Settings regarding the structure overlay
139  this->overlayStructureName = "movedStructure";
140  this->rotTrsJSONFile = "movedStructureOperations.json";
141 
142  //================================================ Settings regarding verbosity of the program
143  this->verbose = 1;
144 
145  //================================================ Done
146 
147 }
148 
157 #if defined ( _WIN64 ) || defined ( _WIN32 )
158 __declspec(dllexport) ProSHADE_settings::ProSHADE_settings ( ProSHADE_Task taskToPerform )
159 #else
160  ProSHADE_settings::ProSHADE_settings ( ProSHADE_Task taskToPerform )
161 #endif
162 {
163  //================================================ Settings regarding the task at hand
164  this->task = taskToPerform;
165 
166  //================================================ Settings regarding input files
167  this->forceP1 = true;
168  this->removeWaters = true;
169  this->firstModelOnly = true;
170  this->removeNegativeDensity = true;
171 
172  //================================================ Settings regarding the resolution of calculations
173  this->requestedResolution = -1.0;
174  this->changeMapResolution = false;
175  this->changeMapResolutionTriLinear = false;
176 
177  //================================================ Settings regarding the PDB B-factor change
178  this->pdbBFactorNewVal = -1.0;
179 
180  //================================================ Settings regarding the bandwidth of calculations
181  this->maxBandwidth = 0;
182  this->rotationUncertainty = 0;
183 
184  //================================================ Settings regarding the phase
185  this->usePhase = true;
186 
187  //================================================ Settings regarding the spheres
188  this->maxSphereDists = 0.0;
189 
190  //================================================ Settings regarding the Gauss-Legendre integration
191  this->integOrder = 0;
192  this->taylorSeriesCap = 10;
193 
194  //================================================ Settings regarding map normalisation
195  this->normaliseMap = false;
196 
197  //================================================ Settings regarding map inversion
198  this->invertMap = false;
199 
200  //================================================ Settings regarding map masking
201  this->blurFactor = 350.0;
202  this->maskingThresholdIQRs = 3.0;
203  this->maskMap = false;
204  this->useCorrelationMasking = false;
205  this->halfMapKernel = 0.0;
206  this->correlationKernel = 0.0;
207  this->saveMask = false;
208  this->maskFileName = "maskFile";
209  this->appliedMaskFileName = "";
210 
211  //================================================ Settings regarding Fourier weights
212  this->fourierWeightsFileName = "";
213 
214  //================================================ Settings regarding re-boxing
215  this->reBoxMap = false;
216  this->boundsExtraSpace = 3.0;
217  this->boundsSimilarityThreshold = 0;
218  this->useSameBounds = false;
219  this->forceBounds = new proshade_signed [6];
220 
221  //================================================ Settings regarding extra cell space
222  this->addExtraSpace = 10.0;
223 
224  //================================================ Settings regarding shell settings
225  this->progressiveSphereMapping = false;
226 
227  //================================================ Settings regarding output file name
228  this->outName = "reBoxed";
229 
230  //================================================ Settings regarding distances computation
231  this->computeEnergyLevelsDesc = true;
232  this->computeTraceSigmaDesc = true;
233  this->computeRotationFuncDesc = true;
234  this->enLevMatrixPowerWeight = 1.0;
235 
236  //================================================ Settings regarding peak searching
237  this->peakNeighbours = 1;
238  this->noIQRsFromMedianNaivePeak = -999.9;
239 
240  //================================================ Settings regarding 1D grouping
241  this->smoothingFactor = 15.0;
242 
243  //================================================ Settings regarding the symmetry detection
244  this->useBiCubicInterpolationOnPeaks = true;
245  this->maxSymmetryFold = 30;
246  this->fscThreshold = 0.65;
247  this->peakThresholdMin = 0.80;
248  this->symMissPeakThres = 0.3;
249  this->axisErrTolerance = 0.01;
250  this->axisErrToleranceDefault = true;
251  this->minSymPeak = 0.3;
252  this->recommendedSymmetryType = "";
253  this->recommendedSymmetryFold = 0;
254  this->requestedSymmetryType = "";
255  this->requestedSymmetryFold = 0;
256  this->detectedSymmetry.clear ( );
257 
258  //================================================ Settings regarding the structure overlay
259  this->overlayStructureName = "movedStructure";
260  this->rotTrsJSONFile = "movedStructureOperations.json";
261 
262  //================================================ Settings regarding verbosity of the program
263  this->verbose = 1;
264 
265  //================================================ Task specific settings
266  switch ( this->task )
267  {
268  case NA:
269  std::cerr << std::endl << "=====================" << std::endl << "!! ProSHADE ERROR !!" << std::endl << "=====================" << std::endl << std::flush;
270  std::cerr << "Error Code : " << "E000014" << std::endl << std::flush;
271  std::cerr << "ProSHADE version : " << PROSHADE_VERSION << std::endl << std::flush;
272  std::cerr << "File : " << "ProSHADE.cpp" << std::endl << std::flush;
273  std::cerr << "Line : " << 97 << std::endl << std::flush;
274  std::cerr << "Function : " << "ProSHADE_settings (Task) constructor" << std::endl << std::flush;
275  std::cerr << "Message : " << "No task has been specified for task specific constructor." << std::endl << std::flush;
276  std::cerr << "Further information : " << "This ProSHADE_settings class constructor is intended to\n : set the internal variables to default value given a\n : particular taks. By supplying this task as NA, this beats\n : the purpose of the constructor. Please use the\n : non-argumental constructor if task is not yet known." << std::endl << std::endl << std::flush;
278  exit ( EXIT_FAILURE );
279 
280  case Symmetry:
281  this->requestedResolution = 6.0;
282  this->pdbBFactorNewVal = 80.0;
283  this->changeMapResolution = true;
284  this->maskMap = false;
285  this->moveToCOM = true;
286  this->reBoxMap = false;
287  break;
288 
289  case Distances:
290  this->changeMapResolution = false;
291  this->maskMap = false;
292  this->moveToCOM = true;
293  this->reBoxMap = false;
294  break;
295 
296  case OverlayMap:
297  this->requestedResolution = 8.0;
298  this->changeMapResolution = true;
299  this->maskMap = false;
300  this->moveToCOM = false;
301  this->reBoxMap = false;
302  break;
303 
304  case MapManip:
305  this->changeMapResolution = false;
306  this->maskMap = true;
307  this->moveToCOM = false;
308  break;
309  }
310 
311  //================================================ Done
312 
313 }
314 
319 #if defined ( _WIN64 ) || defined ( _WIN32 )
320 __declspec(dllexport) ProSHADE_settings::~ProSHADE_settings ( void )
321 #else
323 #endif
324 {
325  //================================================ Release boundaries variable
326  delete[] this->forceBounds;
327 
328  //================================================ Release symmetry axes
329  if ( this->detectedSymmetry.size() > 0 ) { for ( proshade_unsign it = 0; it < static_cast<proshade_unsign> ( this->detectedSymmetry.size() ); it++ ) { if ( this->detectedSymmetry.at(it) != nullptr ) { delete[] this->detectedSymmetry.at(it); } } }
330 
331  //================================================ Done
332 
333 }
334 
338 {
339  //================================================ Determine the peak IQR from median threshold, unless given by user
340  const FloatingPoint< proshade_double > lhs ( this->noIQRsFromMedianNaivePeak ), rhs ( -999.9 );
341  if ( lhs.AlmostEquals( rhs ) )
342  {
343  //============================================ If using the old symmetry detection algorithm or distances computation, this will be used on many small peaks with few outliers. Use value of 5.0
344  if ( this->task == Distances ) { this->noIQRsFromMedianNaivePeak = 5.0; }
345  if ( this->task == Symmetry ) { this->noIQRsFromMedianNaivePeak = static_cast< proshade_double > ( std::max ( 0.0f, 1.0f - ( this->requestedResolution * 0.05f ) ) ); }
346  }
347 
348  //================================================ Done
349  return ;
350 
351 }
352 
360 #if defined ( _WIN64 ) || defined ( _WIN32 )
361 void __declspec(dllexport) ProSHADE_settings::addStructure ( std::string structure )
362 #else
363 void ProSHADE_settings::addStructure ( std::string structure )
364 #endif
365 {
366  //================================================ Use C++ version independent vector processing
367  ProSHADE_internal_misc::addToStringVector ( &( this->inputFiles ), structure );
368 
369  //================================================ Done
370  return ;
371 
372 }
373 
380 #if defined ( _WIN64 ) || defined ( _WIN32 )
381 void __declspec(dllexport) ProSHADE_settings::setResolution ( proshade_single resolution )
382 #else
383 void ProSHADE_settings::setResolution ( proshade_single resolution )
384 #endif
385 {
386  //================================================ Set the value
387  this->requestedResolution = resolution;
388 
389  //================================================ Done
390  return ;
391 
392 }
393 
400 #if defined ( _WIN64 ) || defined ( _WIN32 )
401 void __declspec(dllexport) ProSHADE_settings::setPDBBFactor ( proshade_double newBF )
402 #else
403 void ProSHADE_settings::setPDBBFactor ( proshade_double newBF )
404 #endif
405 {
406  //================================================ Set the value
407  this->pdbBFactorNewVal = newBF;
408 
409  //================================================ Done
410  return ;
411 
412 }
413 
420 #if defined ( _WIN64 ) || defined ( _WIN32 )
421 void __declspec(dllexport) ProSHADE_settings::setNormalisation ( bool normalise )
422 #else
423 void ProSHADE_settings::setNormalisation ( bool normalise )
424 #endif
425 {
426  //================================================ Set the value
427  this->normaliseMap = normalise;
428 
429  //================================================ Done
430  return ;
431 
432 }
433 
440 #if defined ( _WIN64 ) || defined ( _WIN32 )
441 void __declspec(dllexport) ProSHADE_settings::setMapInversion ( bool mInv )
442 #else
444 #endif
445 {
446  //================================================ Set the value
447  this->invertMap = mInv;
448 
449  //================================================ Done
450  return ;
451 
452 }
453 
460 #if defined ( _WIN64 ) || defined ( _WIN32 )
461 void __declspec(dllexport) ProSHADE_settings::setVerbosity ( proshade_signed verbosity )
462 #else
463 void ProSHADE_settings::setVerbosity ( proshade_signed verbosity )
464 #endif
465 {
466  //================================================ Set the value
467  this->verbose = verbosity;
468 
469  //================================================ Done
470  return ;
471 
472 }
473 
480 #if defined ( _WIN64 ) || defined ( _WIN32 )
481 void __declspec(dllexport) ProSHADE_settings::setMaskBlurFactor ( proshade_single blurFac )
482 #else
483 void ProSHADE_settings::setMaskBlurFactor ( proshade_single blurFac )
484 #endif
485 {
486  //================================================ Set the value
487  this->blurFactor = blurFac;
488 
489  //================================================ Done
490  return ;
491 
492 }
493 
501 #if defined ( _WIN64 ) || defined ( _WIN32 )
502 void __declspec(dllexport) ProSHADE_settings::setMaskIQR ( proshade_single noIQRs )
503 #else
504 void ProSHADE_settings::setMaskIQR ( proshade_single noIQRs )
505 #endif
506 {
507  //================================================ Set the value
508  this->maskingThresholdIQRs = noIQRs;
509 
510  //================================================ Done
511  return ;
512 
513 }
514 
521 #if defined ( _WIN64 ) || defined ( _WIN32 )
522 void __declspec(dllexport) ProSHADE_settings::setMasking ( bool mask )
523 #else
525 #endif
526 {
527  //================================================ Set the value
528  this->maskMap = mask;
529 
530  //================================================ Done
531  return ;
532 
533 }
534 
542 #if defined ( _WIN64 ) || defined ( _WIN32 )
543 void __declspec(dllexport) ProSHADE_settings::setCorrelationMasking ( bool corMask )
544 #else
546 #endif
547 {
548  //================================================ Set the value
549  this->useCorrelationMasking = corMask;
550 
551  //================================================ Done
552  return ;
553 
554 }
555 
564 #if defined ( _WIN64 ) || defined ( _WIN32 )
565 void __declspec(dllexport) ProSHADE_settings::setTypicalNoiseSize ( proshade_single typNoi )
566 #else
567 void ProSHADE_settings::setTypicalNoiseSize ( proshade_single typNoi )
568 #endif
569 {
570  //================================================ Set the value
571  this->halfMapKernel = typNoi;
572 
573  //================================================ Done
574  return ;
575 
576 }
577 
584 #if defined ( _WIN64 ) || defined ( _WIN32 )
585 void __declspec(dllexport) ProSHADE_settings::setMinimumMaskSize ( proshade_single minMS )
586 #else
587 void ProSHADE_settings::setMinimumMaskSize ( proshade_single minMS )
588 #endif
589 {
590  //================================================ Set the value
591  this->correlationKernel = minMS;
592 
593  //================================================ Done
594  return ;
595 
596 }
597 
604 #if defined ( _WIN64 ) || defined ( _WIN32 )
605 void __declspec(dllexport) ProSHADE_settings::setMaskSaving ( bool savMsk )
606 #else
608 #endif
609 {
610  //================================================ Set the value
611  this->saveMask = savMsk;
612 
613  //================================================ Done
614  return ;
615 
616 }
617 
624 #if defined ( _WIN64 ) || defined ( _WIN32 )
625 void __declspec(dllexport) ProSHADE_settings::setMaskFilename ( std::string mskFln )
626 #else
627 void ProSHADE_settings::setMaskFilename ( std::string mskFln )
628 #endif
629 {
630  //================================================ Set the value
631  this->maskFileName = mskFln;
632 
633  //================================================ Done
634  return ;
635 
636 }
637 
644 #if defined ( _WIN64 ) || defined ( _WIN32 )
645 void __declspec(dllexport) ProSHADE_settings::setAppliedMaskFilename ( std::string mskFln )
646 #else
647 void ProSHADE_settings::setAppliedMaskFilename ( std::string mskFln )
648 #endif
649 {
650  //================================================ Set the value
651  this->appliedMaskFileName = mskFln;
652 
653  //================================================ Done
654  return ;
655 
656 }
657 
664 #if defined ( _WIN64 ) || defined ( _WIN32 )
665 void __declspec(dllexport) ProSHADE_settings::setFourierWeightsFilename ( std::string fWgFln )
666 #else
668 #endif
669 {
670  //================================================ Set the value
671  this->fourierWeightsFileName = fWgFln;
672 
673  //================================================ Done
674  return ;
675 
676 }
677 
684 #if defined ( _WIN64 ) || defined ( _WIN32 )
685 void __declspec(dllexport) ProSHADE_settings::setMapReboxing ( bool reBx )
686 #else
688 #endif
689 {
690  //================================================ Set the value
691  this->reBoxMap = reBx;
692 
693  //================================================ Done
694  return ;
695 
696 }
697 
705 #if defined ( _WIN64 ) || defined ( _WIN32 )
706 void __declspec(dllexport) ProSHADE_settings::setBoundsSpace ( proshade_single boundsExSp )
707 #else
708 void ProSHADE_settings::setBoundsSpace ( proshade_single boundsExSp )
709 #endif
710 {
711  //================================================ Set the value
712  this->boundsExtraSpace = boundsExSp;
713 
714  //================================================ Done
715  return ;
716 
717 }
718 
725 #if defined ( _WIN64 ) || defined ( _WIN32 )
726 void __declspec(dllexport) ProSHADE_settings::setBoundsThreshold ( proshade_signed boundsThres )
727 #else
728 void ProSHADE_settings::setBoundsThreshold ( proshade_signed boundsThres )
729 #endif
730 {
731  //================================================ Set the value
732  this->boundsSimilarityThreshold = boundsThres;
733 
734  //================================================ Done
735  return ;
736 
737 }
738 
746 #if defined ( _WIN64 ) || defined ( _WIN32 )
747 void __declspec(dllexport) ProSHADE_settings::setSameBoundaries ( bool sameB )
748 #else
750 #endif
751 {
752  //================================================ Set the value
753  this->useSameBounds = sameB;
754 
755  //================================================ Done
756  return ;
757 
758 }
759 
767 #if defined ( _WIN64 ) || defined ( _WIN32 )
768 void __declspec(dllexport) ProSHADE_settings::setOutputFilename ( std::string oFileName )
769 #else
770 void ProSHADE_settings::setOutputFilename ( std::string oFileName )
771 #endif
772 {
773  //================================================ Set the value
774  this->outName = oFileName;
775 
776  //================================================ Done
777  return ;
778 
779 }
780 
787 #if defined ( _WIN64 ) || defined ( _WIN32 )
788 void __declspec(dllexport) ProSHADE_settings::setMapResolutionChange ( bool mrChange )
789 #else
791 #endif
792 {
793  //================================================ Set the value
794  this->changeMapResolution = mrChange;
795 
796  //================================================ Done
797  return ;
798 
799 }
800 
807 #if defined ( _WIN64 ) || defined ( _WIN32 )
808 void __declspec(dllexport) ProSHADE_settings::setMapResolutionChangeTriLinear ( bool mrChange )
809 #else
811 #endif
812 {
813  //================================================ Set the value
814  this->changeMapResolutionTriLinear = mrChange;
815 
816  //================================================ Done
817  return ;
818 
819 }
820 
827 #if defined ( _WIN64 ) || defined ( _WIN32 )
828 void __declspec(dllexport) ProSHADE_settings::setMapCentering ( bool com )
829 #else
831 #endif
832 {
833  //================================================ Set the value
834  this->moveToCOM = com;
835 
836  //================================================ Done
837  return ;
838 
839 }
840 
847 #if defined ( _WIN64 ) || defined ( _WIN32 )
848 void __declspec(dllexport) ProSHADE_settings::setExtraSpace ( proshade_single exSpace )
849 #else
850 void ProSHADE_settings::setExtraSpace ( proshade_single exSpace )
851 #endif
852 {
853  //================================================ Set the value
854  this->addExtraSpace = exSpace;
855 
856  //================================================ Done
857  return ;
858 
859 }
860 
867 #if defined ( _WIN64 ) || defined ( _WIN32 )
868 void __declspec(dllexport) ProSHADE_settings::setBandwidth ( proshade_unsign band )
869 #else
870 void ProSHADE_settings::setBandwidth ( proshade_unsign band )
871 #endif
872 {
873  //================================================ Set the value
874  this->maxBandwidth = band;
875 
876  //================================================ Done
877  return ;
878 
879 }
880 
887 #if defined ( _WIN64 ) || defined ( _WIN32 )
888 void __declspec(dllexport) ProSHADE_settings::setSphereDistances ( proshade_single sphDist )
889 #else
890 void ProSHADE_settings::setSphereDistances ( proshade_single sphDist )
891 #endif
892 {
893  //================================================ Set the value
894  this->maxSphereDists = sphDist;
895 
896  //================================================ Done
897  return ;
898 
899 }
900 
907 #if defined ( _WIN64 ) || defined ( _WIN32 )
908 void __declspec(dllexport) ProSHADE_settings::setIntegrationOrder ( proshade_unsign intOrd )
909 #else
910 void ProSHADE_settings::setIntegrationOrder ( proshade_unsign intOrd )
911 #endif
912 {
913  //================================================ Set the value
914  this->integOrder = intOrd;
915 
916  //================================================ Done
917  return ;
918 
919 }
920 
928 #if defined ( _WIN64 ) || defined ( _WIN32 )
929 void __declspec(dllexport) ProSHADE_settings::setTaylorSeriesCap ( proshade_unsign tayCap )
930 #else
931 void ProSHADE_settings::setTaylorSeriesCap ( proshade_unsign tayCap )
932 #endif
933 {
934  //================================================ Set the value
935  this->taylorSeriesCap = tayCap;
936 
937  //================================================ Done
938  return ;
939 
940 }
941 
948 #if defined ( _WIN64 ) || defined ( _WIN32 )
949 void __declspec(dllexport) ProSHADE_settings::setProgressiveSphereMapping ( bool progSphMap )
950 #else
952 #endif
953 {
954  //================================================ Set the value
955  this->progressiveSphereMapping = progSphMap;
956 
957  //================================================ Done
958  return ;
959 
960 }
961 
969 #if defined ( _WIN64 ) || defined ( _WIN32 )
970 void __declspec(dllexport) ProSHADE_settings::setEnergyLevelsComputation ( bool enLevDesc )
971 #else
973 #endif
974 {
975  //======================================== Set the value
976  this->computeEnergyLevelsDesc = enLevDesc;
977 
978  //======================================== Done
979  return ;
980 
981 }
982 
990 #if defined ( _WIN64 ) || defined ( _WIN32 )
991 void __declspec(dllexport) ProSHADE_settings::setTraceSigmaComputation ( bool trSigVal )
992 #else
994 #endif
995 {
996  //================================================ Set the value
997  this->computeTraceSigmaDesc = trSigVal;
998 
999  //================================================ Done
1000  return ;
1001 
1002 }
1003 
1011 #if defined ( _WIN64 ) || defined ( _WIN32 )
1012 void __declspec(dllexport) ProSHADE_settings::setRotationFunctionComputation ( bool rotfVal )
1013 #else
1015 #endif
1016 {
1017  //================================================ Set the value
1018  this->computeRotationFuncDesc = rotfVal;
1019 
1020  //================================================ Done
1021  return ;
1022 
1023 }
1024 
1032 #if defined ( _WIN64 ) || defined ( _WIN32 )
1033 void __declspec(dllexport) ProSHADE_settings::setPeakNeighboursNumber ( proshade_unsign pkS )
1034 #else
1036 #endif
1037 {
1038  //================================================ Set the value
1039  this->peakNeighbours = pkS;
1040 
1041  //================================================ Done
1042  return ;
1043 
1044 }
1045 
1054 #if defined ( _WIN64 ) || defined ( _WIN32 )
1055 void __declspec(dllexport) ProSHADE_settings::setPeakNaiveNoIQR ( proshade_double noIQRs )
1056 #else
1057 void ProSHADE_settings::setPeakNaiveNoIQR ( proshade_double noIQRs )
1058 #endif
1059 {
1060  //================================================ Set the value
1061  this->noIQRsFromMedianNaivePeak = noIQRs;
1062 
1063  //================================================ Done
1064  return ;
1065 
1066 }
1067 
1076 #if defined ( _WIN64 ) || defined ( _WIN32 )
1077 void __declspec(dllexport) ProSHADE_settings::setPhaseUsage ( bool phaseUsage )
1078 #else
1079 void ProSHADE_settings::setPhaseUsage ( bool phaseUsage )
1080 #endif
1081 {
1082  //================================================ Set the value
1083  this->usePhase = phaseUsage;
1084 
1085  //================================================ Done
1086  return ;
1087 
1088 }
1089 
1098 #if defined ( _WIN64 ) || defined ( _WIN32 )
1099 void __declspec(dllexport) ProSHADE_settings::setEnLevShellWeight ( proshade_double mPower )
1100 #else
1101 void ProSHADE_settings::setEnLevShellWeight ( proshade_double mPower )
1102 #endif
1103 {
1104  //================================================ Set the value
1105  this->enLevMatrixPowerWeight = mPower;
1106 
1107  //================================================ Done
1108  return ;
1109 
1110 }
1111 
1120 #if defined ( _WIN64 ) || defined ( _WIN32 )
1121 void __declspec(dllexport) ProSHADE_settings::setGroupingSmoothingFactor ( proshade_double smFact )
1122 #else
1123 void ProSHADE_settings::setGroupingSmoothingFactor ( proshade_double smFact )
1124 #endif
1125 {
1126  //================================================ Set the value
1127  this->smoothingFactor = smFact;
1128 
1129  //================================================ Done
1130  return ;
1131 
1132 }
1133 
1141 #if defined ( _WIN64 ) || defined ( _WIN32 )
1142 void __declspec(dllexport) ProSHADE_settings::setMissingPeakThreshold ( proshade_double mpThres )
1143 #else
1144 void ProSHADE_settings::setMissingPeakThreshold ( proshade_double mpThres )
1145 #endif
1146 {
1147  //================================================ Set the value
1148  this->symMissPeakThres = mpThres;
1149 
1150  //================================================ Done
1151  return ;
1152 
1153 }
1154 
1162 #if defined ( _WIN64 ) || defined ( _WIN32 )
1163 void __declspec(dllexport) ProSHADE_settings::setAxisComparisonThreshold ( proshade_double axThres )
1164 #else
1165 void ProSHADE_settings::setAxisComparisonThreshold ( proshade_double axThres )
1166 #endif
1167 {
1168  //================================================ Set the value
1169  this->axisErrTolerance = axThres;
1170 
1171  //================================================ Done
1172  return ;
1173 
1174 }
1175 
1185 #if defined ( _WIN64 ) || defined ( _WIN32 )
1186 void __declspec(dllexport) ProSHADE_settings::setAxisComparisonThresholdBehaviour ( bool behav )
1187 #else
1189 #endif
1190 {
1191  //================================================ Set the value
1192  this->axisErrToleranceDefault = behav;
1193 
1194  //================================================ Done
1195  return ;
1196 
1197 }
1198 
1206 #if defined ( _WIN64 ) || defined ( _WIN32 )
1207 void __declspec(dllexport) ProSHADE_settings::setMinimumPeakForAxis ( proshade_double minSP )
1208 #else
1209 void ProSHADE_settings::setMinimumPeakForAxis ( proshade_double minSP )
1210 #endif
1211 {
1212  //================================================ Set the value
1213  this->minSymPeak = minSP;
1214 
1215  //================================================ Done
1216  return ;
1217 
1218 }
1219 
1228 #if defined ( _WIN64 ) || defined ( _WIN32 )
1229 void __declspec(dllexport) ProSHADE_settings::setRecommendedSymmetry ( std::string val )
1230 #else
1232 #endif
1233 {
1234  //================================================ Set the value
1235  this->recommendedSymmetryType = val;
1236 
1237  //================================================ Done
1238  return ;
1239 
1240 }
1241 
1251 #if defined ( _WIN64 ) || defined ( _WIN32 )
1252 void __declspec(dllexport) ProSHADE_settings::setRecommendedFold ( proshade_unsign val )
1253 #else
1254 void ProSHADE_settings::setRecommendedFold ( proshade_unsign val )
1255 #endif
1256 {
1257  //================================================ Set the value
1258  this->recommendedSymmetryFold = val;
1259 
1260  //================================================ Done
1261  return ;
1262 
1263 }
1264 
1271 #if defined ( _WIN64 ) || defined ( _WIN32 )
1272 void __declspec(dllexport) ProSHADE_settings::setRequestedSymmetry ( std::string val )
1273 #else
1275 #endif
1276 {
1277  //================================================ Set the value
1278  this->requestedSymmetryType = val;
1279 
1280  //================================================ Done
1281  return ;
1282 
1283 }
1284 
1291 #if defined ( _WIN64 ) || defined ( _WIN32 )
1292 void __declspec(dllexport) ProSHADE_settings::setRequestedFold ( proshade_unsign val )
1293 #else
1294 void ProSHADE_settings::setRequestedFold ( proshade_unsign val )
1295 #endif
1296 {
1297  //================================================ Set the value
1298  this->requestedSymmetryFold = val;
1299 
1300  //================================================ Done
1301  return ;
1302 
1303 }
1304 
1312 #if defined ( _WIN64 ) || defined ( _WIN32 )
1313 void __declspec(dllexport) ProSHADE_settings::setDetectedSymmetry ( proshade_double* sym )
1314 #else
1315 void ProSHADE_settings::setDetectedSymmetry ( proshade_double* sym )
1316 #endif
1317 {
1318  //================================================ Allocate memory
1319  proshade_double* hlpAxis = new proshade_double [7];
1320  ProSHADE_internal_misc::checkMemoryAllocation ( hlpAxis, __FILE__, __LINE__, __func__ );
1321 
1322  //================================================ Copy (deep) data
1323  hlpAxis[0] = sym[0];
1324  hlpAxis[1] = sym[1];
1325  hlpAxis[2] = sym[2];
1326  hlpAxis[3] = sym[3];
1327  hlpAxis[4] = sym[4];
1328  hlpAxis[5] = sym[5];
1329  hlpAxis[6] = sym[6];
1330 
1331  //================================================ Save
1332  ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( &this->detectedSymmetry, hlpAxis );
1333 
1334  //================================================ Release memory
1335  delete[] hlpAxis;
1336 
1337  //================================================ Done
1338  return ;
1339 
1340 }
1341 
1346 #if defined ( _WIN64 ) || defined ( _WIN32 )
1347 void __declspec(dllexport) ProSHADE_settings::setOverlaySaveFile ( std::string filename )
1348 #else
1349 void ProSHADE_settings::setOverlaySaveFile ( std::string filename )
1350 #endif
1351 {
1352  //================================================ Set the value
1353  this->overlayStructureName = filename;
1354 
1355  //================================================ Done
1356  return ;
1357 
1358 }
1359 
1364 #if defined ( _WIN64 ) || defined ( _WIN32 )
1365 void __declspec(dllexport) ProSHADE_settings::setOverlayJsonFile ( std::string filename )
1366 #else
1367 void ProSHADE_settings::setOverlayJsonFile ( std::string filename )
1368 #endif
1369 {
1370  //================================================ Set the value
1371  this->rotTrsJSONFile = filename;
1372 
1373  //================================================ Done
1374  return ;
1375 
1376 }
1377 
1382 #if defined ( _WIN64 ) || defined ( _WIN32 )
1383 void __declspec(dllexport) ProSHADE_settings::setBicubicInterpolationSearch ( bool bicubPeaks )
1384 #else
1386 #endif
1387 {
1388  //================================================ Set the value
1389  this->useBiCubicInterpolationOnPeaks = bicubPeaks;
1390 
1391  //================================================ Done
1392  return ;
1393 
1394 }
1395 
1400 #if defined ( _WIN64 ) || defined ( _WIN32 )
1401 void __declspec(dllexport) ProSHADE_settings::setMaxSymmetryFold ( proshade_unsign maxFold )
1402 #else
1403 void ProSHADE_settings::setMaxSymmetryFold ( proshade_unsign maxFold )
1404 #endif
1405 {
1406  //================================================ Set the value
1407  this->maxSymmetryFold = maxFold;
1408 
1409  //================================================ Done
1410  return ;
1411 
1412 }
1413 
1418 #if defined ( _WIN64 ) || defined ( _WIN32 )
1419 void __declspec(dllexport) ProSHADE_settings::setFSCThreshold ( proshade_double fscThr )
1420 #else
1421 void ProSHADE_settings::setFSCThreshold ( proshade_double fscThr )
1422 #endif
1423 {
1424  //================================================ Set the value
1425  this->fscThreshold = fscThr;
1426 
1427  //================================================ Done
1428  return ;
1429 
1430 }
1431 
1436 #if defined ( _WIN64 ) || defined ( _WIN32 )
1437 void __declspec(dllexport) ProSHADE_settings::setPeakThreshold ( proshade_double peakThr )
1438 #else
1439 void ProSHADE_settings::setPeakThreshold ( proshade_double peakThr )
1440 #endif
1441 {
1442  //================================================ Set the value
1443  this->peakThresholdMin = peakThr;
1444 
1445  //================================================ Done
1446  return ;
1447 
1448 }
1449 
1454 #if defined ( _WIN64 ) || defined ( _WIN32 )
1455 void __declspec(dllexport) ProSHADE_settings::setNegativeDensity ( bool nDens )
1456 #else
1458 #endif
1459 {
1460  //================================================ Set the value
1461  this->removeNegativeDensity = nDens;
1462 
1463  //================================================ Done
1464  return ;
1465 
1466 }
1467 
1476 void ProSHADE_settings::determineBandwidth ( proshade_unsign circumference )
1477 {
1478  //================================================ Check the current settings value is set to auto
1479  if ( this->maxBandwidth != 0 )
1480  {
1481  std::stringstream hlpSS;
1482  hlpSS << "The bandwidth was determined as: " << this->maxBandwidth;
1484  return ;
1485  }
1486 
1487  //================================================ Determine automatically
1489 
1490  //================================================ Report progress
1491  std::stringstream hlpSS;
1492  hlpSS << "The bandwidth was determined as: " << this->maxBandwidth;
1494 
1495  //================================================ Done
1496  return ;
1497 
1498 }
1499 
1508 void ProSHADE_settings::determineBandwidthFromAngle ( proshade_double uncertainty )
1509 {
1510  //================================================ Determine bandwidth
1511  if ( static_cast<proshade_unsign> ( std::ceil ( ( 360.0 / uncertainty ) / 2 ) ) % 2 == 0 )
1512  {
1513  this->maxBandwidth = static_cast<proshade_unsign> ( std::ceil ( ( 360.0 / uncertainty ) / 2.0 ) );
1514  }
1515  else
1516  {
1517  this->maxBandwidth = static_cast<proshade_unsign> ( std::ceil ( ( 360.0 / uncertainty ) / 2.0 ) ) + 1;
1518  }
1519 
1520  //================================================ Report progress
1521  std::stringstream hlpSS;
1522  hlpSS << "The bandwidth was determined from uncertainty " << uncertainty << " degrees as: " << this->maxBandwidth;
1524 
1525  //================================================ Done
1526  return ;
1527 
1528 }
1529 
1539 void ProSHADE_settings::determineSphereDistances ( proshade_single maxMapRange )
1540 {
1541  //================================================ Check the current settings value is set to auto
1542  if ( this->maxSphereDists != 0.0f )
1543  {
1544  std::stringstream hlpSS;
1545  hlpSS << "The sphere distances were determined as " << this->maxSphereDists << " Angstroms.";
1547  return ;
1548  }
1549 
1550  //================================================ Determine automatically
1552 
1553  //================================================ Report progress
1554  std::stringstream hlpSS;
1555  hlpSS << "The sphere distances were determined as " << this->maxSphereDists << " Angstroms.";
1557 
1558  //================================================ Done
1559  return ;
1560 
1561 }
1562 
1571 void ProSHADE_settings::determineIntegrationOrder ( proshade_single maxMapRange )
1572 {
1573  //================================================ Check the current settings value is set to auto
1574  if ( this->integOrder != 0 )
1575  {
1576  std::stringstream hlpSS;
1577  hlpSS << "The integration order was determined as " << this->integOrder;
1579  return ;
1580  }
1581 
1582  //================================================ Determine automatically
1584 
1585  //================================================ Report progress
1586  std::stringstream hlpSS;
1587  hlpSS << "The integration order was determined as " << this->integOrder;
1589 
1590  //================================================ Done
1591  return ;
1592 
1593 }
1594 
1615 void ProSHADE_settings::determineAllSHValues ( proshade_unsign xDim, proshade_unsign yDim, proshade_single xDimAngs, proshade_single yDimAngs, proshade_single zDimAngs )
1616 {
1617  //================================================ Print progress message
1618  ProSHADE_internal_messages::printProgressMessage ( this->verbose, 1, "Preparing spherical harmonics environment." );
1619 
1620  //================================================ Modify dims by resolution
1621  proshade_unsign theoXDim = static_cast< proshade_unsign > ( std::ceil ( xDimAngs / ( this->requestedResolution / 2.0f ) ) );
1622  proshade_unsign theoYDim = static_cast< proshade_unsign > ( std::ceil ( yDimAngs / ( this->requestedResolution / 2.0f ) ) );
1623  proshade_unsign theoZDim = static_cast< proshade_unsign > ( std::ceil ( zDimAngs / ( this->requestedResolution / 2.0f ) ) );
1624 
1625  //================================================ Find maximum circumference
1626  proshade_unsign maxDim = std::max ( theoXDim, std::max ( theoYDim, theoZDim ) );
1627  proshade_unsign minDim = std::min ( theoXDim, std::min ( theoYDim, theoZDim ) );
1628  proshade_unsign midDim = 0;
1629  if ( ( xDim < maxDim ) && ( xDim > minDim ) ) { midDim = theoXDim; }
1630  else if ( ( yDim < maxDim ) && ( yDim > minDim ) ) { midDim = theoYDim; }
1631  else { midDim = theoZDim; }
1632 
1633  proshade_unsign circ = ( maxDim ) + ( midDim );
1634 
1635  //================================================ Bandwidth
1636  if ( this->rotationUncertainty > 0.0 ) { this->determineBandwidthFromAngle ( this->rotationUncertainty ); }
1637  else { this->determineBandwidth ( circ ); }
1638 
1639  //================================================ Find maximum diagonal in Angstroms
1640  proshade_single maxDiag = static_cast< proshade_single > ( std::sqrt ( std::pow ( static_cast<proshade_single> ( maxDim ) * ( this->requestedResolution / 2.0f ), 2.0f ) +
1641  std::pow ( static_cast<proshade_single> ( midDim ) * ( this->requestedResolution / 2.0f ), 2.0f ) ) );
1642 
1643  //================================================ Sphere distances
1644  this->determineSphereDistances ( maxDiag );
1645 
1646  //================================================ Integration order
1647  this->determineIntegrationOrder ( maxDiag );
1648 
1649  //================================================ Report function completion
1650  ProSHADE_internal_messages::printProgressMessage ( this->verbose, 2, "Spherical harmonics environment prepared." );
1651 
1652  //================================================ Done
1653  return ;
1654 
1655 }
1656 
1664 #if defined ( _WIN64 ) || defined ( _WIN32 )
1665 __declspec(dllexport) ProSHADE_run::ProSHADE_run ( ProSHADE_settings* settings )
1666 #else
1668 #endif
1669 {
1670  //================================================ Wellcome message if required
1672 
1673  //================================================ Save the general information
1674  this->noStructures = static_cast<proshade_unsign> ( settings->inputFiles.size() );
1675  this->verbose = static_cast<proshade_signed> ( settings->verbose );
1676 
1677  //================================================ Try to run ProSHADE
1678  try
1679  {
1680  //============================================ Depending on task, switch to correct function to call
1681  switch ( settings->task )
1682  {
1683  case NA:
1684  throw ProSHADE_exception ( "No task has been specified.", "E000001", __FILE__, __LINE__, __func__, "ProSHADE requires to be told which particular functiona-\n : lity (task) is requested from it. In order to do so, the\n : command line arguments specifying task need to be used\n : (if used from command line), or the ProSHADE_settings\n : object needs to have the member variable \'Task\' set to\n : one of the following values: Distances, Symmetry,\n : OverlayMap or MapManip." );
1685 
1686  case Symmetry:
1687  ProSHADE_internal_tasks::SymmetryDetectionTask ( settings, &this->RecomSymAxes, &this->allCSymAxes, &this->mapCOMShift );
1688  this->setSymmetryResults ( settings );
1689  break;
1690 
1691  case Distances:
1692  ProSHADE_internal_tasks::DistancesComputationTask ( settings, &this->enLevs, &this->trSigm, &this->rotFun );
1693  break;
1694 
1695  case OverlayMap:
1696  ProSHADE_internal_tasks::MapOverlayTask ( settings, &this->coordRotationCentre, &this->eulerAngles, &this->overlayTranslation );
1697  break;
1698 
1699  case MapManip:
1700  ProSHADE_internal_tasks::MapManipulationTask ( settings, &this->originalBounds, &this->reboxedBounds, &this->manipulatedMaps );
1701  break;
1702  }
1703  }
1704 
1705  //================================================ If this is ProSHADE exception, give all available info and terminate gracefully :-)
1706  catch ( ProSHADE_exception& err )
1707  {
1708  std::cerr << std::endl << "=====================" << std::endl << "!! ProSHADE ERROR !!" << std::endl << "=====================" << std::endl << std::flush;
1709  std::cerr << "Error Code : " << err.get_errc() << std::endl << std::flush;
1710  std::cerr << "ProSHADE version : " << PROSHADE_VERSION << std::endl << std::flush;
1711  std::cerr << "File : " << err.get_file() << std::endl << std::flush;
1712  std::cerr << "Line : " << err.get_line() << std::endl << std::flush;
1713  std::cerr << "Function : " << err.get_func() << std::endl << std::flush;
1714  std::cerr << "Message : " << err.what() << std::endl << std::flush;
1715  std::cerr << "Further information : " << err.get_info() << std::endl << std::endl << std::flush;
1716 
1717  //============================================ Done
1719  exit ( EXIT_FAILURE );
1720  }
1721 
1722  //================================================ Well, give all there is and just end
1723  catch ( ... )
1724  {
1725  std::cerr << std::endl << "=====================" << std::endl << "!! ProSHADE ERROR !!" << std::endl << "=====================" << std::endl << std::flush;
1726 
1727  //============================================ Try to find out more
1728 #if __cplusplus >= 201103L
1729  std::exception_ptr exc = std::current_exception();
1730  try
1731  {
1732  if (exc)
1733  {
1734  std::rethrow_exception ( exc );
1735  }
1736  }
1737  catch ( const std::exception& e )
1738  {
1739  std::cerr << "Caught unknown exception with following information: " << e.what() << std::endl << std::flush;
1740  }
1741 #else
1742  std::cerr << "Unknown error with no further explanation available. Please contact the author for help." << std::endl << std::flush;
1743 #endif
1744  std::cerr << "Terminating..." << std::endl << std::endl << std::flush;
1745 
1746  //============================================ Done
1748  exit ( EXIT_FAILURE );
1749  }
1750 
1751  //================================================ Terminating message
1753 
1754  //================================================ Done
1755 
1756 }
1757 
1762 #if defined ( _WIN64 ) || defined ( _WIN32 )
1763 __declspec(dllexport) ProSHADE_run::~ProSHADE_run ( )
1764 #else
1766 #endif
1767 {
1768  //================================================ Release reboxing pointers
1769  if ( this->originalBounds.size() > 0 ) { for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( this->originalBounds.size() ); iter++ ) { delete[] this->originalBounds.at(iter); } }
1770  if ( this->reboxedBounds.size() > 0 ) { for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( this->reboxedBounds.size() ); iter++ ) { delete[] this->reboxedBounds.at(iter); } }
1771  if ( this->manipulatedMaps.size() > 0 ) { for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( this->manipulatedMaps.size() ); iter++ ) { delete[] this->manipulatedMaps.at(iter); } }
1772 
1773  //================================================ Clear vectors
1774  this->enLevs.clear ( );
1775  this->trSigm.clear ( );
1776  this->rotFun.clear ( );
1777 
1778  //================================================ Delete symmetry axes memory
1779  if ( this->RecomSymAxes.size() > 0 )
1780  {
1781  for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( this->RecomSymAxes.size() ); iter++ )
1782  {
1783  delete[] this->RecomSymAxes.at(iter);
1784  }
1785  this->RecomSymAxes.clear ( );
1786  }
1787 
1788  //================================================ Done
1789 
1790 }
1791 
1796 #if defined ( _WIN64 ) || defined ( _WIN32 )
1797 std::string __declspec(dllexport) ProSHADE_run::getSymmetryType ( )
1798 #else
1800 #endif
1801 
1802 {
1803  //================================================ Return the value
1804  return ( this->symRecommType );
1805 }
1806 
1811 #if defined ( _WIN64 ) || defined ( _WIN32 )
1812 proshade_unsign __declspec(dllexport) ProSHADE_run::getSymmetryFold ( )
1813 #else
1815 #endif
1816 {
1817  //================================================ Return the value
1818  return ( this->symRecommFold );
1819 }
1820 
1827 void ProSHADE_run::setRecommendedSymmetry ( std::string val )
1828 {
1829  //================================================ Set the value
1830  this->symRecommType = val;
1831 
1832  //================================================ Done
1833  return ;
1834 
1835 }
1836 
1844 void ProSHADE_run::setRecommendedFold ( proshade_unsign val )
1845 {
1846  //================================================ Set the value
1847  this->symRecommFold = val;
1848 
1849  //================================================ Done
1850  return ;
1851 
1852 }
1853 
1861 void ProSHADE_run::setRecommendedAxis ( proshade_double* sym )
1862 {
1863  //================================================ Set the value
1864  ProSHADE_internal_misc::deepCopyAxisToDblPtrVector ( &this->RecomSymAxes, sym );
1865 
1866  //================================================ Done
1867  return ;
1868 
1869 }
1870 
1878 void ProSHADE_run::setSymmetryResults ( ProSHADE_settings* settings )
1879 {
1880  //================================================ Save type and fold
1881  this->setRecommendedSymmetry ( settings->recommendedSymmetryType );
1882  this->setRecommendedFold ( settings->recommendedSymmetryFold );
1883 
1884  //================================================ Done
1885  return ;
1886 
1887 }
1888 
1894 #if defined ( _WIN64 ) || defined ( _WIN32 )
1895 void __declspec(dllexport) ProSHADE_settings::getCommandLineParams ( int argc, char** argv )
1896 #else
1897 void ProSHADE_settings::getCommandLineParams ( int argc, char** argv )
1898 #endif
1899 {
1900  //================================================ If no command line arguments, print help
1901  if ( argc == 1 ) { ProSHADE_internal_messages::printHelp ( ); }
1902 
1903  //================================================ Long options struct
1904  const struct option_port longopts[] =
1905  {
1906  { "version", no_argument, nullptr, 'v' },
1907  { "help", no_argument, nullptr, 'h' },
1908  { "verbose", required_argument, nullptr, '!' },
1909  { "distances", no_argument, nullptr, 'D' },
1910  { "mapManip", no_argument, nullptr, 'M' },
1911  { "symmetry", no_argument, nullptr, 'S' },
1912  { "overlay", no_argument, nullptr, 'O' },
1913  { "file", required_argument, nullptr, 'f' },
1914  { "forceSpgP1", no_argument, nullptr, 'u' },
1915  { "removeWaters", no_argument, nullptr, 'w' },
1916  { "firstModel", no_argument, nullptr, 'x' },
1917  { "resolution", required_argument, nullptr, 'r' },
1918  { "bandwidth", required_argument, nullptr, 'b' },
1919  { "sphereDists", required_argument, nullptr, 's' },
1920  { "extraSpace", required_argument, nullptr, 'e' },
1921  { "integOrder", required_argument, nullptr, 'i' },
1922  { "taylorCap", required_argument, nullptr, 't' },
1923  { "invertMap", no_argument, nullptr, '@' },
1924  { "normalise", no_argument, nullptr, '#' },
1925  { "mask", no_argument, nullptr, '$' },
1926  { "saveMask", no_argument, nullptr, '%' },
1927  { "maskFile", required_argument, nullptr, '^' },
1928  { "applyMask", required_argument, nullptr, 'G' },
1929  { "maskBlurring", required_argument, nullptr, '&' },
1930  { "maskThreshold", required_argument, nullptr, '*' },
1931  { "mapReboxing", no_argument, nullptr, 'R' },
1932  { "boundsSpace", required_argument, nullptr, '(' },
1933  { "boundsThreshold", required_argument, nullptr, ')' },
1934  { "sameBoundaries", no_argument, nullptr, '-' },
1935  { "reBoxedFilename", required_argument, nullptr, 'g' },
1936  { "pdbTempFact", required_argument, nullptr, 'd' },
1937  { "center", no_argument, nullptr, 'c' },
1938  { "changeMapResol", no_argument, nullptr, 'j' },
1939  { "changeMapTriLin", no_argument, nullptr, 'a' },
1940  { "noPhase", no_argument, nullptr, 'p' },
1941  { "progressive", no_argument, nullptr, 'k' },
1942  { "noEnL", no_argument, nullptr, 'l' },
1943  { "noTrS", no_argument, nullptr, 'm' },
1944  { "noFRF", no_argument, nullptr, 'n' },
1945  { "EnLWeight", required_argument, nullptr, '_' },
1946  { "peakNeigh", required_argument, nullptr, '=' },
1947  { "peakThres", required_argument, nullptr, '+' },
1948  { "missAxThres", required_argument, nullptr, '[' },
1949  { "sameAxComp", required_argument, nullptr, ']' },
1950  { "axisComBeh", no_argument, nullptr, 'q' },
1951  { "bicubSearch", no_argument, nullptr, 'A' },
1952  { "maxSymPrime", required_argument, nullptr, 'B' },
1953  { "minPeakHeight", required_argument, nullptr, 'o' },
1954  { "fscThres", required_argument, nullptr, 'C' },
1955  { "peakMinThres", required_argument, nullptr, 'E' },
1956  { "reqSym", required_argument, nullptr, '{' },
1957  { "overlayFile", required_argument, nullptr, '}' },
1958  { "overlayJSONFile", required_argument, nullptr, 'y' },
1959  { "angUncertain", required_argument, nullptr, ';' },
1960  { "fourierWeights", required_argument, nullptr, 'z' },
1961  { "keepNegDens", no_argument, nullptr, 'F' },
1962  { nullptr, 0, nullptr, 0 }
1963  };
1964 
1965  //================================================ Short options string
1966  const char* const shortopts = "AaB:b:C:cd:DE:e:Ff:G:g:hi:jklmMno:Opqr:Rs:St:uvwxy:z:!:@#$%^:&:*:(:):-_:=:+:[:]:{:}:;:";
1967 
1968  //================================================ Parsing the options
1969  while ( true )
1970  {
1971  //============================================ Read the next option
1972  int opt = getopt_long_port ( argc, argv, shortopts, longopts, nullptr );
1973 
1974  //============================================ Done parsing
1975  if ( opt == -1 )
1976  {
1977  break;
1978  }
1979 
1980  //============================================ For each option, set the internal values appropriately
1981  switch ( opt )
1982  {
1983  //======================================= Print version info
1984  case 'v':
1985  {
1987  exit ( EXIT_SUCCESS );
1988  }
1989 
1990  //======================================= User needs help
1991  case 'h':
1992  {
1994  }
1995 
1996  //======================================= Save the argument as the verbosity value, or if no value given, just set to 3
1997  case '!':
1998  {
1999  this->setVerbosity ( static_cast<proshade_signed> ( atoi ( optarg ) ) );
2000  continue;
2001  }
2002 
2003  //======================================= Set task to distances
2004  case 'D':
2005  {
2006  this->task = Distances;
2007  continue;
2008  }
2009 
2010  //======================================= Set task to map manipulation
2011  case 'M':
2012  {
2013  this->task = MapManip;
2014  continue;
2015  }
2016 
2017  //======================================= Set task to symmetry detection
2018  case 'S':
2019  {
2020  this->task = Symmetry;
2021 
2022  //=================================== Force default unless changed already by the user
2023  const FloatingPoint< proshade_single > lhs1 ( this->requestedResolution ), rhs1 ( -1.0f );
2024  if ( lhs1.AlmostEquals ( rhs1 ) ) { this->requestedResolution = 6.0; }
2025 
2026  const FloatingPoint< proshade_double > lhs2 ( this->pdbBFactorNewVal ), rhs2 ( -1.0 );
2027  if ( lhs2.AlmostEquals ( rhs2 ) ) { this->pdbBFactorNewVal = 80.0; }
2028  this->changeMapResolution = !this->changeMapResolution; // Switch value. This can be over-ridden by the user by using -j
2029  this->moveToCOM = !this->moveToCOM; // Switch value. This can be over-ridden by the user by using -c.
2030 
2031  continue;
2032  }
2033 
2034  //======================================= Set task to map overlay
2035  case 'O':
2036  {
2037  this->task = OverlayMap;
2038  continue;
2039  }
2040 
2041  //======================================= Save the argument as a file to read in
2042  case 'f':
2043  {
2044  this->addStructure ( std::string ( optarg ) );
2045  continue;
2046  }
2047 
2048  //======================================= Force the input PDB files to have P1 spacegroup
2049  case 'u':
2050  {
2051  this->forceP1 = !this->forceP1;
2052  continue;
2053  }
2054 
2055  //======================================= Remove waters from PDB input files?
2056  case 'w':
2057  {
2058  this->removeWaters = !this->removeWaters;
2059  continue;
2060  }
2061 
2062  //======================================= Use all models, or just the first one?
2063  case 'x':
2064  {
2065  this->firstModelOnly = !this->firstModelOnly;
2066  continue;
2067  }
2068 
2069  //======================================= Save the argument as the resolution value
2070  case 'r':
2071  {
2072  this->setResolution ( static_cast<proshade_single> ( atof ( optarg ) ) );
2073  continue;
2074  }
2075 
2076  //======================================= Save the argument as the bandwidth value
2077  case 'b':
2078  {
2079  this->setBandwidth ( static_cast<proshade_unsign> ( atoi ( optarg ) ) );
2080  continue;
2081  }
2082 
2083  //======================================= Save the argument as the extra space value
2084  case 'e':
2085  {
2086  this->setExtraSpace ( static_cast<proshade_single> ( atof ( optarg ) ) );
2087  continue;
2088  }
2089 
2090  //======================================= Save the argument as the intaggration order value
2091  case 'i':
2092  {
2093  this->setIntegrationOrder ( static_cast<proshade_unsign> ( atof ( optarg ) ) );
2094  continue;
2095  }
2096 
2097  //======================================= Save the argument as the sphere distance value
2098  case 's':
2099  {
2100  this->setSphereDistances ( static_cast<proshade_single> ( atof ( optarg ) ) );
2101  continue;
2102  }
2103 
2104  //======================================= Save the argument as the taylor series cap value
2105  case 't':
2106  {
2107  this->setTaylorSeriesCap ( static_cast<proshade_unsign> ( atof ( optarg ) ) );
2108  continue;
2109  }
2110 
2111  //======================================= Set map inversion to true
2112  case '@':
2113  {
2114  this->setMapInversion ( true );
2115  continue;
2116  }
2117 
2118  //======================================= Set map normalisation to true
2119  case '#':
2120  {
2121  this->setNormalisation ( true );
2122  continue;
2123  }
2124 
2125  //======================================= Set map masking to true
2126  case '$':
2127  {
2128  this->setMasking ( true );
2129  continue;
2130  }
2131 
2132  //======================================= Set map masking to true and mask map saving to true as well
2133  case '%':
2134  {
2135  this->setMasking ( true );
2136  this->setMaskSaving ( true );
2137  continue;
2138  }
2139 
2140  //======================================= Save the argument as the mask filename value
2141  case '^':
2142  {
2143  this->setMaskFilename ( static_cast<std::string> ( optarg ) );
2144  continue;
2145  }
2146 
2147  //======================================= Save the argument as the mask filename value
2148  case 'G':
2149  {
2150  this->setAppliedMaskFilename ( static_cast<std::string> ( optarg ) );
2151  continue;
2152  }
2153 
2154  //======================================= Save the argument as the Fourier weights filename value
2155  case 'z':
2156  {
2157  this->setFourierWeightsFilename ( static_cast<std::string> ( optarg ) );
2158  continue;
2159  }
2160 
2161  //======================================= Save the argument as the mask blurring factor value
2162  case '&':
2163  {
2164  this->setMaskBlurFactor ( static_cast<proshade_single> ( atof ( optarg ) ) );
2165  continue;
2166  }
2167 
2168  //======================================= Save the argument as the mask threshold (IQR) value
2169  case '*':
2170  {
2171  this->setMaskIQR ( static_cast<proshade_single> ( atof ( optarg ) ) );
2172  continue;
2173  }
2174 
2175  //======================================= Set map reboxing to true
2176  case 'R':
2177  {
2178  this->setMasking ( true );
2179  this->setMapReboxing ( true );
2180  continue;
2181  }
2182 
2183  //======================================= Save the argument as the bounds extra space value
2184  case '(':
2185  {
2186  this->setBoundsSpace ( static_cast<proshade_single> ( atof ( optarg ) ) );
2187  continue;
2188  }
2189 
2190  //======================================= Save the argument as the bounds similarity threshold value
2191  case ')':
2192  {
2193  this->setBoundsThreshold ( static_cast<proshade_signed> ( atoi ( optarg ) ) );
2194  continue;
2195  }
2196 
2197  //======================================= Set same boundaries to true
2198  case '-':
2199  {
2200  this->setSameBoundaries ( true );
2201  continue;
2202  }
2203 
2204  //======================================= Save the argument as the re-boxed structure filename value
2205  case 'g':
2206  {
2207  this->setOutputFilename ( static_cast<std::string> ( optarg ) );
2208  continue;
2209  }
2210 
2211  //======================================= Save the argument as the PDB B-factor new constant value
2212  case 'd':
2213  {
2214  this->setPDBBFactor ( static_cast<proshade_double> ( atof ( optarg ) ) );
2215  continue;
2216  }
2217 
2218  //======================================= Set map centering to true
2219  case 'c':
2220  {
2221  this->moveToCOM = !this->moveToCOM;
2222  continue;
2223  }
2224 
2225  //======================================= Set map resolution change using Fourier transforms to true
2226  case 'j':
2227  {
2228  this->changeMapResolution = !this->changeMapResolution;
2229  continue;
2230  }
2231 
2232  //======================================= Set map resolution change using real-space tri-linear interpolation to true
2233  case 'a':
2234  {
2235  this->setMapResolutionChangeTriLinear ( true );
2236  continue;
2237  }
2238 
2239  //======================================= Set map phase removal to true
2240  case 'p':
2241  {
2242  this->setPhaseUsage ( false );
2243  continue;
2244  }
2245 
2246  //======================================= Set progressive shell mapping to true
2247  case 'k':
2248  {
2249  this->setProgressiveSphereMapping ( true );
2250  continue;
2251  }
2252 
2253  //======================================= Set energy level descriptor computation to false
2254  case 'l':
2255  {
2256  this->setEnergyLevelsComputation ( false );
2257  continue;
2258  }
2259 
2260  //======================================= Set trace sigma descriptor computation to false
2261  case 'm':
2262  {
2263  this->setTraceSigmaComputation ( false );
2264  continue;
2265  }
2266 
2267  //======================================= Set full rotation function descriptor computation to false
2268  case 'n':
2269  {
2270  this->setRotationFunctionComputation ( false );
2271  continue;
2272  }
2273 
2274  //======================================= Save the argument as the energy levels descriptor weight value
2275  case '_':
2276  {
2277  this->setEnLevShellWeight ( static_cast<proshade_double> ( atof ( optarg ) ) );
2278  continue;
2279  }
2280 
2281  //======================================= Save the argument as the peak neighbours minimum value
2282  case '=':
2283  {
2284  this->setPeakNeighboursNumber ( static_cast<proshade_unsign> ( atoi ( optarg ) ) );
2285  continue;
2286  }
2287 
2288  //======================================= Save the argument as the peak IQR from median naive small peaks removal value
2289  case '+':
2290  {
2291  this->setPeakNaiveNoIQR ( static_cast<proshade_double> ( atof ( optarg ) ) );
2292  continue;
2293  }
2294 
2295  //======================================= Save the argument as the missing axis threshold value
2296  case '[':
2297  {
2298  this->setMissingPeakThreshold ( static_cast<proshade_double> ( atof ( optarg ) ) );
2299  continue;
2300  }
2301 
2302  //======================================= Save the argument as the missing axis threshold value
2303  case ']':
2304  {
2305  setAxisComparisonThreshold ( static_cast<proshade_double> ( atof ( optarg ) ) );
2306  continue;
2307  }
2308 
2309  //======================================= Save the argument as the missing axis threshold value
2310  case 'q':
2311  {
2312  this->setAxisComparisonThresholdBehaviour ( !this->axisErrToleranceDefault );
2313  continue;
2314  }
2315 
2316  //======================================= Save the argument as the bicubic interpolation search requirement value
2317  case 'A':
2318  {
2319  this->setBicubicInterpolationSearch ( !this->useBiCubicInterpolationOnPeaks );
2320  continue;
2321  }
2322 
2323  //======================================= Save the argument as the bicubic interpolation search requirement value
2324  case 'B':
2325  {
2326  setMaxSymmetryFold ( static_cast<proshade_unsign> ( atoi ( optarg ) ) );
2327  continue;
2328  }
2329 
2330  //======================================= Minimum peak height for axis
2331  case 'o':
2332  {
2333  this->minSymPeak = static_cast<proshade_double> ( atof ( optarg ) );
2334  continue;
2335  }
2336 
2337  //======================================= Minimum FSC value for axis to be detected
2338  case 'C':
2339  {
2340  this->setFSCThreshold ( static_cast<proshade_double> ( atof ( optarg ) ) );
2341  continue;
2342  }
2343 
2344  //======================================= Minimum peak height value for axis to be considered possible
2345  case 'E':
2346  {
2347  this->setPeakThreshold ( static_cast<proshade_double> ( atof ( optarg ) ) );
2348  continue;
2349  }
2350 
2351  //======================================= Save the argument as the requested symmetry and potentially fold value
2352  case '{':
2353  {
2354  std::string input = static_cast<std::string> ( optarg );
2355 
2356  if ( input.at(0) == 'C' )
2357  {
2358  this->setRequestedSymmetry ( "C" );
2359 
2360  std::string numHlp ( input.begin()+1, input.end() );
2361  if ( numHlp.length() > 0 ) { this->setRequestedFold ( static_cast< proshade_unsign > ( atoi ( numHlp.c_str() ) ) ); }
2362  else { std::cerr << "!!! ProSHADE ERROR !!! The input argument requests search for Cyclic/Dihedral symmetry, but does not specify the requested fold." << std::endl; exit ( EXIT_FAILURE ); }
2363  }
2364  else
2365  {
2366  if ( input.at(0) == 'D' )
2367  {
2368  this->setRequestedSymmetry ( "D" );
2369 
2370  std::string numHlp ( input.begin()+1, input.end() );
2371  if ( numHlp.length() > 0 ) { this->setRequestedFold ( static_cast< proshade_unsign > ( atoi ( numHlp.c_str() ) ) ); }
2372  else { std::cerr << "!!! ProSHADE ERROR !!! The input argument requests search for Cyclic/Dihedral symmetry, but does not specify the requested fold." << std::endl; exit ( EXIT_FAILURE ); }
2373  }
2374  else
2375  {
2376  if ( input.at(0) == 'T' )
2377  {
2378  this->setRequestedSymmetry ( "T" );
2379  }
2380  else
2381  {
2382  if ( input.at(0) == 'O' )
2383  {
2384  this->setRequestedSymmetry ( "O" );
2385  }
2386  else
2387  {
2388  if ( input.at(0) == 'I' )
2389  {
2390  this->setRequestedSymmetry ( "I" );
2391  }
2392  else
2393  {
2394  std::cerr << "!!! ProSHADE ERROR !!! Failed to parse the requested symmetry type. Allowed types are C, D, T, O and I, with C and D requiring to be followed by a number specifying the fold." << std::endl; exit ( EXIT_FAILURE );
2395  }
2396  }
2397  }
2398  }
2399  }
2400 
2401  continue;
2402  }
2403 
2404  //======================================= Save the argument as filename to save the overlay moved structure to value
2405  case '}':
2406  {
2407  this->setOverlaySaveFile ( static_cast<std::string> ( optarg ) );
2408  continue;
2409  }
2410 
2411  //======================================= Save the argument as filename to save the overlay operations to value
2412  case 'y':
2413  {
2414  this->setOverlayJsonFile ( static_cast<std::string> ( optarg ) );
2415  continue;
2416  }
2417 
2418  //======================================= Save the argument as angular uncertainty for bandwidth determination
2419  case ';':
2420  {
2421  this->rotationUncertainty = static_cast<proshade_double> ( atof ( optarg ) );
2422  continue;
2423  }
2424 
2425  //======================================= Should the negative density from input files be removed?
2426  case 'F':
2427  {
2428  this->setNegativeDensity ( false );
2429  continue;
2430  }
2431 
2432  //======================================= Unknown option
2433  case '?':
2434  {
2435  //=================================== Save the argument as angular uncertainty for bandwidth determination
2436  if ( optopt )
2437  {
2438  std::cout << "!!! ProSHADE ERROR !!! Unrecognised short option -" << static_cast<char> ( optopt ) << " . Please use -h for help on the command line options." << std::endl;
2439  }
2440  else
2441  {
2442  std::cout << "!!! ProSHADE ERROR !!! Unrecognised long option " << argv[static_cast<int> (optind)-1] << " . Please use -h for help on the command line options." << std::endl;
2443  }
2444 
2445  //=================================== This case is handled by getopt_long, nothing more needed.
2446  exit ( EXIT_SUCCESS );
2447  }
2448 
2449  //======================================= Fallback option
2450  default:
2451  {
2453  }
2454  }
2455  }
2456 
2457  //================================================ Done
2458  return ;
2459 
2460 }
2461 
2466 #if defined ( _WIN64 ) || defined ( _WIN32 )
2467 void __declspec(dllexport) ProSHADE_settings::printSettings ( )
2468 #else
2470 #endif
2471 {
2472  //================================================ Print the currest values in the settings object
2473  //== Settings regarding the task at hand
2474  std::stringstream strstr;
2475  strstr.str(std::string());
2476  if ( this->task == NA ) { strstr << "NA"; }
2477  if ( this->task == Distances ) { strstr << "DISTANCES COMPUTATION"; }
2478  if ( this->task == MapManip ) { strstr << "MAP MANIPULATION"; }
2479  if ( this->task == Symmetry ) { strstr << "SYMMETRY DETECTION"; }
2480  if ( this->task == OverlayMap ) { strstr << "MAP OVERLAY"; }
2481  printf ( "Task to perform : %37s\n", strstr.str().c_str() );
2482 
2483  //== Settings regarding the input files
2484  for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( this->inputFiles.size() ); iter++ )
2485  {
2486  strstr.str(std::string());
2487  strstr << this->inputFiles.at(iter);
2488  printf ( "File(s) to process : %37s\n", strstr.str().c_str() );
2489  }
2490 
2491  strstr.str(std::string());
2492  if ( this->forceP1 ) { strstr << "TRUE"; } else { strstr << "FALSE"; }
2493  printf ( "Force P1 spacegroup : %37s\n", strstr.str().c_str() );
2494 
2495  strstr.str(std::string());
2496  if ( this->removeWaters ) { strstr << "TRUE"; } else { strstr << "FALSE"; }
2497  printf ( "Waters removed : %37s\n", strstr.str().c_str() );
2498 
2499  strstr.str(std::string());
2500  if ( this->firstModelOnly ) { strstr << "TRUE"; } else { strstr << "FALSE"; }
2501  printf ( "Only 1st model : %37s\n", strstr.str().c_str() );
2502 
2503  strstr.str(std::string());
2504  if ( this->removeNegativeDensity ) { strstr << "TRUE"; } else { strstr << "FALSE"; }
2505  printf ( "Remove neg. dens. : %37s\n", strstr.str().c_str() );
2506 
2507  //== Settings regarding the resolution of calculations
2508  strstr.str(std::string());
2509  strstr << this->requestedResolution;
2510  printf ( "Resolution (comp) : %37s\n", strstr.str().c_str() );
2511 
2512  strstr.str(std::string());
2513  if ( this->changeMapResolution ) { strstr << "TRUE"; } else { strstr << "FALSE"; }
2514  printf ( "Change map resol : %37s\n", strstr.str().c_str() );
2515 
2516  strstr.str(std::string());
2517  if ( this->changeMapResolutionTriLinear ) { strstr << "TRUE"; } else { strstr << "FALSE"; }
2518  printf ( "Change map tri-lin : %37s\n", strstr.str().c_str() );
2519 
2520  //== Settings regarding the PDB B-factor change
2521  strstr.str(std::string());
2522  strstr << this->pdbBFactorNewVal;
2523  printf ( "PDB B-factor const : %37s\n", strstr.str().c_str() );
2524 
2525  //== Settings regarding the bandwidth of calculations
2526  strstr.str(std::string());
2527  strstr << this->maxBandwidth;
2528  printf ( "Bandwidth : %37s\n", strstr.str().c_str() );
2529 
2530  strstr.str(std::string());
2531  strstr << this->rotationUncertainty;
2532  printf ( "Rotation doubt : %37s\n", strstr.str().c_str() );
2533 
2534  //== Settings regarding the phase
2535  strstr.str(std::string());
2536  if ( this->usePhase ) { strstr << "TRUE"; } else { strstr << "FALSE"; }
2537  printf ( "Use phase info : %37s\n", strstr.str().c_str() );
2538 
2539  //== Settings regarding the spheres
2540  strstr.str(std::string());
2541  strstr << this->maxSphereDists;
2542  printf ( "Sphere distances : %37s\n", strstr.str().c_str() );
2543 
2544  //== Settings regarding the Gauss-Legendre integration
2545  strstr.str(std::string());
2546  strstr << this->integOrder;
2547  printf ( "Integration order : %37s\n", strstr.str().c_str() );
2548 
2549  strstr.str(std::string());
2550  strstr << this->taylorSeriesCap;
2551  printf ( "Taylor series cap : %37s\n", strstr.str().c_str() );
2552 
2553  //== Settings regarding map normalisation
2554  strstr.str(std::string());
2555  if ( this->normaliseMap ) { strstr << "TRUE"; } else { strstr << "FALSE"; }
2556  printf ( "Map normalisation : %37s\n", strstr.str().c_str() );
2557 
2558  //== Settings regarding map inversion
2559  strstr.str(std::string());
2560  if ( this->invertMap ) { strstr << "TRUE"; } else { strstr << "FALSE"; }
2561  printf ( "Map inversion : %37s\n", strstr.str().c_str() );
2562 
2563  //== Settings regarding map masking
2564  strstr.str(std::string());
2565  strstr << this->blurFactor;
2566  printf ( "Map blurring : %37s\n", strstr.str().c_str() );
2567 
2568  strstr.str(std::string());
2569  strstr << this->maskingThresholdIQRs;
2570  printf ( "Masking threshold : %37s\n", strstr.str().c_str() );
2571 
2572  strstr.str(std::string());
2573  if ( this->maskMap ) { strstr << "TRUE"; } else { strstr << "FALSE"; }
2574  printf ( "Map masking : %37s\n", strstr.str().c_str() );
2575 
2576  strstr.str(std::string());
2577  if ( this->useCorrelationMasking ) { strstr << "TRUE"; } else { strstr << "FALSE"; }
2578  printf ( "Correlation mask : %37s\n", strstr.str().c_str() );
2579 
2580  strstr.str(std::string());
2581  strstr << this->halfMapKernel;
2582  printf ( "Half-map kernel : %37s\n", strstr.str().c_str() );
2583 
2584  strstr.str(std::string());
2585  strstr << this->correlationKernel;
2586  printf ( "Correlation kernel : %37s\n", strstr.str().c_str() );
2587 
2588  strstr.str(std::string());
2589  if ( this->saveMask ) { strstr << "TRUE"; } else { strstr << "FALSE"; }
2590  printf ( "Saving mask : %37s\n", strstr.str().c_str() );
2591 
2592  strstr.str(std::string());
2593  strstr << this->maskFileName;
2594  printf ( "Map mask filename : %37s\n", strstr.str().c_str() );
2595 
2596  //== Settings regarding re-boxing
2597  strstr.str(std::string());
2598  if ( this->reBoxMap ) { strstr << "TRUE"; } else { strstr << "FALSE"; }
2599  printf ( "Map re-boxing : %37s\n", strstr.str().c_str() );
2600 
2601  strstr.str(std::string());
2602  strstr << this->boundsExtraSpace;
2603  printf ( "Bounds extra space : %37s\n", strstr.str().c_str() );
2604 
2605  strstr.str(std::string());
2606  strstr << this->boundsSimilarityThreshold;
2607  printf ( "Bounds similarity : %37s\n", strstr.str().c_str() );
2608 
2609  strstr.str(std::string());
2610  if ( this->useSameBounds ) { strstr << "TRUE"; } else { strstr << "FALSE"; }
2611  printf ( "Same boundaries : %37s\n", strstr.str().c_str() );
2612 
2613  strstr.str(std::string());
2614  if ( this->forceBounds != nullptr )
2615  {
2616  strstr << this->forceBounds[0] << " - " << this->forceBounds[1] << " | " << this->forceBounds[2] << " - " << this->forceBounds[3] << " | " << this->forceBounds[4] << " - " << this->forceBounds[5];
2617  printf ( "Bounds similarity : %37s\n", strstr.str().c_str() );
2618  }
2619  else
2620  {
2621  strstr << "Not allocated";
2622  printf ( "Bounds similarity : %37s\n", strstr.str().c_str() );
2623  }
2624 
2625  //== Settings regarding COM
2626  strstr.str(std::string());
2627  if ( this->moveToCOM ) { strstr << "TRUE"; } else { strstr << "FALSE"; }
2628  printf ( "Map COM centering : %37s\n", strstr.str().c_str() );
2629 
2630  //== Settings regarding extra cell space
2631  strstr.str(std::string());
2632  strstr << this->addExtraSpace;
2633  printf ( "Extra space : %37s\n", strstr.str().c_str() );
2634 
2635  //== Settings regarding shell settings
2636  strstr.str(std::string());
2637  if ( this->progressiveSphereMapping ) { strstr << "TRUE"; } else { strstr << "FALSE"; }
2638  printf ( "Progressive spheres : %37s\n", strstr.str().c_str() );
2639 
2640  //== Settings regarding output file name
2641  strstr.str(std::string());
2642  strstr << this->outName;
2643  printf ( "Re-boxed filename : %37s\n", strstr.str().c_str() );
2644 
2645  //== Settings regarding distances computation
2646  strstr.str(std::string());
2647  if ( this->computeEnergyLevelsDesc ) { strstr << "TRUE"; } else { strstr << "FALSE"; }
2648  printf ( "Energy lvl desc : %37s\n", strstr.str().c_str() );
2649 
2650  strstr.str(std::string());
2651  strstr << this->enLevMatrixPowerWeight;
2652  printf ( "Energy lvl weight : %37s\n", strstr.str().c_str() );
2653 
2654  strstr.str(std::string());
2655  if ( this->computeTraceSigmaDesc ) { strstr << "TRUE"; } else { strstr << "FALSE"; }
2656  printf ( "Tr sigma desc : %37s\n", strstr.str().c_str() );
2657 
2658  strstr.str(std::string());
2659  if ( this->computeRotationFuncDesc ) { strstr << "TRUE"; } else { strstr << "FALSE"; }
2660  printf ( "Full RF desc : %37s\n", strstr.str().c_str() );
2661 
2662  //== Settings regarding peak searching
2663  strstr.str(std::string());
2664  strstr << this->peakNeighbours;
2665  printf ( "Neightbours to peak : %37s\n", strstr.str().c_str() );
2666 
2667  strstr.str(std::string());
2668  strstr << this->noIQRsFromMedianNaivePeak;
2669  printf ( "Peak IQR threshold : %37s\n", strstr.str().c_str() );
2670 
2671  //== Settings regarding 1D grouping
2672  strstr.str(std::string());
2673  strstr << this->smoothingFactor;
2674  printf ( "Smoothing factor : %37s\n", strstr.str().c_str() );
2675 
2676  //== Settings regarding the symmetry detection
2677  strstr.str(std::string());
2678  strstr << this->symMissPeakThres;
2679  printf ( "Missing ax. thres : %37s\n", strstr.str().c_str() );
2680 
2681  strstr.str(std::string());
2682  strstr << this->axisErrTolerance;
2683  printf ( "Same ax. threshold : %37s\n", strstr.str().c_str() );
2684 
2685  strstr.str(std::string());
2686  if ( this->axisErrToleranceDefault ) { strstr << "TRUE"; } else { strstr << "FALSE"; }
2687  printf ( "Same ax. thre. decr.: %37s\n", strstr.str().c_str() );
2688 
2689  strstr.str(std::string());
2690  strstr << this->minSymPeak;
2691  printf ( "Min. sym. peak size : %37s\n", strstr.str().c_str() );
2692 
2693  strstr.str(std::string());
2694  strstr << this->recommendedSymmetryType << "-" << this->recommendedSymmetryFold;
2695  printf ( "Recommended symm. : %37s\n", strstr.str().c_str() );
2696 
2697  strstr.str(std::string());
2698  strstr << this->requestedSymmetryType << "-" << this->requestedSymmetryFold;
2699  printf ( "Requested symm. : %37s\n", strstr.str().c_str() );
2700 
2701  strstr.str(std::string());
2702  if ( this->useBiCubicInterpolationOnPeaks ) { strstr << "TRUE"; } else { strstr << "FALSE"; }
2703  printf ( "Use bicubic interp. : %37s\n", strstr.str().c_str() );
2704 
2705  strstr.str(std::string());
2706  strstr << this->maxSymmetryFold;
2707  printf ( "Max symmetry fold : %37s\n", strstr.str().c_str() );
2708 
2709  strstr.str(std::string());
2710  strstr << this->fscThreshold;
2711  printf ( "FSC Threshold : %37s\n", strstr.str().c_str() );
2712 
2713  strstr.str(std::string());
2714  strstr << this->peakThresholdMin;
2715  printf ( "Peak Threshold : %37s\n", strstr.str().c_str() );
2716 
2717  //== Settings regarding the structure overlay
2718  strstr.str(std::string());
2719  strstr << this->overlayStructureName;
2720  printf ( "Overlay file : %37s\n", strstr.str().c_str() );
2721 
2722  strstr.str(std::string());
2723  strstr << this->rotTrsJSONFile;
2724  printf ( "JSON overlay file : %37s\n", strstr.str().c_str() );
2725 
2726  //== Settings regarding verbosity of the program
2727  strstr.str(std::string());
2728  strstr << this->verbose;
2729  printf ( "Verbosity : %37s\n", strstr.str().c_str() );
2730 
2731  //================================================ Done
2732  return ;
2733 
2734 }
2735 
2740 #if defined ( _WIN64 ) || defined ( _WIN32 )
2741 std::vector< proshade_double > __declspec(dllexport) ProSHADE_run::getEnergyLevelsVector ( )
2742 #else
2743 std::vector< proshade_double > ProSHADE_run::getEnergyLevelsVector ( )
2744 #endif
2745 {
2746  //================================================ Return the value
2747  return ( this->enLevs );
2748 }
2749 
2754 #if defined ( _WIN64 ) || defined ( _WIN32 )
2755 std::vector< proshade_double > __declspec(dllexport) ProSHADE_run::getTraceSigmaVector ( )
2756 #else
2757 std::vector< proshade_double > ProSHADE_run::getTraceSigmaVector ( )
2758 #endif
2759 {
2760  //================================================ Return the value
2761  return ( this->trSigm );
2762 }
2763 
2768 #if defined ( _WIN64 ) || defined ( _WIN32 )
2769 std::vector< proshade_double > __declspec(dllexport) ProSHADE_run::getRotationFunctionVector ( )
2770 #else
2771 std::vector< proshade_double > ProSHADE_run::getRotationFunctionVector ( )
2772 #endif
2773 {
2774  //================================================ Return the value
2775  return ( this->rotFun );
2776 }
2777 
2783 {
2784  //================================================ Return the value
2785  return ( this->noStructures );
2786 }
2787 
2792 proshade_signed ProSHADE_run::getVerbose ( )
2793 {
2794  //================================================ Return the value
2795  return ( this->verbose );
2796 }
2797 
2803 {
2804  //================================================ Return the value
2805  return ( static_cast<proshade_unsign> ( this->RecomSymAxes.size() ) );
2806 }
2807 
2813 {
2814  //================================================ Return the value
2815  return ( static_cast<proshade_unsign> ( this->RecomSymAxes.size() ) );
2816 }
2817 
2823 #if defined ( _WIN64 ) || defined ( _WIN32 )
2824 std::vector< std::string > __declspec(dllexport) ProSHADE_run::getSymmetryAxis ( proshade_unsign axisNo )
2825 #else
2826 std::vector< std::string > ProSHADE_run::getSymmetryAxis ( proshade_unsign axisNo )
2827 #endif
2828 {
2829  //================================================ Sanity checks
2830  if ( static_cast<proshade_unsign> ( this->RecomSymAxes.size() ) <= axisNo )
2831  {
2832  ProSHADE_internal_messages::printWarningMessage ( this->verbose, "!!! ProSHADE WARNING !!! Requested symmetry index does not exist. Returning empty vector.", "WS00039" );
2833  return ( std::vector< std::string > ( ) );
2834  }
2835 
2836  //================================================ Initialise local variables
2837  std::vector< std::string > ret;
2838 
2839  //================================================ Input the axis data as strings
2840  std::stringstream ssHlp;
2841  ssHlp << this->RecomSymAxes.at(axisNo)[0];
2842  ProSHADE_internal_misc::addToStringVector ( &ret, ssHlp.str() );
2843  ssHlp.str ( "" );
2844 
2845  ssHlp << this->RecomSymAxes.at(axisNo)[1];
2846  ProSHADE_internal_misc::addToStringVector ( &ret, ssHlp.str() );
2847  ssHlp.str ( "" );
2848 
2849  ssHlp << this->RecomSymAxes.at(axisNo)[2];
2850  ProSHADE_internal_misc::addToStringVector ( &ret, ssHlp.str() );
2851  ssHlp.str ( "" );
2852 
2853  ssHlp << this->RecomSymAxes.at(axisNo)[3];
2854  ProSHADE_internal_misc::addToStringVector ( &ret, ssHlp.str() );
2855  ssHlp.str ( "" );
2856 
2857  ssHlp << this->RecomSymAxes.at(axisNo)[4];
2858  ProSHADE_internal_misc::addToStringVector ( &ret, ssHlp.str() );
2859  ssHlp.str ( "" );
2860 
2861  ssHlp << this->RecomSymAxes.at(axisNo)[5];
2862  ProSHADE_internal_misc::addToStringVector ( &ret, ssHlp.str() );
2863  ssHlp.str ( "" );
2864 
2865  ssHlp << this->RecomSymAxes.at(axisNo)[6];
2866  ProSHADE_internal_misc::addToStringVector ( &ret, ssHlp.str() );
2867  ssHlp.str ( "" );
2868 
2869  //================================================ Done
2870  return ( ret );
2871 
2872 }
2873 
2878 #if defined ( _WIN64 ) || defined ( _WIN32 )
2879 std::vector < std::vector< proshade_double > > __declspec(dllexport) ProSHADE_run::getAllCSyms ( )
2880 #else
2881 std::vector < std::vector< proshade_double > > ProSHADE_run::getAllCSyms ( )
2882 #endif
2883 {
2884  //================================================ Done
2885  return ( this->allCSymAxes );
2886 
2887 }
2888 
2893 #if defined ( _WIN64 ) || defined ( _WIN32 )
2894 std::vector < proshade_double > __declspec(dllexport) ProSHADE_run::getMapCOMProcessChange ( )
2895 #else
2896 std::vector < proshade_double > ProSHADE_run::getMapCOMProcessChange ( )
2897 #endif
2898 {
2899  //================================================ Done
2900  return ( this->mapCOMShift );
2901 
2902 }
2903 
2908 #if defined ( _WIN64 ) || defined ( _WIN32 )
2909 std::vector< proshade_signed > __declspec(dllexport) ProSHADE_run::getOriginalBounds ( proshade_unsign strNo )
2910 #else
2911 std::vector< proshade_signed > ProSHADE_run::getOriginalBounds ( proshade_unsign strNo )
2912 #endif
2913 {
2914  //================================================ Sanity checks
2915  if ( noStructures <= strNo )
2916  {
2917  ProSHADE_internal_messages::printWarningMessage ( this->verbose, "!!! ProSHADE WARNING !!! Requested bounds for structure index which does not exist. Returning empty vector.", "WB00041" );
2918  return ( std::vector< proshade_signed > ( ) );
2919  }
2920 
2921  //================================================ Initialise local variables
2922  std::vector< proshade_signed > ret;
2923 
2924  //================================================ Input the axis data as strings
2925  ProSHADE_internal_misc::addToSignedVector ( &ret, this->originalBounds.at( strNo )[0] );
2926  ProSHADE_internal_misc::addToSignedVector ( &ret, this->originalBounds.at( strNo )[1] );
2927  ProSHADE_internal_misc::addToSignedVector ( &ret, this->originalBounds.at( strNo )[2] );
2928  ProSHADE_internal_misc::addToSignedVector ( &ret, this->originalBounds.at( strNo )[3] );
2929  ProSHADE_internal_misc::addToSignedVector ( &ret, this->originalBounds.at( strNo )[4] );
2930  ProSHADE_internal_misc::addToSignedVector ( &ret, this->originalBounds.at( strNo )[5] );
2931 
2932  //================================================ Done
2933  return ( ret );
2934 }
2935 
2940 #if defined ( _WIN64 ) || defined ( _WIN32 )
2941 std::vector< proshade_signed > __declspec(dllexport) ProSHADE_run::getReBoxedBounds ( proshade_unsign strNo )
2942 #else
2943 std::vector< proshade_signed > ProSHADE_run::getReBoxedBounds ( proshade_unsign strNo )
2944 #endif
2945 {
2946  //================================================ Sanity checks
2947  if ( noStructures <= strNo )
2948  {
2949  ProSHADE_internal_messages::printWarningMessage ( this->verbose, "!!! ProSHADE WARNING !!! Requested bounds for structure index which does not exist. Returning empty vector.", "WB00041" );
2950  return ( std::vector< proshade_signed > ( ) );
2951  }
2952 
2953  //================================================ Initialise local variables
2954  std::vector< proshade_signed > ret;
2955 
2956  //================================================ Input the axis data as strings
2957  ProSHADE_internal_misc::addToSignedVector ( &ret, this->reboxedBounds.at( strNo )[0] );
2958  ProSHADE_internal_misc::addToSignedVector ( &ret, this->reboxedBounds.at( strNo )[1] );
2959  ProSHADE_internal_misc::addToSignedVector ( &ret, this->reboxedBounds.at( strNo )[2] );
2960  ProSHADE_internal_misc::addToSignedVector ( &ret, this->reboxedBounds.at( strNo )[3] );
2961  ProSHADE_internal_misc::addToSignedVector ( &ret, this->reboxedBounds.at( strNo )[4] );
2962  ProSHADE_internal_misc::addToSignedVector ( &ret, this->reboxedBounds.at( strNo )[5] );
2963 
2964  //================================================ Done
2965  return ( ret );
2966 }
2967 
2974 #if defined ( _WIN64 ) || defined ( _WIN32 )
2975 proshade_double __declspec(dllexport) ProSHADE_run::getMapValue ( proshade_unsign strNo, proshade_unsign mapIndex )
2976 #else
2977 proshade_double ProSHADE_run::getMapValue ( proshade_unsign strNo, proshade_unsign mapIndex )
2978 #endif
2979 {
2980  //================================================ Return the value
2981  return ( this->manipulatedMaps.at(strNo)[mapIndex] );
2982 }
2983 
2991 #if defined ( _WIN64 ) || defined ( _WIN32 )
2992 void __declspec(dllexport) getReBoxedMap ( ProSHADE_run* run, proshade_unsign strNo, double *reboxMap, int len )
2993 #else
2994 void getReBoxedMap ( ProSHADE_run* run, proshade_unsign strNo, double *reboxMap, int len )
2995 #endif
2996 {
2997  //================================================ Sanity checks
2998  if ( run->getNoStructures() <= strNo )
2999  {
3000  ProSHADE_internal_messages::printWarningMessage ( run->getVerbose(), "!!! ProSHADE WARNING !!! Requested bounds for structure index which does not exist. Returning empty vector.", "WB00041" );
3001  return ;
3002  }
3003 
3004  //================================================ Save the data into the output array
3005  for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( len ); iter++)
3006  {
3007  reboxMap[iter] = static_cast<double> ( run->getMapValue ( strNo, iter ) );
3008  }
3009 
3010  //================================================ Done
3011  return ;
3012 
3013 }
3014 
3019 #if defined ( _WIN64 ) || defined ( _WIN32 )
3020 std::vector< proshade_double > __declspec(dllexport) ProSHADE_run::getEulerAngles ( )
3021 #else
3022 std::vector< proshade_double > ProSHADE_run::getEulerAngles ( )
3023 #endif
3024 {
3025  //================================================ Sanity check
3026  if ( this->eulerAngles.size() != 3 )
3027  {
3028  ProSHADE_internal_messages::printWarningMessage ( this->verbose, "!!! ProSHADE WARNING !!! Requested rotation/translation values for Overlay functionality without having successfully computed it. Please check the correct task was used and no other warnings/errors were obtained.", "WO00042" );
3029  return ( std::vector< proshade_double > ( ) );
3030  }
3031 
3032  //================================================ Return required value
3033  return ( this->eulerAngles );
3034 
3035 }
3036 
3041 #if defined ( _WIN64 ) || defined ( _WIN32 )
3042 std::vector< proshade_double > __declspec(dllexport) ProSHADE_run::getOptimalRotMat ( )
3043 #else
3044 std::vector< proshade_double > ProSHADE_run::getOptimalRotMat ( )
3045 #endif
3046 {
3047  //================================================ Sanity check
3048  if ( this->eulerAngles.size() != 3 )
3049  {
3050  ProSHADE_internal_messages::printWarningMessage ( this->verbose, "!!! ProSHADE WARNING !!! Requested rotation/translation values for Overlay functionality without having successfully computed it. Please check the correct task was used and no other warnings/errors were obtained.", "WO00042" );
3051  return ( std::vector< proshade_double > ( ) );
3052  }
3053 
3054  //================================================ Obtain the optimal rotation matrix
3055  proshade_double* rotMat = new proshade_double[9];
3056  ProSHADE_internal_misc::checkMemoryAllocation ( rotMat, __FILE__, __LINE__, __func__ );
3057  ProSHADE_internal_maths::getRotationMatrixFromEulerZXZAngles ( this->eulerAngles.at(0), this->eulerAngles.at(1), this->eulerAngles.at(2), rotMat );
3058 
3059  //================================================ Copy to the output variable
3060  std::vector< proshade_double > ret;
3061  for ( proshade_unsign iter = 0; iter < 9; iter++ ) { ProSHADE_internal_misc::addToDoubleVector ( &ret, rotMat[iter] ); }
3062 
3063  //================================================ Release the memory
3064  delete[] rotMat;
3065 
3066  //================================================ Return required value
3067  return ( ret );
3068 
3069 }
3070 
3075 #if defined ( _WIN64 ) || defined ( _WIN32 )
3076 std::vector< proshade_double > __declspec(dllexport) ProSHADE_run::getTranslationToOrigin ( )
3077 #else
3078 std::vector< proshade_double > ProSHADE_run::getTranslationToOrigin ( )
3079 #endif
3080 {
3081  //================================================ Sanity check
3082  if ( this->coordRotationCentre.size() != 3 )
3083  {
3084  ProSHADE_internal_messages::printWarningMessage ( this->verbose, "!!! ProSHADE WARNING !!! Requested rotation/translation values for Overlay functionality without having successfully computed it. Please check the correct task was used and no other warnings/errors were obtained.", "WO00042" );
3085  return ( std::vector< proshade_double > ( ) );
3086  }
3087 
3088  //================================================ Create return variable with negative values of the internal varariable
3089  std::vector < proshade_double > ret;
3090  ProSHADE_internal_misc::addToDoubleVector ( &ret, -this->coordRotationCentre.at(0) );
3091  ProSHADE_internal_misc::addToDoubleVector ( &ret, -this->coordRotationCentre.at(1) );
3092  ProSHADE_internal_misc::addToDoubleVector ( &ret, -this->coordRotationCentre.at(2) );
3093 
3094  //================================================ Return required value
3095  return ( ret );
3096 
3097 }
3098 
3103 #if defined ( _WIN64 ) || defined ( _WIN32 )
3104 std::vector< proshade_double > __declspec(dllexport) ProSHADE_run::getOriginToOverlayTranslation ( )
3105 #else
3106 std::vector< proshade_double > ProSHADE_run::getOriginToOverlayTranslation ( )
3107 #endif
3108 {
3109  //================================================ Sanity check
3110  if ( this->overlayTranslation.size() != 3 )
3111  {
3112  ProSHADE_internal_messages::printWarningMessage ( this->verbose, "!!! ProSHADE WARNING !!! Requested rotation/translation values for Overlay functionality without having successfully computed it. Please check the correct task was used and no other warnings/errors were obtained.", "WO00042" );
3113  return ( std::vector< proshade_double > ( ) );
3114  }
3115 
3116  //================================================ Return required value
3117  return ( this->overlayTranslation );
3118 
3119 }
ProSHADE_settings::noIQRsFromMedianNaivePeak
proshade_double noIQRsFromMedianNaivePeak
When doing peak searching, how many IQRs from the median the threshold for peak height should be (in ...
Definition: ProSHADE_settings.hpp:118
ProSHADE_settings::setOverlayJsonFile
void setOverlayJsonFile(std::string filename)
Sets the filename to which the overlay operations are to be save into.
Definition: ProSHADE.cpp:1367
ProSHADE_internal_tasks::MapOverlayTask
void MapOverlayTask(ProSHADE_settings *settings, std::vector< proshade_double > *rotationCentre, std::vector< proshade_double > *eulerAngles, std::vector< proshade_double > *finalTranslation)
The symmetry detection task driver function.
Definition: ProSHADE_tasks.cpp:369
ProSHADE_settings::maxBandwidth
proshade_unsign maxBandwidth
The bandwidth of spherical harmonics decomposition for the largest sphere.
Definition: ProSHADE_settings.hpp:58
ProSHADE_settings::integOrder
proshade_unsign integOrder
The order required for full Gauss-Legendre integration between the spheres.
Definition: ProSHADE_settings.hpp:68
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:128
ProSHADE_settings::setEnLevShellWeight
void setEnLevShellWeight(proshade_double mPower)
Sets the weight of shell position for the energy levels computation.
Definition: ProSHADE.cpp:1101
ProSHADE_settings::setTraceSigmaComputation
void setTraceSigmaComputation(bool trSigVal)
Sets whether the trace sigma distance descriptor should be computed.
Definition: ProSHADE.cpp:993
ProSHADE_settings::setSameBoundaries
void setSameBoundaries(bool sameB)
Sets whether same boundaries should be used in the appropriate variable.
Definition: ProSHADE.cpp:749
ProSHADE_run::~ProSHADE_run
~ProSHADE_run(void)
Destructor for the ProSHADE class.
Definition: ProSHADE.cpp:1765
ProSHADE_settings::setMinimumMaskSize
void setMinimumMaskSize(proshade_single minMS)
Sets the requested minimum mask size.
Definition: ProSHADE.cpp:587
ProSHADE_settings::determineAllSHValues
void determineAllSHValues(proshade_unsign xDim, proshade_unsign yDim, proshade_single xDimAngs, proshade_single yDimAngs, proshade_single zDimAngs)
This function determines all the required values for spherical harmonics computation.
Definition: ProSHADE.cpp:1615
ProSHADE_run::getRotationFunctionVector
std::vector< proshade_double > getRotationFunctionVector(void)
This function returns the full rotation function distances vector from the first to all other structu...
Definition: ProSHADE.cpp:2771
ProSHADE_settings::setAppliedMaskFilename
void setAppliedMaskFilename(std::string mskFln)
Sets the filename of the mask data that should be applied to the input map.
Definition: ProSHADE.cpp:647
ProSHADE_settings::setBicubicInterpolationSearch
void setBicubicInterpolationSearch(bool bicubPeaks)
Sets the bicubic interpolation on peaks.
Definition: ProSHADE.cpp:1385
ProSHADE_settings::setPeakNaiveNoIQR
void setPeakNaiveNoIQR(proshade_double noIQRs)
Sets the number of IQRs from the median for threshold height a peak needs to be considered a peak.
Definition: ProSHADE.cpp:1057
ProSHADE_exception
This class is the representation of ProSHADE exception.
Definition: ProSHADE_exceptions.hpp:37
ProSHADE_settings::setMapInversion
void setMapInversion(bool mInv)
Sets the requested map inversion value in the appropriate variable.
Definition: ProSHADE.cpp:443
ProSHADE_exception::get_errc
virtual std::string get_errc(void)
This function returns the exception error code.
Definition: ProSHADE_exceptions.cpp:29
ProSHADE_settings::setMapResolutionChange
void setMapResolutionChange(bool mrChange)
Sets the requested map resolution change decision in the appropriate variable.
Definition: ProSHADE.cpp:790
ProSHADE_settings::setPeakNeighboursNumber
void setPeakNeighboursNumber(proshade_unsign pkS)
Sets the number of neighbour values that have to be smaller for an index to be considered a peak.
Definition: ProSHADE.cpp:1035
ProSHADE_run::getAllCSyms
std::vector< std::vector< proshade_double > > getAllCSyms(void)
This function returns a all symmetry axes as a vector of vectors of doubles.
Definition: ProSHADE.cpp:2881
ProSHADE_run::getNoSymmetryAxes
proshade_unsign getNoSymmetryAxes(void)
This function returns the number of detected recommended symmetry axes.
Definition: ProSHADE.cpp:2802
ProSHADE_settings::setSphereDistances
void setSphereDistances(proshade_single sphDist)
Sets the requested distance between spheres in the appropriate variable.
Definition: ProSHADE.cpp:890
ProSHADE_settings::setVerbosity
void setVerbosity(proshade_signed verbosity)
Sets the requested verbosity in the appropriate variable.
Definition: ProSHADE.cpp:463
ProSHADE_settings::setMinimumPeakForAxis
void setMinimumPeakForAxis(proshade_double minSP)
Sets the minimum peak height for symmetry axis to be considered.
Definition: ProSHADE.cpp:1209
ProSHADE_settings::requestedResolution
proshade_single requestedResolution
The resolution to which the calculations are to be done.
Definition: ProSHADE_settings.hpp:50
ProSHADE_exception::get_info
virtual std::string get_info(void)
This function returns the exception description.
Definition: ProSHADE_exceptions.cpp:53
ProSHADE_settings::setAxisComparisonThresholdBehaviour
void setAxisComparisonThresholdBehaviour(bool behav)
Sets the automatic symmetry axis tolerance decreasing.
Definition: ProSHADE.cpp:1188
ProSHADE_settings::setDetectedSymmetry
void setDetectedSymmetry(proshade_double *sym)
Sets the final detected symmetry axes information.
Definition: ProSHADE.cpp:1315
ProSHADE_settings::maxSphereDists
proshade_single maxSphereDists
The distance between spheres in spherical mapping for the largest sphere.
Definition: ProSHADE_settings.hpp:65
ProSHADE_run::getEulerAngles
std::vector< proshade_double > getEulerAngles(void)
This function returns the vector of Euler angles with best overlay correlation.
Definition: ProSHADE.cpp:3022
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:1007
ProSHADE_settings::setPDBBFactor
void setPDBBFactor(proshade_double newBF)
Sets the requested B-factor value for PDB files in the appropriate variable.
Definition: ProSHADE.cpp:403
ProSHADE_settings::addStructure
void addStructure(std::string structure)
Adds a structure file name to the appropriate variable.
Definition: ProSHADE.cpp:363
ProSHADE_settings::determineIntegrationOrder
void determineIntegrationOrder(proshade_single maxMapRange)
This function determines the integration order for the between spheres integration.
Definition: ProSHADE.cpp:1571
ProSHADE_settings::setMaskIQR
void setMaskIQR(proshade_single noIQRs)
Sets the requested number of IQRs for masking threshold in the appropriate variable.
Definition: ProSHADE.cpp:504
ProSHADE_settings::setMissingPeakThreshold
void setMissingPeakThreshold(proshade_double mpThres)
Sets the threshold for starting the missing peaks procedure.
Definition: ProSHADE.cpp:1144
ProSHADE_run::getVerbose
proshade_signed getVerbose(void)
This function returns the verbose value.
Definition: ProSHADE.cpp:2792
ProSHADE_settings::setMapCentering
void setMapCentering(bool com)
Sets the requested map centering decision value in the appropriate variable.
Definition: ProSHADE.cpp:830
ProSHADE_settings::setMaskBlurFactor
void setMaskBlurFactor(proshade_single blurFac)
Sets the requested map blurring factor in the appropriate variable.
Definition: ProSHADE.cpp:483
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_settings::setPeakThreshold
void setPeakThreshold(proshade_double peakThr)
Sets the minimum peak height threshold for axis to be considered possible.
Definition: ProSHADE.cpp:1439
ProSHADE_settings::setPhaseUsage
void setPhaseUsage(bool phaseUsage)
Sets whether the phase information will be used.
Definition: ProSHADE.cpp:1079
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:142
ProSHADE_settings::setFSCThreshold
void setFSCThreshold(proshade_double fscThr)
Sets the minimum FSC threshold for axis to be considered detected.
Definition: ProSHADE.cpp:1421
ProSHADE_settings::setBandwidth
void setBandwidth(proshade_unsign band)
Sets the requested spherical harmonics bandwidth in the appropriate variable.
Definition: ProSHADE.cpp:870
ProSHADE_settings::setBoundsSpace
void setBoundsSpace(proshade_single boundsExSp)
Sets the requested number of angstroms for extra space in re-boxing in the appropriate variable.
Definition: ProSHADE.cpp:708
ProSHADE_exception::get_func
virtual std::string get_func(void)
This function returns the exception causing function name.
Definition: ProSHADE_exceptions.cpp:47
ProSHADE_settings::setOutputFilename
void setOutputFilename(std::string oFileName)
Sets the requested output file name in the appropriate variable.
Definition: ProSHADE.cpp:770
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_mapManip::removeWaters
void removeWaters(gemmi::Structure *pdbFile, bool firstModel)
This function removed all waters from PDB input file.
Definition: ProSHADE_mapManip.cpp:504
ProSHADE_internal_spheres::autoDetermineSphereDistances
proshade_single autoDetermineSphereDistances(proshade_single maxMapRange, proshade_single resolution)
This function determines the sphere distances for sphere mapping.
Definition: ProSHADE_spheres.cpp:537
ProSHADE_run::getSymmetryAxis
std::vector< std::string > getSymmetryAxis(proshade_unsign axisNo)
This function returns a single symmetry axis as a vector of strings from the recommended symmetry axe...
Definition: ProSHADE.cpp:2826
ProSHADE_settings::setAxisComparisonThreshold
void setAxisComparisonThreshold(proshade_double axThres)
Sets the threshold for matching symmetry axes.
Definition: ProSHADE.cpp:1165
ProSHADE_internal_tasks::MapManipulationTask
void MapManipulationTask(ProSHADE_settings *settings, std::vector< proshade_signed * > *originalBounds, std::vector< proshade_signed * > *reboxedBounds, std::vector< proshade_double * > *manipulatedMaps)
The re-boxing task driver function.
Definition: ProSHADE_tasks.cpp:35
ProSHADE_settings::setTypicalNoiseSize
void setTypicalNoiseSize(proshade_single typNoi)
Sets the requested "fake" half-map kernel in the appropriate variable.
Definition: ProSHADE.cpp:567
ProSHADE_internal_misc::addToSignedVector
void addToSignedVector(std::vector< proshade_signed > *vecToAddTo, proshade_signed elementToAdd)
Adds the element to the vector.
Definition: ProSHADE_misc.cpp:121
ProSHADE_run
This class provides the access point to the library.
Definition: ProSHADE.hpp:39
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:310
ProSHADE_settings::task
ProSHADE_Task task
This custom type variable determines which task to perfom (i.e. symmetry detection,...
Definition: ProSHADE_settings.hpp:40
ProSHADE_settings::setMaskFilename
void setMaskFilename(std::string mskFln)
Sets where the mask should be saved.
Definition: ProSHADE.cpp:627
ProSHADE_run::getSymmetryFold
proshade_unsign getSymmetryFold(void)
This is the main accessor function for the user to get to know what symmetry fold ProSHADE has detect...
Definition: ProSHADE.cpp:1814
ProSHADE_run::getTranslationToOrigin
std::vector< proshade_double > getTranslationToOrigin(void)
This function returns the negative values of the position of the rotation centre (the point about whi...
Definition: ProSHADE.cpp:3078
getReBoxedMap
void getReBoxedMap(ProSHADE_run *run, proshade_unsign strNo, double *reboxMap, int len)
This function returns the re-boxed structure map 1D array for the processed structure.
Definition: ProSHADE.cpp:2994
ProSHADE_settings::setRequestedFold
void setRequestedFold(proshade_unsign val)
Sets the user requested symmetry fold.
Definition: ProSHADE.cpp:1294
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:37
ProSHADE_settings::determineBandwidthFromAngle
void determineBandwidthFromAngle(proshade_double uncertainty)
This function determines the bandwidth for the spherical harmonics computation from the allowed rotat...
Definition: ProSHADE.cpp:1508
ProSHADE_settings::getCommandLineParams
void getCommandLineParams(int argc, char **argv)
This function parses the command line arguments into the settings object.
Definition: ProSHADE.cpp:1897
ProSHADE_internal_tasks::DistancesComputationTask
void DistancesComputationTask(ProSHADE_settings *settings, std::vector< proshade_double > *enLevs, std::vector< proshade_double > *trSigm, std::vector< proshade_double > *rotFun)
The distances computation task driver function.
Definition: ProSHADE_tasks.cpp:147
ProSHADE_run::getSymmetryType
std::string getSymmetryType(void)
This is the main accessor function for the user to get to know what symmetry type ProSHADE has detect...
Definition: ProSHADE.cpp:1799
ProSHADE_internal_messages::printWellcomeMessage
void printWellcomeMessage(proshade_signed verbose)
Wellcome message printing.
Definition: ProSHADE_messages.cpp:31
ProSHADE.hpp
This is the main header file providing the main access class and its functions.
ProSHADE_run::getEnergyLevelsVector
std::vector< proshade_double > getEnergyLevelsVector(void)
This function returns the energy level distances vector from the first to all other structures.
Definition: ProSHADE.cpp:2743
ProSHADE_internal_messages::printTerminateMessage
void printTerminateMessage(proshade_signed verbose)
Final message printing.
Definition: ProSHADE_messages.cpp:49
ProSHADE_settings::setMapReboxing
void setMapReboxing(bool reBx)
Sets whether re-boxing needs to be done in the appropriate variable.
Definition: ProSHADE.cpp:687
ProSHADE_settings::setRecommendedSymmetry
void setRecommendedSymmetry(std::string val)
Sets the ProSHADE detected symmetry type.
Definition: ProSHADE.cpp:1231
ProSHADE_settings::setMaxSymmetryFold
void setMaxSymmetryFold(proshade_unsign maxFold)
Sets the maximum symmetry fold (well, the maximum prime symmetry fold).
Definition: ProSHADE.cpp:1403
ProSHADE_settings::setNegativeDensity
void setNegativeDensity(bool nDens)
Sets the internal variable deciding whether input files negative density should be removed.
Definition: ProSHADE.cpp:1457
ProSHADE_settings::setTaylorSeriesCap
void setTaylorSeriesCap(proshade_unsign tayCap)
Sets the requested Taylor series cap for the Gauss-Legendre integration in the appropriate variable.
Definition: ProSHADE.cpp:931
ProSHADE_settings::setCorrelationMasking
void setCorrelationMasking(bool corMask)
Sets the requested map masking type in the appropriate variable.
Definition: ProSHADE.cpp:545
ProSHADE_settings::setProgressiveSphereMapping
void setProgressiveSphereMapping(bool progSphMap)
Sets the requested sphere mapping value settings approach in the appropriate variable.
Definition: ProSHADE.cpp:951
ProSHADE_settings::setIntegrationOrder
void setIntegrationOrder(proshade_unsign intOrd)
Sets the requested order for the Gauss-Legendre integration in the appropriate variable.
Definition: ProSHADE.cpp:910
ProSHADE_settings::setRotationFunctionComputation
void setRotationFunctionComputation(bool rotfVal)
Sets whether the rotation function distance descriptor should be computed.
Definition: ProSHADE.cpp:1014
ProSHADE_run::getReBoxedBounds
std::vector< proshade_signed > getReBoxedBounds(proshade_unsign strNo)
This function returns a specific structure re-boxed bounds.
Definition: ProSHADE.cpp:2943
ProSHADE_settings::rotationUncertainty
proshade_double rotationUncertainty
Alternative to bandwidth - the angle in degrees to which the rotation function accuracy should be com...
Definition: ProSHADE_settings.hpp:59
ProSHADE_settings::~ProSHADE_settings
~ProSHADE_settings(void)
Destructor for the ProSHADE_settings class.
Definition: ProSHADE.cpp:322
ProSHADE_settings::setOverlaySaveFile
void setOverlaySaveFile(std::string filename)
Sets the filename to which the overlay structure is to be save into.
Definition: ProSHADE.cpp:1349
ProSHADE_settings::determineBandwidth
void determineBandwidth(proshade_unsign circumference)
This function determines the bandwidth for the spherical harmonics computation.
Definition: ProSHADE.cpp:1476
ProSHADE_internal_spheres::autoDetermineIntegrationOrder
proshade_unsign autoDetermineIntegrationOrder(proshade_single maxMapRange, proshade_single sphereDist)
This function determines the integration order for the between spheres integration.
Definition: ProSHADE_spheres.cpp:561
ProSHADE_run::ProSHADE_run
ProSHADE_run(ProSHADE_settings *settings)
Contructor for the ProSHADE_run class.
Definition: ProSHADE.cpp:1667
ProSHADE_run::getMapValue
proshade_double getMapValue(proshade_unsign strNo, proshade_unsign mapIndex)
This function returns a single, specific structure map value.
Definition: ProSHADE.cpp:2977
ProSHADE_settings::setFourierWeightsFilename
void setFourierWeightsFilename(std::string fWgFln)
Sets the filename of the mask data that should be applied to the input map.
Definition: ProSHADE.cpp:667
ProSHADE_run::getNoRecommendedSymmetryAxes
proshade_unsign getNoRecommendedSymmetryAxes(void)
This function returns the number of detected recommended symmetry axes.
Definition: ProSHADE.cpp:2812
ProSHADE_settings::determineSphereDistances
void determineSphereDistances(proshade_single maxMapRange)
This function determines the sphere distances for sphere mapping.
Definition: ProSHADE.cpp:1539
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:67
ProSHADE_settings::setGroupingSmoothingFactor
void setGroupingSmoothingFactor(proshade_double smFact)
Sets the grouping smoothing factor into the proper variable.
Definition: ProSHADE.cpp:1123
ProSHADE_internal_spheres::autoDetermineBandwidth
proshade_unsign autoDetermineBandwidth(proshade_unsign circumference)
This function determines the bandwidth for the spherical harmonics computation.
Definition: ProSHADE_spheres.cpp:515
ProSHADE_settings::setRequestedSymmetry
void setRequestedSymmetry(std::string val)
Sets the user requested symmetry type.
Definition: ProSHADE.cpp:1274
ProSHADE_settings::setExtraSpace
void setExtraSpace(proshade_single exSpace)
Sets the requested map extra space value in the appropriate variable.
Definition: ProSHADE.cpp:850
ProSHADE_settings::recommendedSymmetryFold
proshade_unsign recommendedSymmetryFold
The fold of the recommended symmetry C or D type, 0 otherwise.
Definition: ProSHADE_settings.hpp:129
ProSHADE_exception::get_line
virtual int long get_line(void)
This function returns the exception location line.
Definition: ProSHADE_exceptions.cpp:41
ProSHADE_settings::inputFiles
std::vector< std::string > inputFiles
This vector contains the filenames of all input structure files.
Definition: ProSHADE_settings.hpp:43
ProSHADE_settings::setMapResolutionChangeTriLinear
void setMapResolutionChangeTriLinear(bool mrChange)
Sets the requested map resolution change decision using tri-linear interpolation in the appropriate v...
Definition: ProSHADE.cpp:810
ProSHADE_settings::setMaskSaving
void setMaskSaving(bool savMsk)
Sets whether the mask should be saved.
Definition: ProSHADE.cpp:607
ProSHADE_exception::get_file
virtual std::string get_file(void)
This function returns the exception location file name.
Definition: ProSHADE_exceptions.cpp:35
ProSHADE_settings::ProSHADE_settings
ProSHADE_settings(void)
Contructor for the ProSHADE_settings class.
Definition: ProSHADE.cpp:37
ProSHADE_settings::setBoundsThreshold
void setBoundsThreshold(proshade_signed boundsThres)
Sets the threshold for number of indices difference acceptable to make index sizes same in the approp...
Definition: ProSHADE.cpp:728
ProSHADE_settings::setMasking
void setMasking(bool mask)
Sets the requested map masking decision value in the appropriate variable.
Definition: ProSHADE.cpp:524
ProSHADE_settings::setRecommendedFold
void setRecommendedFold(proshade_unsign val)
Sets the ProSHADE detected symmetry fold.
Definition: ProSHADE.cpp:1254
ProSHADE_run::getOptimalRotMat
std::vector< proshade_double > getOptimalRotMat(void)
This function returns the vector forming rotation matrix (rows first) with best overlay correlation.
Definition: ProSHADE.cpp:3044
ProSHADE_run::getOriginalBounds
std::vector< proshade_signed > getOriginalBounds(proshade_unsign strNo)
This function returns a specific structure original bounds.
Definition: ProSHADE.cpp:2911
ProSHADE_settings::setVariablesLeftOnAuto
void setVariablesLeftOnAuto(void)
Function to determine general values that the user left on auto-determination.
Definition: ProSHADE.cpp:337
ProSHADE_run::getTraceSigmaVector
std::vector< proshade_double > getTraceSigmaVector(void)
This function returns the trace sigma distances vector from the first to all other structures.
Definition: ProSHADE.cpp:2757
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_messages::printHelp
void printHelp(void)
This function prints the help screen in the case -h is called, or if command line arguments cannot be...
Definition: ProSHADE_messages.cpp:118
ProSHADE_settings::setResolution
void setResolution(proshade_single resolution)
Sets the requested resolution in the appropriate variable.
Definition: ProSHADE.cpp:383
ProSHADE_settings::printSettings
void printSettings(void)
This function prints the current values in the settings object.
Definition: ProSHADE.cpp:2469
ProSHADE_run::getNoStructures
proshade_unsign getNoStructures(void)
This function returns the number of structures used.
Definition: ProSHADE.cpp:2782
ProSHADE_run::getMapCOMProcessChange
std::vector< proshade_double > getMapCOMProcessChange(void)
This function returns the internal map COM shift.
Definition: ProSHADE.cpp:2896
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_tasks::SymmetryDetectionTask
void SymmetryDetectionTask(ProSHADE_settings *settings, std::vector< proshade_double * > *axes, std::vector< std::vector< proshade_double > > *allCs, std::vector< proshade_double > *mapCOMShift)
The symmetry detection task driver function.
Definition: ProSHADE_tasks.cpp:287
ProSHADE_run::getOriginToOverlayTranslation
std::vector< proshade_double > getOriginToOverlayTranslation(void)
This function returns the translation required to move the structure from origin to optimal overlay.
Definition: ProSHADE.cpp:3106
ProSHADE_settings::setNormalisation
void setNormalisation(bool normalise)
Sets the requested map normalisation value in the appropriate variable.
Definition: ProSHADE.cpp:423
ProSHADE_settings::setEnergyLevelsComputation
void setEnergyLevelsComputation(bool enLevDesc)
Sets whether the energy level distance descriptor should be computed.
Definition: ProSHADE.cpp:972