15 #include <basic/Tracer.hh>
16 #include <basic/options/option.hh>
23 #include <basic/options/keys/edensity.OptionKeys.gen.hh>
28 #include <utility/vector1.hh>
35 static basic::Tracer
TR(
"core.scoring.electron_density.xray_scattering");
40 namespace electron_density {
43 inline int pos_mod(
int x,
int y) {
44 int r=x%y;
if (r<0) r+=y;
47 inline float pos_mod(
float x,
float y) {
48 float r=std::fmod(x,y);
if (r<0) r+=y;
51 inline double pos_mod(
double x,
double y) {
52 double r=std::fmod(x,y);
if (r<0) r+=y;
55 inline float square(
float x) {
return (x*x); }
56 inline double square(
double x) {
return (x*x); }
61 static std::map< std::string, OneGaussianScattering > elt_db;
65 if (elt_db.size() == 0) {
79 (
int)(6*basic::options::option[ basic::options::OptionKeys::edensity::centroid_density_mass ]()) , 4.88284);
82 if (elt_db.find( elt ) == elt_db.end()) {
84 TR.Warning <<
"[ WARNING ] Unknown atom " << elt << std::endl;
93 static std::map< std::string, KromerMann > elt_db;
95 if (elt_db.size() == 0) {
96 elt_db[
"C"] =
KromerMann( 0.215600, 2.310000, 1.020000, 1.588600, 0.865000, 20.843899, 10.207500, 0.568700, 51.651199);
97 elt_db[
"N"] =
KromerMann(-11.528999, 12.212600, 3.132200, 2.012500, 1.166300, 0.005700, 9.893300, 28.997499, 0.582600);
98 elt_db[
"O"] =
KromerMann( 0.250800, 3.048500, 2.286800, 1.546300, 0.867000, 13.277100, 5.701100, 0.323900, 32.908897);
99 elt_db[
"F"] =
KromerMann( 0.277600, 3.539200, 2.641200, 1.517000, 1.024300, 10.282499, 4.294400, 0.261500, 26.147600);
100 elt_db[
"NA"] =
KromerMann( 0.676000, 4.762600, 3.173600, 1.267400, 1.112800, 3.285000, 8.842199, 0.313600, 129.423996);
101 elt_db[
"MG"] =
KromerMann( 0.858400, 5.420400, 2.173500, 1.226900, 2.307300, 2.827500, 79.261101, 0.380800, 7.193700);
102 elt_db[
"AL"] =
KromerMann( 1.115100, 6.420200, 1.900200, 1.593600, 1.964600, 3.038700, 0.742600, 31.547199, 85.088600);
103 elt_db[
"P"] =
KromerMann( 1.114900, 6.434500, 4.179100, 1.780000, 1.490800, 1.906700, 27.157000, 0.526000, 68.164497);
104 elt_db[
"S"] =
KromerMann( 0.866900, 6.905300, 5.203400, 1.437900, 1.586300, 1.467900, 22.215099, 0.253600, 56.172001);
105 elt_db[
"K"] =
KromerMann( 1.422800, 8.218599 ,7.439800, 1.051900, 0.865900,12.794900, 0.774800 ,213.186996, 41.684097);
106 elt_db[
"FE"] =
KromerMann( 1.036900, 11.769500, 7.357300, 3.522200, 2.304500, 4.761100, 0.307200, 15.353500, 76.880501 );
110 if (elt_db.find( elt ) == elt_db.end()) {
112 TR.Warning <<
"[ WARNING ] Unknown atom " << elt << std::endl;
115 return elt_db[ elt ];
248 while (X != 1 && X%2 == 0) X /= 2;
249 while (X != 1 && X%3 == 0) X /= 3;
250 while (X != 1 && X%5 == 0) X /= 5;
257 while (X != 1 && X%2 == 0) X /= 2;
258 while (X != 1 && X%3 == 0) X /= 3;
259 while (X != 1 && X%5 == 0) X /= 5;
260 while (X != 1 && X%7 == 0) X /= 7;
261 while (X != 1 && X%11 == 0) X /= 11;
262 while (X != 1 && X%13 == 0) X /= 13;
263 while (X != 1 && X%17 == 0) X /= 17;
264 while (X != 1 && X%19 == 0) X /= 19;
271 if (MINSMP <= 0)
return NMUL;
274 int N = (
int) floor( MINSMP/NMUL + 0.5 ) * NMUL;
285 if (MINSMP <= 0)
return NMUL;
288 int N = (
int) floor( MINSMP/NMUL + 0.5 ) * NMUL;