Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
MPIBP-Hummer
BioEM
Commits
0392963f
Commit
0392963f
authored
Apr 16, 2014
by
Pilar Cossio
Browse files
Included Input Checks
parent
92e7d74a
Changes
5
Hide whitespace changes
Inline
Side-by-side
bioem.cpp
View file @
0392963f
...
...
@@ -47,11 +47,11 @@ bioem::~bioem()
int
bioem
::
configure
(
int
ac
,
char
*
av
[])
{
/**************************************************************************************
/
/**** Configuration Routine using boost for extracting parameters, models and maps ****
/
/**************************************************************************************
/
/****** And Precalculating necessary grids, map crosscorrelations and kernels ********
/
/*************************************************************************************
/
/
/**************************************************************************************
/
/**** Configuration Routine using boost for extracting parameters, models and maps ****
/
/**************************************************************************************
/
/****** And Precalculating necessary grids, map crosscorrelations and kernels ********
/
/*************************************************************************************
/*** Inizialzing default variables ***/
std
::
string
infile
,
modelfile
,
mapfile
;
...
...
@@ -61,19 +61,20 @@ int bioem::configure(int ac, char* av[])
RefMap
.
loadMap
=
false
;
RefMap
.
readMRC
=
false
;
RefMap
.
readMultMRC
=
false
;
/*************************************************************************************
/
cout
<<
"
++++++++++++ FROM COMMAND LINE +++++++++++
\n\n
"
;
/*************************************************************************************
/
/
/*************************************************************************************
cout
<<
"
+
++++++++++++ FROM COMMAND LINE +++++++++++
\n\n
"
;
/
/*************************************************************************************
/********************* Command line reading input with BOOST ************************
/
/
/********************* Command line reading input with BOOST ************************
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"
)
(
"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"
)
...
...
@@ -98,8 +99,9 @@ int bioem::configure(int ac, char* av[])
po
::
notify
(
vm
);
if
((
ac
<
6
))
{
std
::
cout
<<
desc
<<
std
::
endl
;
return
0
;
std
::
cout
<<
desc
<<
std
::
endl
;
exit
(
1
);
return
0
;
}
if
(
vm
.
count
(
"help"
))
{
cout
<<
"Usage: options_description [options]
\n
"
;
...
...
@@ -111,7 +113,7 @@ int bioem::configure(int ac, char* av[])
{
cout
<<
"Input file is: "
;
cout
<<
vm
[
"Inputfile"
].
as
<
std
::
string
>
()
<<
"
\n
"
;
infile
=
vm
[
"Inputfile"
].
as
<
std
::
string
>
();
infile
=
vm
[
"Inputfile"
].
as
<
std
::
string
>
();
}
if
(
vm
.
count
(
"Modelfile"
))
{
...
...
@@ -162,23 +164,23 @@ int bioem::configure(int ac, char* av[])
return
1
;
}
/********************* Reading Parameter Input ***************************
/
/
/********************* Reading Parameter Input ***************************
// copying inputfile to param class
param
.
fileinput
=
infile
.
c_str
();
param
.
readParameters
();
/********************* Reading Model Input ******************************
/
/
/********************* Reading Model Input ******************************
// copying modelfile to model class
Model
.
filemodel
=
modelfile
.
c_str
();
Model
.
readModel
();
/********************* Reading Particle Maps Input **********************
/
/********* HERE: PROBLEM if maps dont fit on the memory!! ***************
/
/
/********************* Reading Particle Maps Input **********************
/
/********* HERE: PROBLEM if maps dont fit on the memory!! ***************
// copying mapfile to ref map class
RefMap
.
filemap
=
mapfile
.
c_str
();
RefMap
.
readRefMaps
(
param
);
/****************** Precalculating Necessary Stuff *********************
/
/
/****************** Precalculating Necessary Stuff *********************
precalculate
();
if
(
getenv
(
"BIOEM_DEBUG_BREAK"
))
...
...
@@ -194,9 +196,9 @@ int bioem::configure(int ac, char* av[])
int
bioem
::
precalculate
()
{
/**************************************************************************************
/
/* Precalculating Routine of Orientation grids, Map crosscorrelations and CTF Kernels *
/
/**************************************************************************************
/
/
/**************************************************************************************
/
/* Precalculating Routine of Orientation grids, Map crosscorrelations and CTF Kernels *
/
/**************************************************************************************
// Generating Grids of orientations
param
.
CalculateGridsParam
();
...
...
@@ -224,12 +226,12 @@ int bioem::precalculate()
int
bioem
::
run
()
{
/**************************************************************************************
/
/**** Main BioEM routine, projects, convolutes and compares with Map using OpenMP ****
/
/**************************************************************************************
/
/
/**************************************************************************************
/
/**** Main BioEM routine, projects, convolutes and compares with Map using OpenMP ****
/
/**************************************************************************************
/**** If we want to control the number of threads -> omp_set_num_threads(XX); ******
/
/****************** Declarying class of Probability Pointer *************************
/
/
/**** If we want to control the number of threads -> omp_set_num_threads(XX); ******
/
/****************** Declarying class of Probability Pointer *************************
pProb
=
new
bioem_Probability
[
RefMap
.
ntotRefMap
];
printf
(
"
\t
Initializing
\n
"
);
...
...
@@ -245,12 +247,12 @@ int bioem::run()
pProb
[
iRefMap
].
ConstAngle
[
iOrient
]
=-
99999999
;
}
}
/**************************************************************************************
/
/
/**************************************************************************************
deviceStartRun
();
/******************************** MAIN CYCLE ******************************************
/
/
/******************************** MAIN CYCLE ******************************************
/*** Declaring Private variables for each thread *****
/
/
/*** Declaring Private variables for each thread *****
mycomplex_t
*
proj_mapFFT
;
bioem_map
conv_map
;
mycomplex_t
*
conv_mapFFT
;
...
...
@@ -266,25 +268,25 @@ int bioem::run()
printf
(
"
\t
Inner Loop Count (%d %d %d) %lld
\n
"
,
param
.
param_device
.
maxDisplaceCenter
,
param
.
param_device
.
GridSpaceCenter
,
param
.
param_device
.
NumberPixels
,
(
long
long
int
)
(
param
.
param_device
.
NumberPixels
*
param
.
param_device
.
NumberPixels
*
(
2
*
param
.
param_device
.
maxDisplaceCenter
/
param
.
param_device
.
GridSpaceCenter
+
1
)
*
(
2
*
param
.
param_device
.
maxDisplaceCenter
/
param
.
param_device
.
GridSpaceCenter
+
1
)));
for
(
int
iProjectionOut
=
0
;
iProjectionOut
<
param
.
nTotGridAngles
;
iProjectionOut
++
)
{
/***************************************************************************************
/
/***** Creating Projection for given orientation and transforming to Fourier space *****
/
/
/***************************************************************************************
/
/***** Creating Projection for given orientation and transforming to Fourier space *****
timer
.
ResetStart
();
createProjection
(
iProjectionOut
,
proj_mapFFT
);
printf
(
"Time Projection %d: %f
\n
"
,
iProjectionOut
,
timer
.
GetCurrentElapsedTime
());
/***************************************************************************************
/
/***** **** Internal Loop over convolutions **** *****
/
/
/***************************************************************************************
/
/***** **** Internal Loop over convolutions **** *****
for
(
int
iConv
=
0
;
iConv
<
param
.
nTotCTFs
;
iConv
++
)
{
printf
(
"
\t\t
Convolution %d %d
\n
"
,
iProjectionOut
,
iConv
);
/*** Calculating convolutions of projection map and crosscorrelations ***
/
/
/*** Calculating convolutions of projection map and crosscorrelations ***
timer
.
ResetStart
();
createConvolutedProjectionMap
(
iProjectionOut
,
iConv
,
proj_mapFFT
,
conv_map
,
conv_mapFFT
,
sumCONV
,
sumsquareCONV
);
printf
(
"Time Convolution %d %d: %f
\n
"
,
iProjectionOut
,
iConv
,
timer
.
GetCurrentElapsedTime
());
/***************************************************************************************
/
/*** Comparing each calculated convoluted map with all experimental maps ***
/
/
/***************************************************************************************
/
/*** Comparing each calculated convoluted map with all experimental maps ***
timer
.
ResetStart
();
compareRefMaps
(
iProjectionOut
,
iConv
,
conv_map
,
conv_mapFFT
,
sumCONV
,
sumsquareCONV
);
...
...
@@ -305,9 +307,9 @@ int bioem::run()
deviceFinishRun
();
/************* Writing Out Probabilities ***************
/
/
/************* Writing Out Probabilities ***************
/*** Angular Probability ***
/
/
/*** Angular Probability ***
// if(param.writeAngles){
ofstream
angProbfile
;
...
...
@@ -319,12 +321,12 @@ int bioem::run()
for
(
int
iRefMap
=
0
;
iRefMap
<
RefMap
.
ntotRefMap
;
iRefMap
++
)
{
/**** Total Probability ***
/
/
/**** Total Probability ***
outputProbFile
<<
"RefMap "
<<
iRefMap
<<
" Probability "
<<
log
(
pProb
[
iRefMap
].
Total
)
+
pProb
[
iRefMap
].
Constoadd
+
0.5
*
log
(
M_PI
)
+
(
1
-
param
.
param_device
.
Ntotpi
*
0.5
)
*
(
log
(
2
*
M_PI
)
+
1
)
+
log
(
param
.
param_device
.
volu
)
<<
" Constant "
<<
pProb
[
iRefMap
].
Constoadd
<<
"
\n
"
;
outputProbFile
<<
"RefMap "
<<
iRefMap
<<
" Maximizing Param: "
;
/*** Param that maximize probability****
/
/
/*** Param that maximize probability****
outputProbFile
<<
(
pProb
[
iRefMap
].
max_prob
+
0.5
*
log
(
M_PI
)
+
(
1
-
param
.
param_device
.
Ntotpi
*
0.5
)
*
(
log
(
2
*
M_PI
)
+
1
)
+
log
(
param
.
param_device
.
volu
))
<<
" "
;
outputProbFile
<<
param
.
angles
[
pProb
[
iRefMap
].
max_prob_orient
].
pos
[
0
]
<<
" "
;
outputProbFile
<<
param
.
angles
[
pProb
[
iRefMap
].
max_prob_orient
].
pos
[
1
]
<<
" "
;
...
...
@@ -336,7 +338,7 @@ int bioem::run()
outputProbFile
<<
pProb
[
iRefMap
].
max_prob_cent_y
;
outputProbFile
<<
"
\n
"
;
/*** For individual files***
/
//angProbfile.open ("ANG_PROB_"iRefMap);
/
/*** For individual files*** //angProbfile.open ("ANG_PROB_"iRefMap);
if
(
param
.
writeAngles
)
{
...
...
@@ -375,7 +377,11 @@ int bioem::run()
int
bioem
::
compareRefMaps
(
int
iProjectionOut
,
int
iConv
,
const
bioem_map
&
conv_map
,
mycomplex_t
*
localmultFFT
,
myfloat_t
sumC
,
myfloat_t
sumsquareC
,
const
int
startMap
)
{
if
(
FFTAlgo
)
//***************************************************************************************
//***** BioEM routine for comparing reference maps to convoluted maps *****
if
(
FFTAlgo
)
//IF using the fft algorithm
{
#pragma omp parallel
{
...
...
@@ -411,6 +417,10 @@ int bioem::compareRefMaps(int iProjectionOut, int iConv, const bioem_map& conv_m
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
.
RefMapSize
];
for
(
int
i
=
0
;
i
<
param
.
param_device
.
NumberPixels
*
param
.
param_device
.
NumberFFTPixels1D
;
i
++
)
{
...
...
@@ -425,10 +435,10 @@ inline void bioem::calculateCCFFT(int iRefMap, int iOrient, int iConv, myfloat_t
int
bioem
::
createProjection
(
int
iMap
,
mycomplex_t
*
mapFFT
)
{
/**************************************************************************************
/
/**** BioEM Create Projection routine in Euler angle predefined grid****************
********************* and turns projection into Fourier space **********************
/
/**************************************************************************************
/
/
/**************************************************************************************
/
/**** BioEM Create Projection routine in Euler angle predefined grid****************
//
********************* and turns projection into Fourier space **********************
/
/**************************************************************************************
myfloat3_t
RotatedPointsModel
[
Model
.
nPointsModel
];
myfloat_t
rotmat
[
3
][
3
];
...
...
@@ -442,9 +452,9 @@ int bioem::createProjection(int iMap,mycomplex_t* mapFFT)
beta
=
param
.
angles
[
iMap
].
pos
[
1
];
gam
=
param
.
angles
[
iMap
].
pos
[
2
];
/**** To see how things are going: cout << "Id " << omp_get_thread_num() << " Angs: " << alpha << " " << beta << " " << gam << "\n"; ***
/
/
/**** To see how things are going: cout << "Id " << omp_get_thread_num() << " Angs: " << alpha << " " << beta << " " << gam << "\n"; ***
/********** Creat Rotation with pre-defiend grid of orientations**********
/
/
/********** Creat Rotation with pre-defiend grid of orientations**********
rotmat
[
0
][
0
]
=
cos
(
gam
)
*
cos
(
alpha
)
-
cos
(
beta
)
*
sin
(
alpha
)
*
sin
(
gam
);
rotmat
[
0
][
1
]
=
cos
(
gam
)
*
sin
(
alpha
)
+
cos
(
beta
)
*
cos
(
alpha
)
*
sin
(
gam
);
...
...
@@ -475,7 +485,7 @@ int bioem::createProjection(int iMap,mycomplex_t* mapFFT)
int
i
,
j
;
/************ Projection over the Z axis********************
/
/
/************ Projection over the Z axis********************
for
(
int
n
=
0
;
n
<
Model
.
nPointsModel
;
n
++
)
{
//Getting pixel that represents coordinates & shifting the start at to Numpix/2,Numpix/2 )
...
...
@@ -485,7 +495,7 @@ int bioem::createProjection(int iMap,mycomplex_t* mapFFT)
localproj
[
i
*
param
.
param_device
.
NumberPixels
+
j
]
+=
Model
.
densityPointsModel
[
n
]
/
Model
.
NormDen
;
}
/**** Output Just to check****
/
/
/**** Output Just to check****
if
(
iMap
==
10
)
{
ofstream
myexamplemap
;
...
...
@@ -503,8 +513,8 @@ int bioem::createProjection(int iMap,mycomplex_t* mapFFT)
myexampleRot
.
close
();
}
/***** Converting projection to Fourier Space for Convolution later with kernel****
/
/********** Omp Critical is necessary with FFTW*******
/
/
/***** Converting projection to Fourier Space for Convolution later with kernel****
/
/********** Omp Critical is necessary with FFTW*******
myfftw_execute_dft_r2c
(
param
.
fft_plan_r2c_forward
,
localproj
,
mapFFT
);
return
(
0
);
...
...
@@ -512,18 +522,18 @@ int bioem::createProjection(int iMap,mycomplex_t* mapFFT)
int
bioem
::
createConvolutedProjectionMap
(
int
iMap
,
int
iConv
,
mycomplex_t
*
lproj
,
bioem_map
&
Mapconv
,
mycomplex_t
*
localmultFFT
,
myfloat_t
&
sumC
,
myfloat_t
&
sumsquareC
)
{
/**************************************************************************************
/
/**** BioEM Create Convoluted Projection Map routine, multiplies in Fourier **********
**************** calculated Projection with convoluted precalculated Kernel**********
*************** and Backtransforming it to real Space ******************************
/
/**************************************************************************************
/
/
/**************************************************************************************
/
/**** BioEM Create Convoluted Projection Map routine, multiplies in Fourier **********
//
**************** calculated Projection with convoluted precalculated Kernel**********
//
*************** and Backtransforming it to real Space ******************************
/
/**************************************************************************************
myfloat_t
*
localconvFFT
;
localconvFFT
=
(
myfloat_t
*
)
myfftw_malloc
(
sizeof
(
myfloat_t
)
*
param
.
param_device
.
NumberPixels
*
param
.
param_device
.
NumberPixels
);
mycomplex_t
*
tmp
;
tmp
=
(
mycomplex_t
*
)
myfftw_malloc
(
sizeof
(
mycomplex_t
)
*
param
.
param_device
.
NumberPixels
*
param
.
param_device
.
NumberFFTPixels1D
);
/**** Multiplying FFTmap with corresponding kernel ****
/
/
/**** Multiplying FFTmap with corresponding kernel ****
const
mycomplex_t
*
refCTF
=
&
param
.
refCTF
[
iConv
*
param
.
RefMapSize
];
for
(
int
i
=
0
;
i
<
param
.
param_device
.
NumberPixels
*
param
.
param_device
.
NumberFFTPixels1D
;
i
++
)
...
...
@@ -536,10 +546,10 @@ int bioem::createConvolutedProjectionMap(int iMap,int iConv,mycomplex_t* lproj,b
//FFTW_C2R will destroy the input array, so we have to work on a copy here
memcpy
(
tmp
,
localmultFFT
,
sizeof
(
mycomplex_t
)
*
param
.
param_device
.
NumberPixels
*
param
.
param_device
.
NumberFFTPixels1D
);
/**** Bringing convoluted Map to real Space ****
/
/
/**** Bringing convoluted Map to real Space ****
myfftw_execute_dft_c2r
(
param
.
fft_plan_c2r_backward
,
tmp
,
localconvFFT
);
/****Asigning convolution fftw_complex to bioem_map ****
/
/
/****Asigning convolution fftw_complex to bioem_map ****
for
(
int
i
=
0
;
i
<
param
.
param_device
.
NumberPixels
;
i
++
)
{
for
(
int
j
=
0
;
j
<
param
.
param_device
.
NumberPixels
;
j
++
)
...
...
@@ -548,7 +558,7 @@ int bioem::createConvolutedProjectionMap(int iMap,int iConv,mycomplex_t* lproj,b
}
}
/*** Calculating Cross-correlations of cal-convoluted map with its self *****
/
/
/*** Calculating Cross-correlations of cal-convoluted map with its self *****
sumC
=
0
;
sumsquareC
=
0
;
for
(
int
i
=
0
;
i
<
param
.
param_device
.
NumberPixels
*
param
.
param_device
.
NumberPixels
;
i
++
)
...
...
@@ -556,14 +566,14 @@ int bioem::createConvolutedProjectionMap(int iMap,int iConv,mycomplex_t* lproj,b
sumC
+=
localconvFFT
[
i
];
sumsquareC
+=
localconvFFT
[
i
]
*
localconvFFT
[
i
];
}
/*** The DTF gives an unnormalized value so have to divded by the total number of pixels in Fourier ***
/
/
/*** The DTF gives an unnormalized value so have to divded by the total number of pixels in Fourier ***
// Normalizing
myfloat_t
norm2
=
(
myfloat_t
)
(
param
.
param_device
.
NumberPixels
*
param
.
param_device
.
NumberPixels
);
myfloat_t
norm4
=
norm2
*
norm2
;
sumC
=
sumC
/
norm2
;
sumsquareC
=
sumsquareC
/
norm4
;
/**** Freeing fftw_complex created (dont know if omp critical is necessary) ****
/
/
/**** Freeing fftw_complex created (dont know if omp critical is necessary) ****
myfftw_free
(
localconvFFT
);
myfftw_free
(
tmp
);
...
...
@@ -572,7 +582,7 @@ int bioem::createConvolutedProjectionMap(int iMap,int iConv,mycomplex_t* lproj,b
int
bioem
::
calcross_cor
(
bioem_map
&
localmap
,
myfloat_t
&
sum
,
myfloat_t
&
sumsquare
)
{
/*********************** Routine to calculate Cross correlations***********************
/
/
/*********************** Routine to calculate Cross correlations***********************
sum
=
0.0
;
sumsquare
=
0.0
;
...
...
main.cpp
View file @
0392963f
...
...
@@ -21,9 +21,9 @@
int
main
(
int
argc
,
char
*
argv
[])
{
/
*
*************************************************************************************
/
/********************************* Main BioEM code **********************************
/
/************************************************************************************
/
/
/
*************************************************************************************
/
/********************************* Main BioEM code **********************************
/
/*
************************************************************************************
#pragma omp parallel
{
...
...
@@ -43,17 +43,17 @@ int main(int argc, char* argv[])
bio
=
new
bioem
;
}
/************ Configuration and Pre-calculating necessary objects *****************
/
/
/************ Configuration and Pre-calculating necessary objects *****************
****
printf
(
"Configuring
\n
"
);
bio
->
configure
(
argc
,
argv
);
/******************************* Run BioEM routine ******************************
/
/
/******************************* Run BioEM routine ******************************
******
printf
(
"Running
\n
"
);
timer
.
Start
();
bio
->
run
();
timer
.
Stop
();
/************************************ End **********************************
/
/
/************************************ End **********************************
*************
printf
(
"The code ran for %f seconds.
\n
"
,
timer
.
GetElapsedTime
());
delete
bio
;
...
...
map.cpp
View file @
0392963f
...
...
@@ -13,9 +13,9 @@ using namespace std;
int
bioem_RefMap
::
readRefMaps
(
bioem_param
&
param
)
{
/**************************************************************************************
/
/***********************Reading reference Particle Maps************************
/
/**************************************************************************************
/
/
/**************************************************************************************
/
/***********************Reading reference Particle Maps************************
/
/**************************************************************************************
if
(
loadMap
)
{
FILE
*
fp
=
fopen
(
"maps.dump"
,
"rb"
);
...
...
@@ -34,7 +34,7 @@ int bioem_RefMap::readRefMaps(bioem_param& param)
fclose
(
fp
);
cout
<<
"Particle Maps read from Map Dump
\n
Total Number of particles: "
<<
ntotRefMap
;
cout
<<
"
\n
+++++++++++++++++++++++++++++++++++++++
++
\n
"
;
cout
<<
"
\n
+++++++++++++++++++++++++++++++++++++++
\n
"
;
}
else
{
...
...
@@ -79,11 +79,13 @@ int bioem_RefMap::readRefMaps(bioem_param& param)
for
(
int
i
=
3
;
i
<
100
;
i
++
)
mapname
[
i
]
=
{
0
};
}
cout
<<
"
\n
+++++++++++++++++++++++++++++++++++++++++++
\n
"
;
cout
<<
"Particle Maps read from MULTIPLE MRC Files in: "
<<
filemap
<<
"
\n
"
;
}
else
{
read_MRC
(
filemap
,
param
);
cout
<<
"
\n
++++++++++++++++++++++++++++++++++++++++++
\n
"
;
cout
<<
"Particle Maps read from ONE MRC File: "
<<
filemap
<<
"
\n
"
;
}
...
...
@@ -160,6 +162,7 @@ int bioem_RefMap::readRefMaps(bioem_param& param)
}
cout
<<
"."
;
ntotRefMap
=
nummap
+
1
;
cout
<<
"
\n
++++++++++++++++++++++++++++++++++++++++++
\n
"
;
cout
<<
"Particle Maps read from Standard File
\n
"
;
}
cout
<<
"Total Number of particles: "
<<
ntotRefMap
;
...
...
@@ -184,9 +187,9 @@ int bioem_RefMap::readRefMaps(bioem_param& param)
int
bioem_RefMap
::
PreCalculateMapsFFT
(
bioem_param
&
param
)
{
/**************************************************************************************
/
/********** Routine that pre-calculates Kernels for Convolution **********************
/
/************************************************************************************
/
/
/**************************************************************************************
/
/********** Routine that pre-calculates Kernels for Convolution **********************
*
/
/**
************************************************************************************
myfloat_t
*
localMap
;
...
...
@@ -249,7 +252,7 @@ int bioem_RefMap::read_MRC(const char* filename,bioem_param& param)
n_range_viol1
=
test_mrc
(
filename
,
1
);
if
(
n_range_viol0
<
n_range_viol1
)
{
/* guess endianism
*/
if
(
n_range_viol0
<
n_range_viol1
)
{
/
/* guess endianism
swap
=
0
;
if
(
n_range_viol0
>
0
)
{
printf
(
" Warning: %i header field range violations detected in file %s
\n
"
,
n_range_viol0
,
filename
);
...
...
@@ -260,7 +263,7 @@ int bioem_RefMap::read_MRC(const char* filename,bioem_param& param)
printf
(
"Warning: %i header field range violations detected in file %s
\n
"
,
n_range_viol1
,
filename
);
}
}
printf
(
"
+++
+++++++++++++++++++++++++++++++++++++++++++
\n
"
);
printf
(
"
\n
+++++++++++++++++++++++++++++++++++++++++++
\n
"
);
printf
(
"Reading Information from MRC: %s
\n
"
,
filename
);
header_ok
*=
read_int
(
&
nc
,
fin
,
swap
);
header_ok
*=
read_int
(
&
nr
,
fin
,
swap
);
...
...
@@ -291,8 +294,8 @@ int bioem_RefMap::read_MRC(const char* filename,bioem_param& param)
printf
(
"Number Columns = %8d
\n
"
,
nc
);
printf
(
"Number Rows = %8d
\n
"
,
nr
);
printf
(
"Number Sections = %8d
\n
"
,
ns
);
printf
(
"MODE = %
8d
(only data type mode 2: 32-bit)
\n
"
,
mode
);
printf
(
"NSYMBT = %
8d
(# bytes symmetry operators)
\n
"
,
nsymbt
);
printf
(
"MODE = %
4d
(only data type mode 2: 32-bit)
\n
"
,
mode
);
printf
(
"NSYMBT = %
4d
(# bytes symmetry operators)
\n
"
,
nsymbt
);
/* printf(" NCSTART = %8d (index of first column, counting from 0)\n",ncstart);
printf("> NRSTART = %8d (index of first row, counting from 0)\n",nrstart);
...
...
@@ -444,7 +447,7 @@ int bioem_RefMap::test_mrc (const char *vol_file, int swap) {
exit
(
1
);
}
/* read header info
*/
/
/* read header info
header_ok
*=
read_int
(
&
nc
,
fin
,
swap
);
header_ok
*=
read_int
(
&
nr
,
fin
,
swap
);
header_ok
*=
read_int
(
&
ns
,
fin
,
swap
);
...
...
model.cpp
View file @
0392963f
...
...
@@ -11,9 +11,9 @@ using namespace std;
int
bioem_model
::
readModel
()
{
/**************************************************************************************
/
/***************Reading reference Models either PDB or x,y,z,r,d format****************
/
/**************************************************************************************
/
/
/**************************************************************************************
/
/***************Reading reference Models either PDB or x,y,z,r,d format****************
/
/**************************************************************************************
ofstream
exampleReadCoor
;
exampleReadCoor
.
open
(
"COORDREAD"
);
...
...
@@ -110,7 +110,7 @@ int bioem_model::readModel()
}
nPointsModel
=
numres
;
cout
<<
"Protein structure read from PDB
\n
Total Number of Residues "
<<
nPointsModel
;
cout
<<
"
\n
+++++++++++++++++++++++++++++++++++++++++
\n
"
;
}
else
//Reading model from FILE FORMAT x,y,z,rad,density
{
...
...
@@ -140,8 +140,8 @@ int bioem_model::readModel()
numres
++
;
}
nPointsModel
=
numres
;
cout
<<
"Protein structure read from Standard File
\n
Total Number of
Residue
s "
<<
nPointsModel
;
cout
<<
"
\n
+++++++++++++++++++++++++++++++++++++++++
\n
"
;
cout
<<
"Protein structure read from Standard File
\n
Total Number of
Voxel
s "
<<
nPointsModel
;
}
}
exampleReadCoor
.
close
();
...
...
@@ -173,7 +173,7 @@ int bioem_model::readModel()
myfloat_t
bioem_model
::
getAminoAcidRad
(
char
*
name
)
{
/
*
************** Function that gets the radius for each amino acid ****************
/
/
/
************** Function that gets the radius for each amino acid ****************
myfloat_t
iaa
=
0
;
if
(
std
::
strcmp
(
name
,
"CYS"
)
==
0
)
iaa
=
2.75
;
...
...
@@ -208,7 +208,7 @@ myfloat_t bioem_model::getAminoAcidRad(char *name)
myfloat_t
bioem_model
::
getAminoAcidDensity
(
char
*
name
)
{
/
*
************** Function that gets the number of electrons for each amino acid ****************
/
/
/
************** Function that gets the number of electrons for each amino acid ****************
myfloat_t
iaa
=
0.0
;
if
(
std
::
strcmp
(
name
,
"CYS"
)
==
0
)
iaa
=
64.0
;
...
...
param.cpp
View file @
0392963f
...
...
@@ -25,7 +25,7 @@ bioem_param::bioem_param()
numberGridPointsCTF_amp
=
0
;
numberGridPointsCTF_phase
=
0
;
/****center displacement paramters Equal in both directions***
/
/
/****center displacement paramters Equal in both directions***
param_device
.
maxDisplaceCenter
=
0
;
numberGridPointsDisplaceCenter
=
0
;
...
...
@@ -41,6 +41,25 @@ 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
())
{
...
...
@@ -51,10 +70,10 @@ int bioem_param::readParameters()
char
line
[
512
]
=
{
0
};
char
saveline
[
512
];
cout
<<
"
\n
+++++++++++++++++++++++++++++++++++++++++
\n
"
;
cout
<<
"
\n
READING PARAMETERS
\n\n
"
;
cout
<<
"
\n
++
+++++++++++++++++++++++++++++++++++++++++
\n
"
;
cout
<<
"
\n
READING PARAMETERS
\n\n
"
;
cout
<<
"
+++++++++++++++++++++++++++++++++++++++++
\n
"
;
cout
<<
"
++
+++++++++++++++++++++++++++++++++++++++++
\n
"
;
while
(
!
input
.
eof
())
{
input
.
getline
(
line
,
512
);
...
...
@@ -69,105 +88,125 @@ int bioem_param::readParameters()
{
token
=
strtok
(
NULL
,
" "
);
pixelSize
=
atof
(
token
);
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
));
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
));
angleGridPointsBeta
=
int
(
atoi
(
token
));
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
));
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
);
if
(
startGridEnvelop
<
0
)
{
cout
<<
"*** Error: Negative START_ENVELOPE "
;
exit
(
1
);}
cout
<<
"Start Envelope "
<<
startGridEnvelop
<<
"
\n
"
;
yesSTEnv
=
true
;
}