Planned maintenance on Wednesday, 2021-01-20, 17:00-18:00. Expect some interruptions during that time

Commit 4a123b50 authored by David Rohr's avatar David Rohr

merge with devel branch

parents 89cc32a4 9582b044
......@@ -11,7 +11,7 @@ FIND_PACKAGE(PkgConfig REQUIRED)
PKG_CHECK_MODULES(FFTW fftw3 REQUIRED)
INCLUDE_DIRECTORIES(${FFTW_INCLUDE_DIRS})
FIND_PACKAGE(Boost 1.54 REQUIRED)
FIND_PACKAGE(Boost 1.43 REQUIRED)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
FIND_PACKAGE(OpenMP)
......
......@@ -57,6 +57,8 @@ int bioem::configure(int ac, char* av[])
param.writeAngles = false;
param.dumpMap = false;
param.loadMap = false;
RefMap.readMRC = false;
RefMap.readMultMRC = false;
// *************************************************************************************
cout << " ++++++++++++ FROM COMMAND LINE +++++++++++\n\n";
......@@ -66,21 +68,26 @@ int bioem::configure(int ac, char* av[])
try {
po::options_description desc("Command line inputs");
desc.add_options()
("Inputfile", po::value<std::string>(), "Name of input parameter file")
("Modelfile", po::value< std::string>() , "Name of model file")
("Particlesfile", po::value< std::string>(), "Name of paricles file")
("ReadPDB", "(Optional) If reading model file in PDB format")
("DumpMaps", "(Optional) Dump maps after they were red from maps file")
("LoadMapDump", "(Optional) Read Maps from dump instead of maps file")
("help", "(Optional) Produce help message")
;
desc.add_options()
("Inputfile", po::value<std::string>(), "(Mandatory) Name of input parameter file")
("Modelfile", po::value< std::string>() , "(Mandatory) Name of model file")
("Particlesfile", po::value< std::string>(), "(Mandatory) Name of paricles file")
("ReadPDB", "(Optional) If reading model file in PDB format")
("ReadMRC", "(Optional) If reading particle file in MRC format")
("ReadMultipleMRC", "(Optional) If reading Multiple MRCs")
("DumpMaps", "(Optional) Dump maps after they were red from maps file")
("LoadMapDump", "(Optional) Read Maps from dump instead of maps file")
("help", "(Optional) Produce help message")
;
po::positional_options_description p;
p.add("Inputfile", -1);
p.add("Modelfile", -1);
p.add("Particlesfile", -1);
p.add("ReadPDB", -1);
p.add("ReadMRC", -1);
p.add("ReadMultipleMRC", -1);
p.add("DumpMaps", -1);
p.add("LoadMapDump", -1);
......@@ -118,6 +125,18 @@ int bioem::configure(int ac, char* av[])
Model.readPDB = true;
}
if (vm.count("ReadMRC"))
{
cout << "Reading particle file in MRC format.\n";
RefMap.readMRC=true;
}
if (vm.count("ReadMultipleMRC"))
{
cout << "Reading Multiple MRCs.\n";
RefMap.readMultMRC=true;
}
if (vm.count("DumpMaps"))
{
cout << "Dumping Maps after reading from file.\n";
......@@ -360,8 +379,11 @@ int bioem::run()
int bioem::compareRefMaps(int iOrient, int iConv, const myfloat_t* conv_map, mycomplex_t* localmultFFT, myfloat_t sumC, myfloat_t sumsquareC, const int startMap)
{
//***************************************************************************************
//***** BioEM routine for comparing reference maps to convoluted maps *****
if (FFTAlgo)
{
//With FFT Algorithm
#pragma omp parallel for
for (int iRefMap = startMap; iRefMap < RefMap.ntotRefMap; iRefMap ++)
{
......@@ -371,6 +393,7 @@ int bioem::compareRefMaps(int iOrient, int iConv, const myfloat_t* conv_map, myc
}
else
{
//Without FFT Algorithm
#pragma omp parallel for
for (int iRefMap = startMap; iRefMap < RefMap.ntotRefMap; iRefMap ++)
{
......@@ -382,6 +405,9 @@ int bioem::compareRefMaps(int iOrient, int iConv, const myfloat_t* conv_map, myc
inline void bioem::calculateCCFFT(int iRefMap, int iOrient, int iConv, myfloat_t sumC, myfloat_t sumsquareC, mycomplex_t* localConvFFT, mycomplex_t* localCCT, myfloat_t* lCC)
{
//***************************************************************************************
//***** Calculating cross correlation in FFTALGOrithm *****
const mycomplex_t* RefMapFFT = &RefMap.RefMapsFFT[iRefMap * param.FFTMapSize];
for(int i = 0; i < param.param_device.NumberPixels * param.param_device.NumberFFTPixels1D; i++)
{
......
......@@ -34,8 +34,17 @@ public:
int precalculate(bioem_param& param, bioem& bio);
int PreCalculateMapsFFT(bioem_param& param);
int read_int(int *currlong, FILE *fin, int swap);
int read_float(float *currfloat, FILE *fin, int swap);
int read_float_empty (FILE *fin);
int read_char_float (float *currfloat, FILE *fin) ;
int test_mrc (const char *vol_file, int swap);
int read_MRC(const char* filename,bioem_param& param);
mycomplex_t* RefMapsFFT;
bool readMRC,readMultMRC;
int ntotRefMap;
int numPixels;
int refMapSize;
......
This diff is collapsed.
......@@ -109,8 +109,7 @@ int bioem_model::readModel()
}
nPointsModel = numres;
cout << "Protein structure read from PDB\nTotal Number of Residues " << nPointsModel;
cout << "\n+++++++++++++++++++++++++++++++++++++++++ \n";
cout << "Protein structure read from PDB\n";
}
else //Reading model from FILE FORMAT x,y,z,rad,density
{
......@@ -118,32 +117,35 @@ int bioem_model::readModel()
int numres = 0;
NormDen = 0.0;
FILE *file = fopen ( filemodel , "r" );
if ( file != NULL )
if (file == NULL)
{
while ( fgets ( line, sizeof line, file ) != NULL )
cout << "Error opening file " << filemode, << "\n";
exit(1);
}
while ( fgets ( line, sizeof line, file ) != NULL )
{
if (numres >= BIOEM_MODEL_SIZE)
{
if (numres >= BIOEM_MODEL_SIZE)
{
cout << "BIOEM_MODEL_SIZE too small\n";
exit(1);
}
float tmpval[5];
sscanf(line, "%f %f %f %f %f", &tmpval[0], &tmpval[1], &tmpval[2], &tmpval[3], &tmpval[4]);
PointsModel[numres].pos[0] = (myfloat_t) tmpval[0];
PointsModel[numres].pos[1] = (myfloat_t) tmpval[1];
PointsModel[numres].pos[2] = (myfloat_t) tmpval[2];
radiusPointsModel[numres] = (myfloat_t) tmpval[3];
densityPointsModel[numres] = (myfloat_t) tmpval[4];
exampleReadCoor << "RESIDUE " << numres << " " << PointsModel[numres].pos[0] << " " << PointsModel[numres].pos[1] << " " << PointsModel[numres].pos[2] << " " << densityPointsModel[numres] << "\n";
NormDen += densityPointsModel[numres];
numres++;
cout << "BIOEM_MODEL_SIZE too small\n";
exit(1);
}
nPointsModel = numres;
cout << "Protein structure read from Standard File \nTotal Number of Residues " << nPointsModel ;
cout << "\n+++++++++++++++++++++++++++++++++++++++++ \n";
float tmpval[5];
sscanf(line, "%f %f %f %f %f", &tmpval[0], &tmpval[1], &tmpval[2], &tmpval[3], &tmpval[4]);
PointsModel[numres].pos[0] = (myfloat_t) tmpval[0];
PointsModel[numres].pos[1] = (myfloat_t) tmpval[1];
PointsModel[numres].pos[2] = (myfloat_t) tmpval[2];
radiusPointsModel[numres] = (myfloat_t) tmpval[3];
densityPointsModel[numres] = (myfloat_t) tmpval[4];
exampleReadCoor << "RESIDUE " << numres << " " << PointsModel[numres].pos[0] << " " << PointsModel[numres].pos[1] << " " << PointsModel[numres].pos[2] << " " << densityPointsModel[numres] << "\n";
NormDen += densityPointsModel[numres];
numres++;
}
nPointsModel = numres;
cout << "Protein structure read from Standard File\n";
}
cout << "Total Number of Voxels " << nPointsModel ;
cout << "\n+++++++++++++++++++++++++++++++++++++++++ \n";
exampleReadCoor.close();
//Moving to Model to its center of mass:
......
......@@ -42,6 +42,23 @@ int bioem_param::readParameters()
// ***************************** Reading Input Parameters ******************************
// **************************************************************************************
// Control for Parameters
bool yesPixSi = false;
bool yesNumPix = false;
bool yesGPal = false;
bool yesGPbe = false;
bool yesGPEnv = false;
bool yesGPamp = false;
bool yesGPpha = false;
bool yesSTEnv = false;
bool yesSTamp = false;
bool yesSTpha = false;
bool yesGSPamp = false ;
bool yesGSPEnv = false ;
bool yesGSPpha = false ;
bool yesMDC = false ;
bool yesGCen = false ;
ifstream input(fileinput);
if (!input.good())
{
......@@ -70,116 +87,162 @@ int bioem_param::readParameters()
{
token = strtok(NULL, " ");
pixelSize = atof(token);
cout << "Pixel Sixe " << pixelSize << "\n";
if (pixelSize < 0 ) { cout << "*** Error: Negative pixelSize "; exit(1);}
cout << "Pixel Sixe " << pixelSize << "\n";
yesPixSi= true;
}
else if (strcmp(token, "NUMBER_PIXELS") == 0)
{
token = strtok(NULL, " ");
param_device.NumberPixels = int(atoi(token));
cout << "Number of Pixels " << param_device.NumberPixels << "\n";
if (param_device.NumberPixels < 0 ) { cout << "*** Error: Negative Number of Pixels "; exit(1);}
cout << "Number of Pixels " << param_device.NumberPixels << "\n";
yesNumPix= true ;
}
else if (strcmp(token, "GRIDPOINTS_ALPHA") == 0)
{
token = strtok(NULL, " ");
angleGridPointsAlpha = int(atoi(token));
cout << "Grid points alpha " << angleGridPointsAlpha << "\n";
if (angleGridPointsAlpha < 0 ) { cout << "*** Error: Negative GRIDPOINTS_ALPHA "; exit(1);}
cout << "Grid points alpha " << angleGridPointsAlpha << "\n";
yesGPal= true;
}
else if (strcmp(token, "GRIDPOINTS_BETA") == 0)
{
token = strtok(NULL, " ");
angleGridPointsBeta = int(atoi(token));
cout << "Grid points beta " << angleGridPointsBeta << "\n";
if (angleGridPointsBeta < 0 ) { cout << "*** Error: Negative GRIDPOINTS_BETA "; exit(1);}
cout << "Grid points beta " << angleGridPointsBeta << "\n";
yesGPbe= true;
}
else if (strcmp(token, "GRIDPOINTS_ENVELOPE") == 0)
{
token = strtok(NULL, " ");
numberGridPointsEnvelop = int(atoi(token));
cout << "Grid points envelope " << numberGridPointsEnvelop << "\n";
if (numberGridPointsDisplaceCenter < 0 ) { cout << "*** Error: Negative GRIDPOINTS_ENVELOPE "; exit(1);}
cout << "Grid points envelope " << numberGridPointsEnvelop << "\n";
yesGPEnv = true;
}
else if (strcmp(token, "START_ENVELOPE") == 0)
{
token = strtok(NULL, " ");
startGridEnvelop = atof(token);
cout << "Start Envelope " << startGridEnvelop << "\n";
if (startGridEnvelop < 0 ) { cout << "*** Error: Negative START_ENVELOPE "; exit(1);}
cout << "Start Envelope " << startGridEnvelop << "\n";
yesSTEnv = true ;
}
else if (strcmp(token, "GRIDSPACE_ENVELOPE") == 0)
{
token = strtok(NULL, " ");
gridEnvelop = atof(token);
cout << "Grid spacing Envelope " << gridEnvelop << "\n";
}
else if (strcmp(token, "GRIDPOINTS_CTF_PHASE") == 0)
{
token = strtok(NULL, " ");
numberGridPointsCTF_phase = int(atoi(token));
cout << "Grid points CTF " << numberGridPointsCTF_phase << "\n";
}
else if (strcmp(token, "START_CTF_PHASE") == 0)
{
token = strtok(NULL, " ");
startGridCTF_phase = atof(token);
cout << "Start CTF " << startGridCTF_phase << "\n";
}
else if (strcmp(token, "GRIDSPACE_CTF_PHASE") == 0)
{
token = strtok(NULL, " ");
gridCTF_phase = atof(token);
cout << "Grid Space CTF " << gridCTF_phase << "\n";
} else if (strcmp(token, "GRIDPOINTS_CTF_AMP") == 0)
{
token = strtok(NULL, " ");
numberGridPointsCTF_amp = int(atoi(token));
cout << "Grid points CTF " << numberGridPointsCTF_amp << "\n";
}
else if (strcmp(token, "START_CTF_AMP") == 0)
{
token = strtok(NULL, " ");
startGridCTF_amp = atof(token);
cout << "Start CTF " << startGridCTF_amp << "\n";
}
else if (strcmp(token, "GRIDSPACE_CTF_AMP") == 0)
{
token = strtok(NULL, " ");
gridCTF_amp = atof(token);
cout << "Grid Space CTF " << gridCTF_amp << "\n";
if (gridEnvelop < 0 ) { cout << "*** Error: Negative GRIDSPACE_ENVELOPE "; exit(1);}
cout << "Grid spacing Envelope " << gridEnvelop << "\n";
yesGSPEnv = true ;
}
else if (strcmp(token,"GRIDPOINTS_PSF_PHASE")==0)
{
token = strtok(NULL," ");
numberGridPointsCTF_phase=int(atoi(token));
cout << "Grid points PSF " << numberGridPointsCTF_phase << "\n";
yesGPpha = true;
}
else if (strcmp(token,"START_PSF_PHASE")==0)
{
token = strtok(NULL," ");
startGridCTF_phase=atof(token);
cout << "Start PSF " << startGridCTF_phase << "\n";
yesSTpha = true ;
}
else if (strcmp(token,"GRIDSPACE_PSF_PHASE")==0)
{
token = strtok(NULL," ");
gridCTF_phase=atof(token);
cout << "Grid Space PSF " << gridCTF_phase << "\n";
yesGSPpha = true ;
}
else if (strcmp(token,"GRIDPOINTS_PSF_AMP")==0)
{
token = strtok(NULL," ");
numberGridPointsCTF_amp=int(atoi(token));
cout << "Grid points PSF " << numberGridPointsCTF_amp << "\n";
yesGPamp = true ;
}
else if (strcmp(token,"START_PSF_AMP")==0)
{
token = strtok(NULL," ");
startGridCTF_amp=atof(token);
cout << "Start PSF " << startGridCTF_amp << "\n";
yesSTamp = true ;
}
else if (strcmp(token,"GRIDSPACE_PSF_AMP")==0)
{
token = strtok(NULL," ");
gridCTF_amp=atof(token);
cout << "Grid Space PSF " << gridCTF_amp << "\n";
yesGSPamp = true ;
}
else if (strcmp(token, "MAX_D_CENTER") == 0)
{
token = strtok(NULL, " ");
param_device.maxDisplaceCenter = int(atoi(token));
cout << "Maximum displacement Center " << param_device.maxDisplaceCenter << "\n";
if (param_device.maxDisplaceCenter < 0 ) { cout << "*** Error: Negative MAX_D_CENTER "; exit(1);}
cout << "Maximum displacement Center " << param_device.maxDisplaceCenter << "\n";
yesMDC = true;
}
else if (strcmp(token, "PIXEL_GRID_CENTER") == 0)
{
token = strtok(NULL, " ");
param_device.GridSpaceCenter = int(atoi(token));
cout << "Grid space displacement center " << param_device.GridSpaceCenter << "\n";
if (param_device.GridSpaceCenter < 0 ) { cout << "*** Error: Negative PIXEL_GRID_CENTER "; exit(1);}
cout << "Grid space displacement center " << param_device.GridSpaceCenter << "\n";
yesGCen = true;
}
else if (strcmp(token, "WRITE_PROB_ANGLES") == 0)
{
writeAngles = true;
cout << "Writing Probabilies of each angle \n";
}
}
input.close();
// Checks for ALL INPUT
if( not ( yesPixSi ) ){ cout << "**** INPUT MISSING: Please provide PIXEL_SIZE\n" ; exit (1);};
if( not ( yesNumPix ) ){ cout << "**** INPUT MISSING: Please provide NUMBER_PIXELS \n" ; exit (1);};
if( not ( yesGPal ) ) { cout << "**** INPUT MISSING: Please provide GRIDPOINTS_ALPHA \n" ; exit (1);};
if( not ( yesGPbe ) ) { cout << "**** INPUT MISSING: Please provide GRIDPOINTS_BETA \n" ; exit (1);};
if( not ( yesGPEnv ) ) { cout << "**** INPUT MISSING: Please provide GRIDPOINTS_ENVELOPE \n" ; exit (1);};
if( not ( yesGPamp ) ) { cout << "**** INPUT MISSING: Please provide GRIDPOINTS_PSF_AMP \n" ; exit (1);};
if( not ( yesGPpha ) ) { cout << "**** INPUT MISSING: Please provide GRIDPOINTS_PSF_PHASE \n" ; exit (1);};
if( not ( yesSTEnv ) ) { cout << "**** INPUT MISSING: Please provide START_ENVELOPE \n" ; exit (1);};
if( not ( yesSTamp ) ) { cout << "**** INPUT MISSING: Please provide START_PSF_AMP \n" ; exit (1);};
if( not ( yesSTpha ) ) { cout << "**** INPUT MISSING: Please provide START_PSF_PHASE \n" ; exit (1);};
if( not ( yesGSPamp ) ) { cout << "**** INPUT MISSING: Please provide GRIDSPACE_PSF_AMP \n" ; exit (1);};
if( not ( yesGSPEnv ) ) { cout << "**** INPUT MISSING: Please provide GRIDSPACE_ENVELOPE \n" ; exit (1);};
if( not ( yesGSPpha ) ) { cout << "**** INPUT MISSING: Please provide GRIDSPACE_PSF_PHASE \n" ; exit (1);};
if( not ( yesMDC ) ) { cout << "**** INPUT MISSING: Please provide MAX_D_CENTER \n" ; exit (1);};
if( not ( yesGCen ) ) { cout << "**** INPUT MISSING: Please provide PIXEL_GRID_CENTER \n" ; exit (1);};
//More checks with input parameters
// Envelope should not have a standard deviation greater than Npix/2
if(sqrt(1./( (myfloat_t) numberGridPointsDisplaceCenter * gridEnvelop + startGridEnvelop))> float(param_device.NumberPixels)/2.0) {
cout << "MAX Standar deviation of envelope is larger than Allowed KERNEL Length " ;
exit(1);
}
// Envelop param should be positive
if( startGridCTF_amp < 0 || startGridCTF_amp > 1){
cout << "PSF Amplitud should be between 0 and 1 \n" ;
exit(1);
}
if( (myfloat_t) numberGridPointsCTF_amp * gridCTF_amp + startGridCTF_amp < 0 || (myfloat_t) numberGridPointsCTF_amp * gridCTF_amp + startGridCTF_amp > 1){
cout << "PSF Amplitud should be between 0 and 1 \n" ;
exit(1);
}
cout << " +++++++++++++++++++++++++++++++++++++++++ \n";
cout << "Preparing FFTs\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment