47 addUsageLine(
"Align volumes with an atomic or pseudo-atomic (from EM volume) structure by computing deformation amplitudes along normal modes");
48 addUsageLine(
"You may also align the two volumes during the process");
52 defaultComments[
"-o"].addComment(
"Metadata with output Euler angles, shifts, and deformation amplitudes");
54 addParamsLine(
" --pdb <PDB_filename> : Reference atomic or pseudo-atomic structure in PDB format");
55 addParamsLine(
" [--odir <outputDir=\".\">] : Output directory");
57 addParamsLine(
" [--opdb <PDB_filename=\"\">] : Output PDB which is the deformed input PDB");
58 addParamsLine(
"==Generation of the deformed reference volumes==");
59 addParamsLine(
" --modes <filename> : File with a list of mode filenames");
60 addParamsLine(
" [--sampling_rate <Ts=1>] : Pixel size in Angstroms");
61 addParamsLine(
" [--filterVol <cutoff=15.>] : Filter the volume after deforming. If this option is used, the default cut-off is 15 A.");
63 addParamsLine(
" [--fixed_Gaussian <std=-1>] : For pseudo-atoms fixed_Gaussian must be used.");
64 addParamsLine(
" : Default standard deviation <std> is read from the PDB file.");
65 addParamsLine(
" [--trustradius_scale <s=1>] : Positive scaling factor to scale the initial trust region radius");
66 addParamsLine(
"==Combined elastic and rigid-body alignment==");
67 addParamsLine(
" [--alignVolumes <frm_freq=0.25> <frm_shift=10>] : Align the deformed volume to the input volume before comparing, this is using frm method for volume alignment with frm_freq and frm_shift as parameters");
68 addParamsLine(
" : You need to compile Xmipp with SHALIGNMENT support (see install.sh)");
69 addParamsLine(
" [--mask <m=\"\">] : 3D masking of the projections of the deformed volume");
70 addParamsLine(
" [--tilt_values <tilt0=-90> <tiltF=90>] : only use if you are trying to compensate for the missing wedge");
71 addParamsLine(
" [--condor_params <rhoStartBase=250.> <rhoEndBase=50.> <niter=10000>] : parameters for the CONDOR optimiser (recommended to keep default)");
72 addParamsLine(
" : rhoStartBase > 0 : the lower the better, yet the slower");
73 addParamsLine(
" : rhoEndBase no specific rule, however it is better to keep it < 1000, if set very high we risk distortions");
74 addParamsLine(
" : niter should be big enough to guarantee that the search converges to the right set of nma deformation amplitudes");
75 addExampleLine(
"xmipp_nma_alignment_vol -i volumes.xmd --pdb 2tbv.pdb --modes modelist.xmd --sampling_rate 3.2 -o output.xmd --resume");
114 <<
"Output directory: " <<
fnOutDir << std::endl
115 <<
"PDB: " <<
fnPDB << std::endl
116 <<
"Resume: " <<
resume << std::endl
119 <<
"Mask: " <<
fnmask << std::endl
137 global_nma_vol_prog =
this;
157 String program =
"xmipp_pdb_nma_deform";
158 String arguments =
formatString(
"--pdb %s -o %s --nma %s --deformations ",PDBin.c_str(), PDBout.c_str(), fnModeList.c_str());
169 const char * randStr = fnRandom.c_str();
172 program =
"xmipp_volume_from_pdb";
174 "-i %s_deformedPDB.pdb --size %i --sampling %f -v 0", randStr,
178 arguments.append(
" --centerPDB ");
181 arguments.append(
" --intensityColumn Bfactor --fixed_Gaussian ");
190 program =
"xmipp_transform_filter";
192 "-i %s_deformedPDB.vol --sampling %f --fourier low_pass %f -v 0",
213 for (
int i = 0;
i < dim;
i++) {
214 global_nma_vol_prog->
trial(
i) = X[
i];
218 const char * randStr = fnRandom.c_str();
221 FileName fnShiftsAngles = fnRandom +
"_angles_shifts.txt";
222 const char * shifts_angles = fnShiftsAngles.c_str();
225 String fnVolume2 = fnRandom +
"_deformedPDB.vol";
227 if (global_nma_vol_prog->
tilt0!=-90 || global_nma_vol_prog->
tiltF!=90 ){
228 global_nma_vol_prog->
flip =
true;
229 runSystem(
"xmipp_transform_geometry",
formatString(
"-i %s -o %s_currentvolume.vol --rotate_volume euler 0 90 0 -v 0",fnVolume1.c_str(),randStr));
230 fnVolume1 = fnRandom+
"_currentvolume.vol";
233 const char * Volume1 = fnVolume1.c_str();
234 const char * Volume2 = fnVolume2.c_str();
240 Volume1,Volume2,global_nma_vol_prog->
frm_freq, global_nma_vol_prog->
frm_shift, global_nma_vol_prog->
tilt0, global_nma_vol_prog->
tiltF, shifts_angles));
244 for (
int i = 0;
i < 7;
i++){
250 retval = 1 + global_nma_vol_prog->
fit_value;
255 auto mask = (0 ==
XSIZE(global_nma_vol_prog->
mask)) ?
nullptr : &global_nma_vol_prog->
mask;
264 for (
int i = 0;
i < 6;
i++){
282 static size_t imageCounter = 0;
292 sprintf(
nameTemplate,
"_node%d_img%lu_XXXXXX",
rangen, (
long unsigned int)imageCounter);
302 for (
int i = 0;
i < dim;
i++)
327 std::vector<double> vectortemp;
332 vectortemp.push_back(lambdaj);
333 energy+=lambdaj*lambdaj;
347 if (global_nma_vol_prog->
flip){
void readParams()
Read arguments from command line.
float Best_Angles_Shifts[6]
FileName fnOutPDB
Output PDB.
double getDoubleParam(const char *param, int arg=0)
virtual void read(int argc, const char **argv, bool reportErrors=true)
void defineParams()
Define params.
FileName fnOutDir
Output directory.
virtual void preProcess()
#define REPORT_ERROR(nerr, ErrormMsg)
virtual void processImage(const FileName &fnImg, const FileName &fnImgOut, const MDRow &rowIn, MDRow &rowOut)
ProgNmaAlignmentVol()
Empty constructor.
bool do_FilterPDBVol
Low-pass filter the volume from PDB.
double sampling_rate
Pixel size in Angstroms.
FileName fnPDB
Reference atomic or pseudo-atomic structure in PDB format.
double eval(Vector v, int *nerror=nullptr)
double correlationIndex(const MultidimArray< T > &x, const MultidimArray< T > &y, const MultidimArray< int > *mask=NULL, MultidimArray< double > *Contributions=NULL)
FileName fnModeList
File with a list of mode filenames.
void abs(Image< double > &op)
Input/Output general error.
void setFileName(const FileName &fn)
void initUniqueName(const char *templateStr="xmippTemp_XXXXXX", const String &fnDir="")
bool updateBestFit(double fitness)
FileName fnmask
Mask file for 2D masking of the projections of the deformed volume.
void deformPDB(const FileName &PDBin, const FileName &PDBout, const FileName &fnModeList, const Matrix1D< double > &trial)
void runSystem(const String &program, const String &arguments, bool useSystem)
String floatToString(float F, int _width, int _prec)
Matrix1D< double > parameters
virtual void writeVolumeParameters(const FileName &fnImg)
const FileName & getFileName() const
const char * getParam(const char *param, int arg=0)
bool do_centerPDB
Center the PDB structure.
double trustradius_scale
Parameters required from the CONDOR optimization.
FileName createDeformedPDB() const
~ProgNmaAlignmentVol()
Destructor.
void resize(size_t Xdim, bool copy=true)
bool useFixedGaussian
Use pseudo-atoms instead of atoms.
void max(Image< double > &op1, const Image< double > &op2)
void addExampleLine(const char *example, bool verbatim=true)
Matrix1D< double > trial_best
ObjFunc_nma_alignment_vol(int _t, int _n=0)
ProgPdbConverter * progVolumeFromPDB
bool alignVolumes
Align volumes.
double sigmaGaussian
Gaussian standard deviation for pseudo-atoms.
void typeCast(const Matrix1D< T1 > &v1, Matrix1D< T2 > &v2)
String formatString(const char *format,...)
double cutoff_LPfilter
Low-pass cut-off frequency.
bool checkParam(const char *param)
int read(const FileName &name, DataMode datamode=DATA, size_t select_img=ALL_IMAGES, bool mapData=false, int mode=WRITE_READONLY)
FILE * AnglesShiftsAndScore
ProgNmaAlignmentVol * global_nma_vol_prog
void addUsageLine(const char *line, bool verbatim=false)
virtual void finishProcessing()
MultidimArray< int > mask
int getIntParam(const char *param, int arg=0)
void CONDOR(double rhoStart, double rhoEnd, int niter, ObjectiveFunction *of, int nnode)
virtual void createWorkFiles()
double fitness(double *p)
void addParamsLine(const String &line)
std::map< String, CommentList > defaultComments
Image< double > Vdeformed