Xmipp  v3.23.11-Nereus
Public Member Functions | List of all members
UnitCell Class Reference

#include <unitCell.h>

Public Member Functions

void maskUnitCell (ImageGeneric &in3DDmap, ImageGeneric &out3DDmap)
 
 UnitCell (String sym, double rmin, double rmax, double expanded, double offset, double sampling, double x_origin, double y_origin, double z_origin)
 
void doCyclic (int order=1)
 
void doDihedral (int order=1)
 
void doTetrahedral (int symmetry=pg_T)
 
void doOctahedral (int symmetry=pg_O)
 
void doIcosahedral (int symmetry=pg_I1)
 

Detailed Description

Definition at line 21 of file unitCell.h.

Constructor & Destructor Documentation

◆ UnitCell()

UnitCell::UnitCell ( String  sym,
double  rmin,
double  rmax,
double  expanded,
double  offset,
double  sampling,
double  x_origin,
double  y_origin,
double  z_origin 
)

close debug file unit auxiliary vectors

Definition at line 88 of file unitCell.cpp.

89  {
90  // list of numbers smaller than 10000 which have prime decomposition
91  // that does not contain prime number greater than 19
92  // This is the greatest prime number that can handle ccp4 fft routine
93 
94  this->rmin = rmin; //delete voxels closer to the center than this radius
95  this->rmax = rmax; //delete voxels more far away to the center than this radius
96  this->offset = offset; //rotate unit cell this degrees
97  this->expanded = expanded; //coefficient of expansion
98  this->sampling = sampling; // Angstrom/pixels relation
99  this->x_origin = x_origin; // origin x coordinate introduced with the input volume (in pixels)
100  this->y_origin = y_origin; // origin y coordinate introduced with the input volume (in pixels)
101  this->z_origin = z_origin; // origin z coordinate introduced with the input volume (in pixels)
102  this->newOriginAfterExpansion = vectorR3(0., 0., 0.);
103  SL.isSymmetryGroup(sym, symmetry, sym_order); //parse symmetry string
104  std::cerr << "symmetry: " << symmetry << std::endl;
105  if (symmetry == pg_CN && sym_order != 1)
106  doCyclic(sym_order);
107  else if (symmetry == pg_DN)
108  doDihedral(sym_order);
109  else if (symmetry == pg_T)
110  doTetrahedral();
111  else if (symmetry == pg_O)
112  doOctahedral();
113  else if (symmetry >= pg_I1 && symmetry <= pg_I4)
114  doIcosahedral(symmetry);
115 
116 #ifdef DEBUG
117  {
118  std::ofstream testFile;
119  testFile.open("planeVectors_in_expandedUnitCell.bild");
120 
121  testFile << ".color blue\n";
123  Matrix1D<double> tt;
124  for (int i = 0; i < expandedUnitCell.size(); i++) {
125  if (symmetry == pg_CN || symmetry == pg_T || symmetry == pg_O) {
126  if (i == 0)
127  continue;
128  planeVectors[i - 1].selfNormalize();
129  t = expandedUnitCell[i];
130  tt = expandedUnitCell[i] + (planeVectors[i - 1] * 10.);
131  } else if (symmetry == pg_DN) {
132  if (i == 0) {
133  t = expandedUnitCell[i];
134  planeVectors[expandedUnitCell.size() - 1].selfNormalize();
135  tt = expandedUnitCell[i]
136  + (planeVectors[expandedUnitCell.size() - 1] * 10.);
137  } else if (i != 0) {
138  t = expandedUnitCell[i];
139  planeVectors[i - 1].selfNormalize();
140  tt = expandedUnitCell[i] + (planeVectors[i - 1] * 10.);
141  }
142  } else if (symmetry >= pg_I1 || symmetry <= pg_I4) {
143  t = expandedUnitCell[i] * 74;
144  planeVectors[i].selfNormalize();
145  tt = (expandedUnitCell[i] + (planeVectors[i] * 0.1)) * 74;
146  }
147  t *= scale;
148  tt *= scale;
149  testFile << ".arrow " << t(0) << " " << t(1) << " " << t(2) << " "
150  << tt(0) << " " << tt(1) << " " << tt(2) << " "
151  << .011 * scale * 10 << "\n";
152  }
153  testFile.close();
154  }
155 #endif
156 
157 }
#define pg_DN
Definition: symmetries.h:80
void doOctahedral(int symmetry=pg_O)
Definition: unitCell.cpp:49
#define pg_T
Definition: symmetries.h:83
#define pg_O
Definition: symmetries.h:86
Matrix1D< double > vectorR3(double x, double y, double z)
Definition: matrix1d.cpp:892
bool isSymmetryGroup(FileName fn_sym, int &pgGroup, int &pgOrder)
Definition: symmetries.cpp:601
void doTetrahedral(int symmetry=pg_T)
Definition: unitCell.cpp:37
void doCyclic(int order=1)
Definition: unitCell.cpp:13
#define i
#define pg_I4
Definition: symmetries.h:94
#define pg_I1
Definition: symmetries.h:91
void doIcosahedral(int symmetry=pg_I1)
Definition: unitCell.cpp:61
void doDihedral(int order=1)
Definition: unitCell.cpp:25
#define pg_CN
Definition: symmetries.h:76

Member Function Documentation

◆ doCyclic()

void UnitCell::doCyclic ( int  order = 1)

process CN symmetry

Definition at line 13 of file unitCell.cpp.

13  { //check offset is in radians
14  Matrix1D<double> sym_centre, sym_2f, sym_2fp;
15  sym_centre = vectorR3(0., 0., 0.);
16  sym_2f = vectorR3(cos(offset), sin(offset), 0.) * rmax;
17  sym_2fp = vectorR3(cos(TWOPI / order + offset), sin(TWOPI / order + offset),
18  0.) * rmax;
19  _minZ = -rmax;
20  _maxZ = +rmax;
21 
22  cyclicSymmetry(sym_centre, sym_2f, sym_2fp, order, expanded, offset);
23 }
Matrix1D< double > vectorR3(double x, double y, double z)
Definition: matrix1d.cpp:892
#define TWOPI
Definition: xmipp_macros.h:111

◆ doDihedral()

void UnitCell::doDihedral ( int  order = 1)

process DN symmetry

Definition at line 25 of file unitCell.cpp.

25  {
26  Matrix1D<double> sym_centre, sym_2f, sym_2fp;
27  sym_centre = vectorR3(0., 0., 0.);
28  sym_2f = vectorR3(cos(offset), sin(offset), 0.) * rmax;
29  sym_2fp = vectorR3(cos(TWOPI / order + offset), sin(TWOPI / order + offset),
30  0.) * rmax;
31  _minZ = -rmax;
32  _maxZ = +rmax;
33 
34  dihedralSymmetry(sym_centre, sym_2f, sym_2fp, order, expanded, offset);
35 }
Matrix1D< double > vectorR3(double x, double y, double z)
Definition: matrix1d.cpp:892
#define TWOPI
Definition: xmipp_macros.h:111

◆ doIcosahedral()

void UnitCell::doIcosahedral ( int  symmetry = pg_I1)

process IN symmetry

Definition at line 61 of file unitCell.cpp.

61  {
62  Matrix1D<double> sym_centre, sym_5f, sym_5fp, sym_5fpp;
63  sym_centre = vectorR3(0., 0., 0.);
64  if (symmetry == pg_I1) {
65  sym_5f = vectorR3(0., -0.52573111, 0.85065081);
66  sym_5fp = vectorR3(0., 0.52573111, 0.85065081);
67  sym_5fpp = vectorR3(-8.50650808e-01, -5.55111512e-17, 5.25731112e-01);
68  } else if (symmetry == pg_I2) {
69  sym_5f = vectorR3(-0.52573111, 0., 0.85065081);
70  sym_5fp = vectorR3(0.52573111, 0., 0.85065081);
71  sym_5fpp = vectorR3(-5.55111512e-17, 8.50650808e-01, 5.25731112e-01);
72  } else if (symmetry == pg_I3) {
73  sym_5f = vectorR3(0., 0., -1.);
74  sym_5fp = vectorR3(0.89442719, 0., -0.4472136);
75  sym_5fpp = vectorR3(0.2763932, -0.85065081, -0.4472136);
76  } else if (symmetry == pg_I4) {
77  sym_5f = vectorR3(0., 0., 1.);
78  sym_5fp = vectorR3(0.89442719, 0., 0.4472136);
79  sym_5fpp = vectorR3(0.2763932, 0.85065081, 0.4472136);
80  } else
81  REPORT_ERROR(ERR_ARG_INCORRECT, "Symmetry not implemented");
82  _minZ = rmax;
83  _maxZ = rmin;
84 
85  icoSymmetry(sym_centre, sym_5f, sym_5fp, sym_5fpp, expanded);
86 }
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
#define pg_I3
Definition: symmetries.h:93
Matrix1D< double > vectorR3(double x, double y, double z)
Definition: matrix1d.cpp:892
#define pg_I4
Definition: symmetries.h:94
Incorrect argument received.
Definition: xmipp_error.h:113
#define pg_I1
Definition: symmetries.h:91
#define pg_I2
Definition: symmetries.h:92

◆ doOctahedral()

void UnitCell::doOctahedral ( int  symmetry = pg_O)

process O symmetry

Definition at line 49 of file unitCell.cpp.

49  {
50  Matrix1D<double> sym_centre, sym_4f, sym_4fp, sym_4fpp;
51  sym_centre = vectorR3(0., 0., 0.);
52  sym_4f = vectorR3(1., 0., 0.) * rmax;
53  sym_4fp = vectorR3(0., 1., 0.) * rmax;
54  sym_4fpp = vectorR3(0., 0., 1.) * rmax;
55  _minZ = -rmax;
56  _maxZ = +rmax;
57 
58  octahedralSymmetry(sym_centre, sym_4f, sym_4fp, sym_4fpp, expanded);
59 }
Matrix1D< double > vectorR3(double x, double y, double z)
Definition: matrix1d.cpp:892

◆ doTetrahedral()

void UnitCell::doTetrahedral ( int  symmetry = pg_T)

process T symmetry

Definition at line 37 of file unitCell.cpp.

37  {
38  Matrix1D<double> sym_centroid,sym_3f, sym_3fp, sym_3fpp;
39  sym_centroid = vectorR3(0., 0., 0.);
40  sym_3f = vectorR3(0., 0., 1.) * rmax;
41  sym_3fp = vectorR3(0., 0.94281, -0.33333) * rmax;
42  sym_3fpp = vectorR3(0.81650, -0.47140, -0.33333) * rmax;
43  _minZ = -rmax;
44  _maxZ = +rmax;
45 
46  tetrahedralSymmetry(sym_centroid, sym_3f, sym_3fp, sym_3fpp, expanded);
47 }
Matrix1D< double > vectorR3(double x, double y, double z)
Definition: matrix1d.cpp:892

◆ maskUnitCell()

void UnitCell::maskUnitCell ( ImageGeneric in3DDmap,
ImageGeneric out3DDmap 
)

set to zero everything that is not the unit cell

Definition at line 568 of file unitCell.cpp.

568  {
569  //1) get dimensions
570  size_t xDim, yDim, zDim;
571  in3Dmap.getDimensions(xDim, yDim, zDim);
572  double x_offset = x_origin - xDim/2.; //difference between default and user introduced x_origin coordinate
573  double y_offset = y_origin - yDim/2.; //difference between default and user introduced y_origin coordinate
574  double z_offset = z_origin - zDim/2.; //difference between default and user introduced z_origin coordinate
575 
576  if (rmax == 0)
577  rmax = (double) xDim / 2.;
578 
579 #ifdef DEBUG1
580  {
581  std::ofstream testFile;
582  testFile.open("ico2.bild");
583 
585  double th = 1.;
586  testFile << ".scale 1\n.color blue\n";
587  Matrix1D<double> tt;
588  for (int i = 0; i < 4; i++) {
589  t = expandedUnitCell[i] * scale;
590  tt = expandedUnitCell[i] * scale + planeVectors[i] * scale;
591  testFile << ".v " << t(0) << " " << t(1) << " " << t(2) << " "
592  << tt(0) << " " << tt(1) << " " << tt(2) << " 1\n";
593  }
594  testFile.close();
595  }
596 #endif
597 
598  //2) get expanded unitcell enclosing box
599  {
600  double minX = rmin;
601  double minY = rmin;
602  double minZ = rmin;
603  double maxX = rmax;
604  double maxY = rmax;
605  double maxZ = rmax;
606 
607  if (sym_order != 1) {
608  minX = rmax;
609  minY = rmax;
610  minZ = _minZ;
611  maxX = rmin;
612  if (symmetry == pg_CN || symmetry == pg_DN) {
613  maxY = rmax;
614  if (sym_order == 2){
615  minX = - rmax;
616  minY = - rmax;
617  minZ = - rmax;
618  maxX = rmax;
619  maxY = rmax;
620  }
621  } else if (symmetry != pg_CN && symmetry != pg_DN) {
622  maxY = rmin;
623  }
624  maxZ = _maxZ;
625  Matrix1D<double> minVector, maxVector;
626  for (std::vector<Matrix1D<double> >::iterator it =
627  expandedUnitCell.begin(); it != expandedUnitCell.end();
628  ++it) {
629  if (symmetry == pg_CN || symmetry == pg_DN || symmetry == pg_T
630  || symmetry == pg_O) {
631  minVector = (*it);
632  maxVector = (*it);
633  } else if (symmetry >= pg_I1 || symmetry <= pg_I4) {
634  (*it).selfNormalize();
635  minVector = (*it) * rmin;
636  maxVector = (*it) * std::min(rmax, (double) xDim / 2.);
637  }
638 
639  expandedUnitCellMin.push_back(minVector);
640  expandedUnitCellMax.push_back(maxVector);
641 
642  minX = std::min(minX, minVector(0));
643  minX = std::min(minX, maxVector(0));
644 
645  minY = std::min(minY, minVector(1));
646  minY = std::min(minY, maxVector(1));
647 
648  minZ = std::min(minZ, minVector(2));
649  minZ = std::min(minZ, maxVector(2));
650 
651  maxX = std::max(maxX, minVector(0));
652  maxX = std::max(maxX, maxVector(0));
653 
654  maxY = std::max(maxY, minVector(1));
655  maxY = std::max(maxY, maxVector(1));
656 
657  maxZ = std::max(maxZ, minVector(2));
658  maxZ = std::max(maxZ, maxVector(2));
659  }
660 
661  }
662 
663  else if(sym_order == 1 && symmetry == pg_CN) {
664 
665  minX = - rmax;
666  minY = - rmax;
667  minZ = - rmax;
668  maxX = rmax;
669  maxY = rmax;
670  maxZ = rmax;
671  }
672  std::cout << "minX " << minX << std::endl;
673  std::cout << "minY " << minY << std::endl;
674  std::cout << "minZ " << minZ << std::endl;
675  std::cout << "maxX " << maxX << std::endl;
676  std::cout << "maxY " << maxY << std::endl;
677  std::cout << "maxZ " << maxZ << std::endl;
678 #ifdef DEBUG
679  //draw real unitcell
680  {
681 #include <iostream>
682 #include <fstream>
683  //Debug chimera file
684  std::ofstream testFile;
685 
686  //draw box
687  testFile.open("box.bild");
688  Matrix1D<double> t, tt;
689  t = vectorR3(minX, minY, minZ);
690  tt = vectorR3(maxX, maxY, maxZ);
691 
692  testFile << ".color red\n";
693  testFile << ".box " << t(0) << " " << t(1) << " " << t(2) << " "
694  << tt(0) << " " << tt(1) << " " << tt(2) << "\n";
695  testFile.close();
696  }
697 #endif
698 
699  MultidimArray<float> * map;
700  MultidimArray<float> * imageMap2;
701  in3Dmap().getMultidimArrayPointer(map);
702  out3DDmap.setDatatype(DT_Float);
703  out3DDmap.resize(xDim, yDim, zDim, 1);
704  out3DDmap().getMultidimArrayPointer(imageMap2);
705  imageMap2->setXmippOrigin();
706  int r2;
707  int rmin2 = rmin * rmin;
708  int rmax2 = rmax * rmax;
709  int iMinZ, iMinY, iMinX, iMaxZ, iMaxY, iMaxX;
710  iMinZ = (int) ceil(minZ);
711  iMaxZ = (int) floor(maxZ);
712  iMinY = (int) ceil(minY);
713  iMaxY = (int) floor(maxY);
714  iMinX = (int) ceil(minX);
715  iMaxX = (int) floor(maxX);
716 
717  //check that the output 3Dmap has a valid size
718 
719  const size_t N = 1168;
720  int a[N] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
721  17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 30, 32, 33, 34,
722  35, 36, 38, 39, 40, 42, 44, 45, 48, 49, 50, 51, 52, 54, 55,
723  56, 57, 60, 63, 64, 65, 66, 68, 70, 72, 75, 76, 77, 78, 80,
724  81, 84, 85, 88, 90, 91, 95, 96, 98, 99, 100, 102, 104, 105,
725  108, 110, 112, 114, 117, 119, 120, 121, 125, 126, 128, 130,
726  132, 133, 135, 136, 140, 143, 144, 147, 150, 152, 153, 154,
727  156, 160, 162, 165, 168, 169, 170, 171, 175, 176, 180, 182,
728  187, 189, 190, 192, 195, 196, 198, 200, 204, 208, 209, 210,
729  216, 220, 221, 224, 225, 228, 231, 234, 238, 240, 242, 243,
730  245, 247, 250, 252, 255, 256, 260, 264, 266, 270, 272, 273,
731  275, 280, 285, 286, 288, 289, 294, 297, 300, 304, 306, 308,
732  312, 315, 320, 323, 324, 325, 330, 336, 338, 340, 342, 343,
733  350, 351, 352, 357, 360, 361, 363, 364, 374, 375, 378, 380,
734  384, 385, 390, 392, 396, 399, 400, 405, 408, 416, 418, 420,
735  425, 429, 432, 440, 441, 442, 448, 450, 455, 456, 459, 462,
736  468, 475, 476, 480, 484, 486, 490, 494, 495, 500, 504, 507,
737  510, 512, 513, 520, 525, 528, 532, 539, 540, 544, 546, 550,
738  560, 561, 567, 570, 572, 576, 578, 585, 588, 594, 595, 600,
739  605, 608, 612, 616, 624, 625, 627, 630, 637, 640, 646, 648,
740  650, 660, 663, 665, 672, 675, 676, 680, 684, 686, 693, 700,
741  702, 704, 714, 715, 720, 722, 726, 728, 729, 735, 741, 748,
742  750, 756, 760, 765, 768, 770, 780, 784, 792, 798, 800, 810,
743  816, 819, 825, 832, 833, 836, 840, 845, 847, 850, 855, 858,
744  864, 867, 875, 880, 882, 884, 891, 896, 900, 910, 912, 918,
745  924, 931, 935, 936, 945, 950, 952, 960, 968, 969, 972, 975,
746  980, 988, 990, 1000, 1001, 1008, 1014, 1020, 1024, 1026,
747  1029, 1040, 1045, 1050, 1053, 1056, 1064, 1071, 1078, 1080,
748  1083, 1088, 1089, 1092, 1100, 1105, 1120, 1122, 1125, 1134,
749  1140, 1144, 1152, 1155, 1156, 1170, 1176, 1183, 1188, 1190,
750  1197, 1200, 1210, 1215, 1216, 1224, 1225, 1232, 1235, 1248,
751  1250, 1254, 1260, 1274, 1275, 1280, 1287, 1292, 1296, 1300,
752  1309, 1320, 1323, 1326, 1330, 1331, 1344, 1350, 1352, 1360,
753  1365, 1368, 1372, 1375, 1377, 1386, 1400, 1404, 1408, 1425,
754  1428, 1430, 1440, 1444, 1445, 1452, 1456, 1458, 1463, 1470,
755  1482, 1485, 1496, 1500, 1512, 1520, 1521, 1530, 1536, 1539,
756  1540, 1547, 1560, 1568, 1573, 1575, 1584, 1596, 1600, 1615,
757  1617, 1620, 1625, 1632, 1638, 1650, 1664, 1666, 1672, 1680,
758  1683, 1690, 1694, 1700, 1701, 1710, 1715, 1716, 1728, 1729,
759  1734, 1750, 1755, 1760, 1764, 1768, 1782, 1785, 1792, 1800,
760  1805, 1815, 1820, 1824, 1836, 1848, 1859, 1862, 1870, 1872,
761  1875, 1881, 1890, 1900, 1904, 1911, 1920, 1925, 1936, 1938,
762  1944, 1950, 1960, 1976, 1980, 1989, 1995, 2000, 2002, 2016,
763  2023, 2025, 2028, 2040, 2048, 2052, 2057, 2058, 2079, 2080,
764  2090, 2100, 2106, 2112, 2125, 2128, 2142, 2145, 2156, 2160,
765  2166, 2176, 2178, 2184, 2187, 2197, 2200, 2205, 2210, 2223,
766  2240, 2244, 2250, 2261, 2268, 2275, 2280, 2288, 2295, 2299,
767  2304, 2310, 2312, 2340, 2352, 2366, 2375, 2376, 2380, 2394,
768  2400, 2401, 2420, 2430, 2431, 2432, 2448, 2450, 2457, 2464,
769  2470, 2475, 2496, 2499, 2500, 2508, 2520, 2527, 2535, 2541,
770  2548, 2550, 2560, 2565, 2574, 2584, 2592, 2600, 2601, 2618,
771  2625, 2640, 2646, 2652, 2660, 2662, 2673, 2688, 2695, 2700,
772  2704, 2717, 2720, 2730, 2736, 2744, 2750, 2754, 2772, 2793,
773  2800, 2805, 2808, 2816, 2835, 2850, 2856, 2860, 2873, 2880,
774  2888, 2890, 2904, 2907, 2912, 2916, 2925, 2926, 2940, 2964,
775  2970, 2975, 2992, 3000, 3003, 3024, 3025, 3040, 3042, 3060,
776  3072, 3078, 3080, 3087, 3094, 3120, 3125, 3135, 3136, 3146,
777  3150, 3159, 3168, 3179, 3185, 3192, 3200, 3211, 3213, 3230,
778  3234, 3240, 3249, 3250, 3264, 3267, 3276, 3300, 3315, 3325,
779  3328, 3332, 3344, 3360, 3366, 3375, 3380, 3388, 3400, 3402,
780  3420, 3430, 3432, 3456, 3458, 3465, 3468, 3500, 3510, 3520,
781  3528, 3536, 3549, 3553, 3564, 3570, 3575, 3584, 3591, 3600,
782  3610, 3630, 3640, 3645, 3648, 3672, 3675, 3696, 3705, 3718,
783  3724, 3740, 3744, 3750, 3757, 3762, 3773, 3780, 3800, 3808,
784  3822, 3825, 3840, 3850, 3861, 3872, 3876, 3888, 3900, 3920,
785  3927, 3952, 3960, 3969, 3971, 3978, 3990, 3993, 4000, 4004,
786  4032, 4046, 4050, 4056, 4080, 4095, 4096, 4104, 4114, 4116,
787  4125, 4131, 4158, 4160, 4165, 4180, 4199, 4200, 4212, 4224,
788  4225, 4235, 4250, 4256, 4275, 4284, 4290, 4312, 4320, 4332,
789  4335, 4352, 4356, 4368, 4374, 4375, 4389, 4394, 4400, 4410,
790  4420, 4446, 4455, 4459, 4480, 4488, 4500, 4522, 4536, 4550,
791  4560, 4563, 4576, 4590, 4598, 4608, 4617, 4620, 4624, 4641,
792  4655, 4675, 4680, 4693, 4704, 4719, 4725, 4732, 4750, 4752,
793  4760, 4788, 4800, 4802, 4840, 4845, 4851, 4860, 4862, 4864,
794  4875, 4896, 4900, 4913, 4914, 4928, 4940, 4950, 4992, 4998,
795  5000, 5005, 5016, 5040, 5049, 5054, 5070, 5082, 5096, 5100,
796  5103, 5120, 5130, 5145, 5148, 5168, 5184, 5187, 5200, 5202,
797  5225, 5236, 5250, 5265, 5280, 5292, 5304, 5320, 5324, 5346,
798  5355, 5376, 5390, 5400, 5408, 5415, 5434, 5440, 5445, 5460,
799  5472, 5488, 5491, 5500, 5508, 5525, 5544, 5577, 5586, 5600,
800  5610, 5616, 5625, 5632, 5643, 5670, 5700, 5712, 5720, 5733,
801  5746, 5760, 5775, 5776, 5780, 5808, 5814, 5824, 5831, 5832,
802  5850, 5852, 5880, 5915, 5928, 5929, 5940, 5950, 5967, 5984,
803  5985, 6000, 6006, 6048, 6050, 6069, 6075, 6080, 6084, 6120,
804  6125, 6137, 6144, 6156, 6160, 6171, 6174, 6175, 6188, 6237,
805  6240, 6250, 6270, 6272, 6292, 6300, 6318, 6336, 6358, 6370,
806  6375, 6384, 6400, 6422, 6426, 6435, 6460, 6468, 6480, 6498,
807  6500, 6517, 6528, 6534, 6545, 6552, 6561, 6591, 6600, 6615,
808  6630, 6650, 6655, 6656, 6664, 6669, 6688, 6720, 6732, 6750,
809  6760, 6776, 6783, 6800, 6804, 6825, 6840, 6859, 6860, 6864,
810  6875, 6885, 6897, 6912, 6916, 6930, 6936, 7000, 7007, 7020,
811  7040, 7056, 7072, 7098, 7106, 7125, 7128, 7140, 7150, 7168,
812  7182, 7200, 7203, 7220, 7225, 7260, 7280, 7290, 7293, 7296,
813  7315, 7344, 7350, 7371, 7392, 7410, 7425, 7436, 7448, 7480,
814  7488, 7497, 7500, 7514, 7524, 7546, 7560, 7581, 7600, 7605,
815  7616, 7623, 7644, 7650, 7680, 7695, 7700, 7722, 7735, 7744,
816  7752, 7776, 7800, 7803, 7840, 7854, 7865, 7875, 7904, 7920,
817  7938, 7942, 7956, 7980, 7986, 8000, 8008, 8019, 8064, 8075,
818  8085, 8092, 8100, 8112, 8125, 8151, 8160, 8190, 8192, 8208,
819  8228, 8232, 8250, 8262, 8281, 8316, 8320, 8330, 8360, 8379,
820  8398, 8400, 8415, 8424, 8448, 8450, 8470, 8500, 8505, 8512,
821  8550, 8568, 8575, 8580, 8619, 8624, 8640, 8645, 8664, 8670,
822  8704, 8712, 8721, 8736, 8748, 8750, 8775, 8778, 8788, 8800,
823  8820, 8840, 8892, 8910, 8918, 8925, 8960, 8976, 9000, 9009,
824  9025, 9044, 9072, 9075, 9100, 9120, 9126, 9152, 9163, 9180,
825  9196, 9216, 9234, 9240, 9248, 9261, 9282, 9295, 9310, 9317,
826  9350, 9360, 9375, 9386, 9405, 9408, 9438, 9450, 9464, 9477,
827  9500, 9504, 9520, 9537, 9555, 9576, 9600, 9604, 9625, 9633,
828  9639, 9680, 9690, 9702, 9720, 9724, 9728, 9747, 9750, 9792,
829  9800, 9801, 9826, 9828, 9856, 9880, 9900, 9945, 9975, 9984,
830  9996 };
831 
832  std::vector<int> validSizes(a, a + sizeof(a) / sizeof(int));
833  std::vector<int>::iterator low; // iterator to search in validSizes
834  low = std::lower_bound(validSizes.begin(), validSizes.end(), iMaxX);
835  if (validSizes[low - validSizes.begin()] != iMaxX)
836  iMaxX = validSizes[low - validSizes.begin()];
837  low = std::lower_bound(validSizes.begin(), validSizes.end(), iMaxY);
838  if (validSizes[low - validSizes.begin()] != iMaxY)
839  iMaxY = validSizes[low - validSizes.begin()];
840  low = std::lower_bound(validSizes.begin(), validSizes.end(), iMaxZ);
841  if (validSizes[low - validSizes.begin()] != iMaxZ)
842  iMaxZ = validSizes[low - validSizes.begin()];
843 
844  double dotproduct;
845  bool doIt = false;
846 
847  //for all points in the enclosing box
848  //check if they are inside the expanded unit cell
849  for (int k = iMinZ; k <= iMaxZ; ++k)
850  for (int i = iMinY; i <= iMaxY; ++i)
851  for (int j = iMinX; j <= iMaxX; ++j) {
852  r2 = (i * i + j * j + k * k);
853  if (r2 >= rmin2 && r2 < rmax2) {
854  doIt = true;
855  if (sym_order != 1) {
856  for (std::vector<Matrix1D<double> >::iterator it1 =
857  planeVectors.begin();
858  it1 != planeVectors.end(); ++it1) {
859 
860  dotproduct =
861  dotProduct(*it1,
862  vectorR3(
863  ((double) j)
864  - newOriginAfterExpansion(
865  0),
866  ((double) i)
867  - newOriginAfterExpansion(
868  1),
869  ((double) k)
870  - newOriginAfterExpansion(
871  2)));
872 
873  if (dotproduct < 0) {
874  doIt = false;
875  break;
876  }
877  }
878  }
879 
880  if (doIt) {
881  if (x_offset == 0.0 && y_offset == 0.0 && z_offset == 0.0){
882  A3D_ELEM(*imageMap2,k,i,j) = A3D_ELEM(*map, k, i, j);
883  }else {
884  int k1 = k + z_offset;
885  int i1 = i + y_offset;
886  int j1 = j + x_offset;
887  A3D_ELEM(*imageMap2,k1,i1,j1) = A3D_ELEM(*map, k1, i1, j1);
888  }
889  }
890  }
891  }
892  if (x_offset != 0.0 || y_offset != 0.0 || z_offset != 0.0){
893  iMinZ = iMinZ + z_offset;
894  iMinY = iMinY + y_offset;
895  iMinX = iMinX + x_offset;
896  iMaxZ = iMaxZ + z_offset;
897  iMaxY = iMaxY + y_offset;
898  iMaxX = iMaxX + x_offset;
899  }
900  imageMap2->selfWindow(iMinZ, iMinY, iMinX, iMaxZ, iMaxY, iMaxX, 0.);
901  MDRowSql MD;
902  out3DDmap.setDataMode(_DATA_ALL);
903  //CCP save routine multiplies by sampling rate
904  MD.setValue(MDL_ORIGIN_X, (double) (iMinX - x_offset) );
905  MD.setValue(MDL_ORIGIN_Y, (double) (iMinY - y_offset) );
906  MD.setValue(MDL_ORIGIN_Z, (double) (iMinZ - z_offset) );
907 
908  out3DDmap.image->MDMainHeader.setValue(MDL_SAMPLINGRATE_X, sampling);
909 
910  out3DDmap.image->MDMainHeader.setValue(MDL_SAMPLINGRATE_Y, sampling);
911 
912  out3DDmap.image->MDMainHeader.setValue(MDL_SAMPLINGRATE_Z, sampling);
913 
914  out3DDmap.image->setGeo(MD, 0);
915  }
916 }
void setDataMode(DataMode mode)
void selfWindow(int n0, int z0, int y0, int x0, int nF, int zF, int yF, int xF, T init_value=0)
void min(Image< double > &op1, const Image< double > &op2)
void resize(int Xdim, int Ydim, int Zdim, size_t Ndim, bool copy=true)
#define pg_DN
Definition: symmetries.h:80
#define yDim
Definition: projection.cpp:42
sampling rate in A/pixel (double)
#define pg_T
Definition: symmetries.h:83
sampling rate in A/pixel (double)
__host__ __device__ float2 floor(const float2 v)
#define pg_O
Definition: symmetries.h:86
sampling rate in A/pixel (double)
#define xDim
Definition: projection.cpp:41
void setValue(const MDObject &object) override
Matrix1D< double > vectorR3(double x, double y, double z)
Definition: matrix1d.cpp:892
void selfNormalize()
Definition: matrix1d.cpp:723
auxiliary label to be used as an index (long)
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
#define A3D_ELEM(V, k, i, j)
#define pg_I4
Definition: symmetries.h:94
Origin for the image in the Y axis (double)
void setValue(const MDObject &object) override
#define pg_I1
Definition: symmetries.h:91
void max(Image< double > &op1, const Image< double > &op2)
ImageBase * image
#define j
MDRowVec MDMainHeader
#define pg_CN
Definition: symmetries.h:76
void setDatatype(DataType _datatype)
T dotProduct(const Matrix1D< T > &v1, const Matrix1D< T > &v2)
Definition: matrix1d.h:1140
Origin for the image in the Z axis (double)
float r2
doublereal * a
void setGeo(const MDRow &row, size_t n=0)

The documentation for this class was generated from the following files: