From 048ebbce58111d851dd9cfa7ee8d1e3935e96cff Mon Sep 17 00:00:00 2001 From: Pilar Cossio Date: Wed, 11 Nov 2015 11:35:21 +0100 Subject: [PATCH] Polished creat map & others --- bioem.cpp | 50 ++++++++++++++++++++++++++++++++++--------------- include/param.h | 3 ++- model.cpp | 4 ++-- param.cpp | 41 +++++++++++++++++++++++++++++++++++----- 4 files changed, 75 insertions(+), 23 deletions(-) diff --git a/bioem.cpp b/bioem.cpp index 9b3d9dc..1b788a5 100644 --- a/bioem.cpp +++ b/bioem.cpp @@ -297,10 +297,12 @@ int bioem::configure(int ac, char* av[]) { if (DebugOutput >= 2 && mpi_rank == 0) timer.ResetStart(); MPI_Bcast(¶m, sizeof(param), MPI_BYTE, 0, MPI_COMM_WORLD); + //We have to reinitialize all pointers !!!!!!!!!!!!!! + if (mpi_rank != 0) param.angprior = NULL; // cout << "HERE MPI " << param.nTotGridAngles << " " << param.nTotGridAngles * sizeof(myfloat3_t*) << "\n"; - if (mpi_rank != 0)param.angles = (myfloat3_t*) mallocchk(3 * param.nTotGridAngles * sizeof (myfloat3_t*)); - MPI_Bcast(param.angles, 3 * param.nTotGridAngles * sizeof (myfloat3_t*),MPI_BYTE, 0, MPI_COMM_WORLD); + if (mpi_rank != 0)param.angles = (myfloat3_t*) mallocchk(param.nTotGridAngles * sizeof (myfloat3_t)); + MPI_Bcast(param.angles, param.nTotGridAngles * sizeof (myfloat3_t),MPI_BYTE, 0, MPI_COMM_WORLD); //Allocating memory for prior // if (mpi_rank != 0){//param.angprior = (myfloat_t*) mallocchk(3* param.nTotGridAngles * sizeof (myfloat_t*)); @@ -698,6 +700,8 @@ int bioem::run() if(!param.doquater){ angProbfile <<" RefMap: MapNumber ; alpha[rad] - beta[rad] - gamma[rad] - logP - cal log Probability + Constant: Numerical Const.+ log (volume) + prior ang\n" ;} else { angProbfile <<" RefMap: MapNumber ; q1 - q2 -q3 - logP- cal log Probability + Constant: Numerical Const. + log (volume) + prior ang\n" ;}; angProbfile <<"************************* HEADER:: NOTATION *******************************************\n"; +// angProbfile <<"Model Used: " << modelfile.c_str() << "\n"; +// angProbfile <<"Input Used: " << infile.c_str() << "\n"; } // Output for Cross Correlation File ofstream ccProbfile; @@ -1072,14 +1076,27 @@ int bioem::createProjection(int iMap, mycomplex_t* mapFFT) for(int n = 0; n < Model.nPointsModel; n++) { if(Model.points[n].radius < param.pixelSize){ - cout << "Error: Radius less than Pixel size: use keyword NO_PROJECT_RADIUS in inputfile\n"; - exit(1); - } + // cout << "Radius less than Pixel size: use keyword NO_PROJECT_RADIUS in inputfile\n"; + i = floor(RotatedPointsModel[n].pos[0] / param.pixelSize + (myfloat_t) param.param_device.NumberPixels / 2.0f + 0.5f); + j = floor(RotatedPointsModel[n].pos[1] / param.pixelSize + (myfloat_t) param.param_device.NumberPixels / 2.0f + 0.5f); + + if (i < 0 || j < 0 || i >= param.param_device.NumberPixels || j >= param.param_device.NumberPixels) + { + if (DebugOutput >= 0) cout << "WARNING:::: Model Point out of Projection map: " << i << ", " << j << "\n"; + // continue; + exit(1); + } + + localproj[i * param.param_device.NumberPixels + j] += Model.points[n].density;//Model.NormDen; + + // exit(1); + }else{ + //Getting Centers of Sphere - i = floor(RotatedPointsModel[n].pos[0] / param.pixelSize + (myfloat_t) param.param_device.NumberPixels / 2.0f + 0.5f); - j = floor(RotatedPointsModel[n].pos[1] / param.pixelSize + (myfloat_t) param.param_device.NumberPixels / 2.0f + 0.5f); + i = floor(RotatedPointsModel[n].pos[0] / param.pixelSize + (myfloat_t) param.param_device.NumberPixels / 2.0f + 0.5f) -param.shiftX; + j = floor(RotatedPointsModel[n].pos[1] / param.pixelSize + (myfloat_t) param.param_device.NumberPixels / 2.0f + 0.5f) -param.shiftY; //Getting the radius - irad=int( Model.points[n].radius / param.pixelSize ); + irad=int( Model.points[n].radius / param.pixelSize ) + 1; rad2= Model.points[n].radius * Model.points[n].radius; if (i < 0 || j < 0 || i >= param.param_device.NumberPixels || j >= param.param_device.NumberPixels) @@ -1087,7 +1104,7 @@ int bioem::createProjection(int iMap, mycomplex_t* mapFFT) if (DebugOutput >= 0) cout << "WARNING::: Model Point out of Projection map: " << i << ", " << j << "\n"; cout << "Model point " << n << "Rotation: " << iMap <<" "<< RotatedPointsModel[n].pos[0] << " " << RotatedPointsModel[n].pos[1] << " " << RotatedPointsModel[n].pos[2] << "\n"; cout << "Original coor " << n <<" " << Model.points[n].point.pos[0] << " " << Model.points[n].point.pos[1] << " " <