38 std::string line =
" [--crystal ] : Crystal mode activation";
42 if (
nullptr != comment)
43 line = line +
" : " + comment;
46 program->
addParamsLine(
" [--mag_a <mag>] : Magnitude of the first lattice vector");
47 program->
addParamsLine(
" [--mag_b <mag>] : Magnitude of the second lattice vector");
48 program->
addParamsLine(
" [--ang_a2b_deg <angle>] : Angle from vector a to vector b");
49 program->
addParamsLine(
" [--ang_x2a_deg <angle=0>] : Angle from vector x to vector a");
50 program->
addParamsLine(
" [--fill_space] : Repeat unit cell all over the space (pixels)");
91 o <<
"Crystal information ------------------------------------------" << std::endl;
92 o <<
"Lattice vector a: " <<
a.
transpose() << std::endl;
93 o <<
"Lattice vector b: " <<
b.
transpose() << std::endl;
94 o <<
"mag_a: " <<
a_mag << std::endl;
95 o <<
"mag_b: " <<
b_mag << std::endl;
98 o <<
"Fill space: " <<
fill_space << std::endl;
99 o <<
"Symmetry group: " <<
space_group << std::endl;
109 #define SGN0_VEC_PRODUCT(cir,a) SGN0(XX(cir)*YY(a)-YY(cir)*XX(a)) 202 std::cout <<
"(x,y)=(" <<
XX(r) <<
"," <<
YY(r) <<
") " << sgn[0] << sgn[1]
203 << sgn[2] << sgn[3] << std::endl;
207 int inside_table[4][4] = {
218 #define INSIDE_ACCORDING_TO(n) \ 219 sgn[0]==inside_table[n][0] && sgn[1]==inside_table[n][1] && \ 220 sgn[2]==inside_table[n][2] && sgn[3]==inside_table[n][3] 222 for (
int n = 0;
n < 4;
n++)
228 std::cout <<
" Inside\n";
243 std::cout <<
"a= " <<
a.
transpose() << std::endl;
244 std::cout <<
"b= " <<
b.
transpose() << std::endl;
247 std::cout <<
"ai= " <<
ai.
transpose() << std::endl;
248 std::cout <<
"bi= " << bi.
transpose() << std::endl;
249 std::cout <<
"D= " << D;
250 std::cout <<
"Check that a=D*aint " << (D*
aint).
transpose() << std::endl;
251 std::cout <<
"Check that b=D*bint " << (D*
bint).
transpose() << std::endl;
255 I.
write(
"unit_cell_mask.xmp");
256 std::cout <<
"unit_cell_mask shape=";
258 std::cout << std::endl;
293 "This function only works with blob volumes");
303 this->aint, this->bint);
309 corr_proj,
YSIZE(read_proj()),
XSIZE(read_proj()),
310 read_proj.
rot(), read_proj.
tilt(), read_proj.
psi(), shift,
313 double shift_X, shift_Y;
322 std::cout <<
"A" << A;
324 FOR_ALL_DIRECT_ELEMENTS_IN_MATRIX2D(theo_proj())
343 alig_proj().resize(read_proj());
346 dMij(Correction, 0, 2) = - shift_X;
347 dMij(Correction, 1, 2) = - shift_Y;
352 xmipp_transformation::IS_NOT_INV, xmipp_transformation::WRAP);
355 double applied_lambda = lambda / numIMG;
357 diff_proj().resize(read_proj());
371 mean_error /=
XSIZE(diff_proj()) *
YSIZE(diff_proj());
375 corr_proj,
YSIZE(read_proj()),
XSIZE(read_proj()),
376 read_proj.
rot(), read_proj.
tilt(), read_proj.
psi(), shift,
396 double a_mag_grid,
double b_mag_grid,
427 if (
XX(aint) != 2*(
int)(
XX(aint) / 2) ||
428 YY(bint) != 2*(
int)(
YY(bint) / 2))
430 std::cout <<
"\nLattice connstrains for P2_122 are not satisficed" 431 <<
"\nRound[mag_a/(sampling*grid_size)] must be even" 432 <<
"\nPlease modify the parmeters and try again" << std::endl;
437 if (
XX(aint) != 2*(
int)(
XX(aint) / 2) ||
438 YY(bint) != 2*(
int)(
YY(bint) / 2))
440 std::cout <<
"\nLattice connstrains for P22_12 are not satisficed" 441 <<
"\nRound[mag_a/(sampling*grid_size)] must be even" 442 <<
"\nPlease modify the parmeters and try again" << std::endl;
447 if (
XX(aint) != 2*(
int)(
XX(aint) / 2) ||
448 YY(bint) != 2*(
int)(
YY(bint) / 2))
450 std::cout <<
"\nLattice connstrains for P4212 are not satisficed" 451 <<
"\nRound[mag_a/(sampling*grid_size)] must be even" 452 <<
"\nPlease modify the parmeters and try again" << std::endl;
460 std::cerr <<
"\n Congratulations: you have found a bug in the\n" 461 <<
"routine compute_integer_lattice or\n" 462 <<
"you are using a non implemented symmetry group\n" 489 std::cout <<
"Replicating unit cell ...\n";
494 save.
write(
"inter_before_filling.xmp");
511 eprm.
a, eprm.
b, a0, aF, b0, bF);
513 std::cerr <<
"DEBUG_JM: eprm.a: " << eprm.
a << std::endl;
514 std::cerr <<
"DEBUG_JM: eprm.b: " << eprm.
b << std::endl;
518 std::cout <<
"corners:\n" << corner1.transpose() << std::endl
520 std::cout <<
"a0=" << a0 <<
"..." << aF << std::endl
521 <<
"b0=" << b0 <<
"..." << bF << std::endl;
525 corner1 = (double)(a0 - 1) * eprm.
a + (double)(b0 - 1) * eprm.
b;
526 corner2 = (double)(aF + 1) * eprm.
a + (double)(bF + 1) * eprm.
b;
531 vol.
resize(corner1, corner2);
543 std::cout <<
"(y,x)=(" <<
i <<
"," <<
j <<
") is inside\n";
546 for (
int ii = b0; ii <= bF; ii++)
547 for (
int jj = a0; jj <= aF; jj++)
549 if (jj == 0 && ii == 0)
557 std::cout <<
" Is copied to (" << (int)
YY(r) <<
"," 558 << (int)
XX(r) <<
")\n";
572 save.
write(
"inter_after_filling.xmp");
bool is_crystal
Is this a crystal 0 means NO 1 YES.
#define VECTOR_R2(v, x, y)
#define INSIDE_ACCORDING_TO(n)
Matrix1D< double > avox
First lattice vector (voxel units)
#define A2D_ELEM(v, i, j)
#define VOLVOXEL(V, k, i, j)
double getDoubleParam(const char *param, int arg=0)
Basis basis
Basis function. By default, blobs.
void calculate_and_find_correlation_max_proj(Projection const &proj1, Projection const &proj2, Projection &proj_temp, double &shift_X, double &shift_Y, double const max_step, int ref_trans_after, int imagen_no, CorrelationAux &aux)
void printShape(std::ostream &out=std::cout) const
#define REPORT_ERROR(nerr, ErrormMsg)
void resize(const Matrix1D< double > &corner1, const Matrix1D< double > &corner2)
double psi(const size_t n=0) const
#define FOR_ALL_DIRECT_ELEMENTS_IN_ARRAY2D(m)
void write(const FileName &name="", size_t select_img=ALL_IMAGES, bool isStack=false, int mode=WRITE_OVERWRITE, CastWriteMode castMode=CW_CAST, int _swapWrite=0)
double grid_relative_size
Relative size for the grid.
void inv(Matrix2D< T > &result) const
Matrix1D< double > bint
Second lattice vector approximated to integer numbers (BCC units)
FileName fn_sym
File containing symmetries.
Matrix1D< double > a
First lattice vector (BCC units)
void computeIntegerLattice(const Matrix1D< double > &a, const Matrix1D< double > &b, double a_mag_grid, double b_mag_grid, double ang_a2b_deg, Matrix1D< double > &aint, Matrix1D< double > &bint, Matrix2D< double > &D, int space_group)
tBasisFunction type
Basis function to use.
double rot(const size_t n=0) const
double sampling
Sampling rate.
virtual void readParams(XmippProgram *program)
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 SGN0_VEC_PRODUCT(cir, a)
void preProcess(GridVolume &vol_basis0, int level=FULL, int rank=-1)
#define FOR_ALL_ELEMENTS_IN_ARRAY2D(m)
Matrix1D< T > transpose() const
double tilt(const size_t n=0) const
#define MAT_ELEM(m, i, j)
void find_crystal_limits(const Matrix1D< double > &proj_corner1, const Matrix1D< double > &proj_corner2, const Matrix1D< double > &cell_corner1, const Matrix1D< double > &cell_corner2, const Matrix1D< double > &a, const Matrix1D< double > &b, int &iamin, int &iamax, int &ibmin, int &ibmax)
int crystallographicSpaceGroup(double mag_a, double mag_b, double ang_a2b_deg) const
double ang_x2a_deg
angle from x axis to a (degrees)
Matrix1D< double > b
Second lattice vector (BCC units)
Matrix1D< double > ai
ai=aint/2 as double numbers
MultidimArray< int > unit_cell_mask
void transpose(double *array, int size)
void readParams(XmippProgram *program)
void setCol(size_t j, const Matrix1D< T > &v)
virtual void preProcess(GridVolume &vol_basis0, int level=FULL, int rank=-1)
Produce Plain side information from the Class parameters.
void resize(size_t Xdim, bool copy=true)
void write(const FileName &fn) const
void postProcess(GridVolume &vol_basis)
Matrix1D< double > bvox
Second lattice vector (voxel units)
void print(std::ostream &o) const
std::cout << crystal_prm;
Matrix1D< double > bi
bi=aint/2 as double numbers
void project_Crystal_Volume(GridVolume &vol, const Basis &basis, Projection &proj, Projection &norm_proj, int Ydim, int Xdim, double rot, double tilt, double psi, const Matrix1D< double > &shift, const Matrix1D< double > &aint, const Matrix1D< double > &bint, const Matrix2D< double > &D, const Matrix2D< double > &Dinv, const MultidimArray< int > &mask, int FORW, int eq_mode)
double ang_a2b_deg
angle from a to b (degrees)
double ref_trans_step
Refine the translation alignement after n projection presentations.
void applySymmetry(GridVolume &vol_in, GridVolume *vol_out, int grid_type)
void symmetrizeCrystalVectors(Matrix1D< double > &aint, Matrix1D< double > &bint, Matrix1D< double > &shift, int space_group, int sym_no, const Matrix1D< double > &eprm_aint, const Matrix1D< double > &eprm_bint)
void setD(Matrix2D< double > *_D)
#define FIRST_XMIPP_INDEX(size)
bool fill_space
Fill space, repeat unit cell all over the space.
void expandToFillSpace(const BasicARTParameters &prm, const CrystalARTRecons &eprm, GridVolume &vol)
int ref_trans_after
Refine the translation alignement after n projection presentations.
static void defineParams(XmippProgram *program, const char *prefix=nullptr, const char *comment=nullptr)
bool checkParam(const char *param)
BasicARTParameters artPrm
void initZeros(const MultidimArray< T1 > &op)
#define LAST_XMIPP_INDEX(size)
int space_group
space_group
void singleStep(GridVolume &vol_in, GridVolume *vol_out, Projection &theo_proj, Projection &read_proj, int sym_no, Projection &diff_proj, Projection &corr_proj, Projection &alig_proj, double &mean_error, int numIMG, double lambda, int act_proj, const FileName &fn_ctf, const MultidimArray< int > *maskPtr, bool refine)
Incorrect value received.
void symmetrizeCrystalVolume(GridVolume &vol_in, const Matrix1D< double > &eprm_aint, const Matrix1D< double > &eprm_bint, int eprm_space_group, const MultidimArray< int > &mask, int grid_type)
Matrix1D< double > aint
First lattice vector approximated to integer numbers (BCC units)
void resize(size_t Ydim, size_t Xdim, bool noCopy=false)
void getSlice(Image< double > &op)
void addParamsLine(const String &line)
ql0001_ & zero(ctemp+1),(cvec+1),(a+1),(b+1),(bl+1),(bu+1),(x+1),(w+1), &iout, ifail, &zero,(w+3), &lwar2,(iw+1), &leniw, &glob_grd.epsmac
SymList SL
A list with the symmetry matrices.
Matrix2D< double > * Dinv
Just the inverse of D.
#define IMGPIXEL(I, i, j)