Xmipp  v3.23.11-Nereus
Classes | Functions
Collaboration diagram for PDB:

Classes

struct  pdbInfo
 
class  Atom
 
class  PDBPhantom
 
class  RichAtom
 
class  PDBRichPhantom
 
class  AtomInterpolator
 

Functions

int atomCharge (const std::string &atom)
 
double atomRadius (const std::string &atom)
 
double atomCovalentRadius (const std::string &atom)
 
void computePDBgeometry (const std::string &fnPDB, Matrix1D< double > &centerOfMass, Matrix1D< double > &limit0, Matrix1D< double > &limitF, const std::string &intensityColumn)
 
void applyGeometryToPDBFile (const std::string &fn_in, const std::string &fn_out, const Matrix2D< double > &A, bool centerPDB=true, const std::string &intensityColumn="occupancy")
 
void analyzePDBAtoms (const FileName &fn_pdb, const std::string &typeOfAtom, int &numberOfAtoms, pdbInfo &at_pos)
 
void atomDescriptors (const std::string &atom, Matrix1D< double > &descriptors)
 
double electronFormFactorFourier (double f, const Matrix1D< double > &descriptors)
 
double electronFormFactorRealSpace (double r, const Matrix1D< double > &descriptors)
 
void atomRadialProfile (int M, double T, const std::string &atom, Matrix1D< double > &profile)
 
void atomProjectionRadialProfile (int M, const Matrix1D< double > &profileCoefficients, Matrix1D< double > &projectionProfile)
 
void projectPDB (const PDBPhantom &phantomPDB, const AtomInterpolator &interpolator, Projection &proj, int Ydim, int Xdim, double rot, double tilt, double psi)
 
void distanceHistogramPDB (const PDBPhantom &phantomPDB, size_t Nnearest, double maxDistance, int Nbins, Histogram1D &hist)
 

Detailed Description

Function Documentation

◆ analyzePDBAtoms()

void analyzePDBAtoms ( const FileName fn_pdb,
const std::string &  typeOfAtom,
int &  numberOfAtoms,
pdbInfo at_pos 
)

ANALYZEPDBDATA takes as input a filename of a pdb file (atomic model) and selects only the typeOfAtom, (for instance the C-alpha atoms) storing the atom positions, b- factor, the residue of each atom, and the covalent radiues in a struct vector at_pos. Also the number of atoms is kept.

Definition at line 64 of file pdb.cpp.

65 {
66  //Open the pdb file
67  std::ifstream f2parse;
68  f2parse.open(fn_pdb.c_str());
69 
70  numberOfAtoms = 0;
71 
72  // Initializing and reading pdb file
73  PDBRichPhantom pdbFile;
74 
75  // Read centered pdb
76  pdbFile.read(fn_pdb.c_str());
77 
78  // For each atom, store necessary info if type matches
79  for (auto& atom : pdbFile.atomList) {
80  if (atom.name == typeOfAtom) {
81  numberOfAtoms++;
82 
83  // Storing coordinates
84  at_pos.x.push_back(atom.x);
85  at_pos.y.push_back(atom.y);
86  at_pos.z.push_back(atom.z);
87  at_pos.chain.push_back(std::string(1, atom.chainid));
88 
89  // Residue Number
90  at_pos.residue.push_back(atom.resseq);
91 
92  // Getting the bfactor = 8pi^2*u
93  at_pos.b.push_back(atom.bfactor); //sqrt(atom.bfactor/(8*PI*PI));
94 
95  // Covalent radius of the atom
96  at_pos.atomCovRad.push_back(atomCovalentRadius(atom.name));
97  }
98  }
99 }
void read(const FileName &fnPDB, const bool pseudoatoms=false, const double threshold=0.0)
Read rich phantom from either a PDB of CIF file.
Definition: pdb.cpp:704
std::vector< double > z
Definition: pdb.h:95
std::vector< std::string > chain
Definition: pdb.h:97
std::vector< double > x
Definition: pdb.h:93
std::vector< double > b
Definition: pdb.h:96
std::vector< double > y
Definition: pdb.h:94
std::vector< int > residue
Definition: pdb.h:98
std::vector< RichAtom > atomList
List of atoms.
Definition: pdb.h:257
std::vector< double > atomCovRad
Definition: pdb.h:99
double atomCovalentRadius(const std::string &atom)
Definition: pdb.cpp:214

◆ applyGeometryToPDBFile()

void applyGeometryToPDBFile ( const std::string &  fn_in,
const std::string &  fn_out,
const Matrix2D< double > &  A,
bool  centerPDB = true,
const std::string &  intensityColumn = "occupancy" 
)

Apply geometry transformation to an input PDB. The result is written in the output PDB. Set centerPDB if you want to compute the center of mass first and apply the transformation after centering the PDB.

Definition at line 294 of file pdb.cpp.

297 {
298  Matrix1D<double> centerOfMass;
299  Matrix1D<double> limit0;
300  Matrix1D<double> limitF;
301  if (centerPDB)
302  {
303  computePDBgeometry(fn_in, centerOfMass,limit0, limitF,
304  intensityColumn);
305  limit0 -= centerOfMass;
306  limitF -= centerOfMass;
307  }
308 
309  // Open files
310  std::ifstream fh_in;
311  fh_in.open(fn_in.c_str());
312  if (!fh_in)
314  std::ofstream fh_out;
315  fh_out.open(fn_out.c_str());
316  if (!fh_out)
317  REPORT_ERROR(ERR_IO_NOWRITE, fn_out);
318 
319  // Process all lines of the file
320  while (!fh_in.eof())
321  {
322  // Read an ATOM line
323  std::string line;
324  getline(fh_in, line);
325  if (line == "")
326  {
327  fh_out << "\n";
328  continue;
329  }
330  std::string kind = line.substr(0,4);
331  if (kind != "ATOM" && kind != "HETA")
332  {
333  fh_out << line << std::endl;
334  continue;
335  }
336 
337  // Extract atom type and position
338  // Typical line:
339  // ATOM 909 CA ALA A 161 58.775 31.984 111.803 1.00 34.78
340  double x = textToFloat(line.substr(30,8));
341  double y = textToFloat(line.substr(38,8));
342  double z = textToFloat(line.substr(46,8));
343 
344  Matrix1D<double> v(4);
345  if (centerPDB)
346  {
347  VECTOR_R3(v,x-XX(centerOfMass),
348  y-YY(centerOfMass),z-ZZ(centerOfMass));
349  }
350  else
351  {
352  VECTOR_R3(v,x,y,z);
353  }
354  v(3)=1;
355  v=A*v;
356 
357  char aux[15];
358  sprintf(aux,"%8.3f",XX(v));
359  line.replace(30,8,aux);
360  sprintf(aux,"%8.3f",YY(v));
361  line.replace(38,8,aux);
362  sprintf(aux,"%8.3f",ZZ(v));
363  line.replace(46,8,aux);
364 
365  fh_out << line << std::endl;
366  }
367 
368  // Close files
369  fh_in.close();
370  fh_out.close();
371 }
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
static double * y
Couldn&#39;t write to file.
Definition: xmipp_error.h:140
doublereal * x
#define XX(v)
Definition: matrix1d.h:85
float textToFloat(const char *str)
void computePDBgeometry(const std::string &fnPDB, Matrix1D< double > &centerOfMass, Matrix1D< double > &limit0, Matrix1D< double > &limitF, const std::string &intensityColumn)
Definition: pdb.cpp:238
double z
File or directory does not exist.
Definition: xmipp_error.h:136
#define YY(v)
Definition: matrix1d.h:93
#define VECTOR_R3(v, x, y, z)
Definition: matrix1d.h:124
#define ZZ(v)
Definition: matrix1d.h:101

◆ atomCharge()

int atomCharge ( const std::string &  atom)

Returns the charge of an atom. Returns 0 if the atom is not within the short list (H, C, N, O, S, P, Fe) of valid atoms.

Definition at line 122 of file pdb.cpp.

123 {
124  switch (atom[0])
125  {
126  case 'H':
127  return 1;
128  break;
129  case 'C':
130  return 6;
131  break;
132  case 'N':
133  return 7;
134  break;
135  case 'O':
136  return 8;
137  break;
138  case 'P':
139  return 15;
140  break;
141  case 'S':
142  return 16;
143  break;
144  case 'E': // Iron Fe
145  return 26;
146  break;
147  case 'K':
148  return 19;
149  break;
150  case 'F':
151  return 9;
152  break;
153  case 'G': // Magnesium Mg
154  return 12;
155  break;
156  case 'L': // Chlorine Cl
157  return 17;
158  break;
159  case 'A': // Calcium Ca
160  return 20;
161  break;
162  default:
163  return 0;
164  }
165 }

◆ atomCovalentRadius()

double atomCovalentRadius ( const std::string &  atom)

Returns the covalent radius of an atom. Returns 0 if the atom is not within the short list (H, C, N, O, S, P, Fe) of valid atoms. The radius data is taken from http://www.webelements.com as the empirical radius.

Definition at line 214 of file pdb.cpp.

215 {
216  switch (atom[0])
217  {
218  case 'H':
219  return 0.38;
220  case 'C':
221  return 0.77;
222  case 'N':
223  return 0.75;
224  case 'O':
225  return 0.73;
226  case 'P':
227  return 1.06;
228  case 'S':
229  return 1.02;
230  case 'F': // Iron
231  return 1.25;
232  default:
233  return 0;
234  }
235 }

◆ atomDescriptors()

void atomDescriptors ( const std::string &  atom,
Matrix1D< double > &  descriptors 
)

Description of the electron scattering factors. The returned descriptor is descriptor(0)=Z (number of electrons of the atom), descriptor(1-5)=a1-5, descriptor(6-10)=b1-5. The electron scattering factor at a frequency f (Angstroms^-1) is computed as f_el(f)=sum_i(ai exp(-bi*x^2)). Use the function electronFormFactorFourier or

See Peng, Ren, Dudarev, Whelan. Robust parameterization of elastic and absorptive electron atomic scattering factors. Acta Cryst. A52: 257-276 (1996). Table 3 and equation 3.

Definition at line 883 of file pdb.cpp.

884 {
885  descriptors.initZeros(11);
886  if (atom=="H")
887  {
888  descriptors( 0)= 1; // Z
889  descriptors( 1)= 0.0088; // a1
890  descriptors( 2)= 0.0449; // a2
891  descriptors( 3)= 0.1481; // a3
892  descriptors( 4)= 0.2356; // a4
893  descriptors( 5)= 0.0914; // a5
894  descriptors( 6)= 0.1152; // b1
895  descriptors( 7)= 1.0867; // b2
896  descriptors( 8)= 4.9755; // b3
897  descriptors( 9)=16.5591; // b4
898  descriptors(10)=43.2743; // b5
899  }
900  else if (atom=="C")
901  {
902  descriptors( 0)= 6; // Z
903  descriptors( 1)= 0.0489; // a1
904  descriptors( 2)= 0.2091; // a2
905  descriptors( 3)= 0.7537; // a3
906  descriptors( 4)= 1.1420; // a4
907  descriptors( 5)= 0.3555; // a5
908  descriptors( 6)= 0.1140; // b1
909  descriptors( 7)= 1.0825; // b2
910  descriptors( 8)= 5.4281; // b3
911  descriptors( 9)=17.8811; // b4
912  descriptors(10)=51.1341; // b5
913  }
914  else if (atom=="N")
915  {
916  descriptors( 0)= 7; // Z
917  descriptors( 1)= 0.0267; // a1
918  descriptors( 2)= 0.1328; // a2
919  descriptors( 3)= 0.5301; // a3
920  descriptors( 4)= 1.1020; // a4
921  descriptors( 5)= 0.4215; // a5
922  descriptors( 6)= 0.0541; // b1
923  descriptors( 7)= 0.5165; // b2
924  descriptors( 8)= 2.8207; // b3
925  descriptors( 9)=10.6297; // b4
926  descriptors(10)=34.3764; // b5
927  }
928  else if (atom=="O")
929  {
930  descriptors( 0)= 8; // Z
931  descriptors( 1)= 0.0365; // a1
932  descriptors( 2)= 0.1729; // a2
933  descriptors( 3)= 0.5805; // a3
934  descriptors( 4)= 0.8814; // a4
935  descriptors( 5)= 0.3121; // a5
936  descriptors( 6)= 0.0652; // b1
937  descriptors( 7)= 0.6184; // b2
938  descriptors( 8)= 2.9449; // b3
939  descriptors( 9)= 9.6298; // b4
940  descriptors(10)=28.2194; // b5
941  }
942  else if (atom=="P")
943  {
944  descriptors( 0)=15; // Z
945  descriptors( 1)= 0.1005; // a1
946  descriptors( 2)= 0.4615; // a2
947  descriptors( 3)= 1.0663; // a3
948  descriptors( 4)= 2.5854; // a4
949  descriptors( 5)= 1.2725; // a5
950  descriptors( 6)= 0.0977; // b1
951  descriptors( 7)= 0.9084; // b2
952  descriptors( 8)= 4.9654; // b3
953  descriptors( 9)=18.5471; // b4
954  descriptors(10)=54.3648; // b5
955  }
956  else if (atom=="S")
957  {
958  descriptors( 0)=16; // Z
959  descriptors( 1)= 0.0915; // a1
960  descriptors( 2)= 0.4312; // a2
961  descriptors( 3)= 1.0847; // a3
962  descriptors( 4)= 2.4671; // a4
963  descriptors( 5)= 1.0852; // a5
964  descriptors( 6)= 0.0838; // b1
965  descriptors( 7)= 0.7788; // b2
966  descriptors( 8)= 4.3462; // b3
967  descriptors( 9)=15.5846; // b4
968  descriptors(10)=44.6365; // b5
969  }
970  else if (atom=="Fe")
971  {
972  descriptors( 0)=26; // Z
973  descriptors( 1)= 0.1929; // a1
974  descriptors( 2)= 0.8239; // a2
975  descriptors( 3)= 1.8689; // a3
976  descriptors( 4)= 2.3694; // a4
977  descriptors( 5)= 1.9060; // a5
978  descriptors( 6)= 0.1087; // b1
979  descriptors( 7)= 1.0806; // b2
980  descriptors( 8)= 4.7637; // b3
981  descriptors( 9)=22.8500; // b4
982  descriptors(10)=76.7309; // b5
983  }
984  else if (atom=="K")
985  {
986  descriptors( 0)=19; // Z
987  descriptors( 1)= 0.2149; // a1
988  descriptors( 2)= 0.8703; // a2
989  descriptors( 3)= 2.4999; // a3
990  descriptors( 4)= 2.3591; // a4
991  descriptors( 5)= 3.0318; // a5
992  descriptors( 6)= 0.1660; // b1
993  descriptors( 7)= 1.6906; // b2
994  descriptors( 8)= 8.7447; // b3
995  descriptors( 9)=46.7825; // b4
996  descriptors(10)=165.6923; // b5
997  }
998  else if (atom=="F")
999  {
1000  descriptors( 0)=9; // Z
1001  descriptors( 1)= 0.0382; // a1
1002  descriptors( 2)= 0.1822; // a2
1003  descriptors( 3)= 0.5972; // a3
1004  descriptors( 4)= 0.7707; // a4
1005  descriptors( 5)= 0.2130; // a5
1006  descriptors( 6)= 0.0613; // b1
1007  descriptors( 7)= 0.5753; // b2
1008  descriptors( 8)= 2.6858; // b3
1009  descriptors( 9)= 8.8214; // b4
1010  descriptors(10)=25.6668; // b5
1011  }
1012  else if (atom=="Mg")
1013  {
1014  descriptors( 0)=12; // Z
1015  descriptors( 1)= 0.1130; // a1
1016  descriptors( 2)= 0.5575; // a2
1017  descriptors( 3)= 0.9046; // a3
1018  descriptors( 4)= 2.1580; // a4
1019  descriptors( 5)= 1.4735; // a5
1020  descriptors( 6)= 0.1356; // b1
1021  descriptors( 7)= 1.3579; // b2
1022  descriptors( 8)= 6.9255; // b3
1023  descriptors( 9)=32.3165; // b4
1024  descriptors(10)=92.1138; // b5
1025  }
1026  else if (atom=="Cl")
1027  {
1028  descriptors( 0)=17; // Z
1029  descriptors( 1)= 0.0799; // a1
1030  descriptors( 2)= 0.3891; // a2
1031  descriptors( 3)= 1.0037; // a3
1032  descriptors( 4)= 2.3332; // a4
1033  descriptors( 5)= 1.0507; // a5
1034  descriptors( 6)= 0.0694; // b1
1035  descriptors( 7)= 0.6443; // b2
1036  descriptors( 8)= 3.5351; // b3
1037  descriptors( 9)=12.5058; // b4
1038  descriptors(10)=35.8633; // b5
1039  }
1040  else if (atom=="Ca")
1041  {
1042  descriptors( 0)=20; // Z
1043  descriptors( 1)= 0.2355; // a1
1044  descriptors( 2)= 0.9916; // a2
1045  descriptors( 3)= 2.3959; // a3
1046  descriptors( 4)= 3.7252; // a4
1047  descriptors( 5)= 2.5647; // a5
1048  descriptors( 6)= 0.1742; // b1
1049  descriptors( 7)= 1.8329; // b2
1050  descriptors( 8)= 8.8407; // b3
1051  descriptors( 9)=47.4583; // b4
1052  descriptors(10)=134.9613; // b5
1053  }
1054  else
1055  REPORT_ERROR(ERR_VALUE_INCORRECT,(std::string)"atomDescriptors: Unknown atom "+atom);
1056 }
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
void initZeros()
Definition: matrix1d.h:592
Incorrect value received.
Definition: xmipp_error.h:195

◆ atomProjectionRadialProfile()

void atomProjectionRadialProfile ( int  M,
const Matrix1D< double > &  profileCoefficients,
Matrix1D< double > &  projectionProfile 
)

Atom projection radial profile. Returns the radial profile of the atom described by its profileCoefficients (Bspline coefficients).

◆ atomRadialProfile()

void atomRadialProfile ( int  M,
double  T,
const std::string &  atom,
Matrix1D< double > &  profile 
)

Atom radial profile. Returns the radial profile of a given atom, i.e., the electron scattering factor convolved with a suitable low pass filter for sampling the volume at a sampling rate M*T. The radial profile is sampled at T Angstroms/pixel.

◆ atomRadius()

double atomRadius ( const std::string &  atom)

Returns the radius of an atom. Returns 0 if the atom is not within the short list (H, C, N, O, S, P, Fe) of valid atoms.

The radius data is taken from http://www.webelements.com as the empirical radius.

Definition at line 168 of file pdb.cpp.

169 {
170  switch (atom[0])
171  {
172  case 'H':
173  return 0.25;
174  break;
175  case 'C':
176  return 0.70;
177  break;
178  case 'N':
179  return 0.65;
180  break;
181  case 'O':
182  return 0.60;
183  break;
184  case 'P':
185  return 1.00;
186  break;
187  case 'S':
188  return 1.00;
189  break;
190  case 'E': // Iron Fe
191  return 1.40;
192  break;
193  case 'K':
194  return 2.20;
195  break;
196  case 'F':
197  return 0.50;
198  break;
199  case 'G': // Magnesium Mg
200  return 1.50;
201  break;
202  case 'L': // Chlorine Cl
203  return 1.00;
204  break;
205  case 'A': // Calcium Ca
206  return 1.80;
207  break;
208  default:
209  return 0;
210  }
211 }

◆ computePDBgeometry()

void computePDBgeometry ( const std::string &  fnPDB,
Matrix1D< double > &  centerOfMass,
Matrix1D< double > &  limit0,
Matrix1D< double > &  limitF,
const std::string &  intensityColumn 
)

Compute the center of mass and limits of a PDB file. The intensity column is used only for the pseudoatoms. It specifies from which column we should read the intensity. Valid columns are Bfactor or occupancy.

Definition at line 238 of file pdb.cpp.

242 {
243  // Initialization
244  centerOfMass.initZeros(3);
245  limit0.resizeNoCopy(3);
246  limitF.resizeNoCopy(3);
247  limit0.initConstant(1e30);
248  limitF.initConstant(-1e30);
249  double total_mass = 0;
250 
251  // Initialize PDBRichPhantom and read atom struct file
252  PDBRichPhantom pdbFile;
253 
254  // Read centered pdb
255  pdbFile.read(fnPDB);
256 
257  // For each atom, correct necessary info
258  bool useBFactor = intensityColumn=="Bfactor";
259  for (auto& atom : pdbFile.atomList) {
260  // Update center of mass and limits
261  XX(limit0) = std::min(XX(limit0), atom.x);
262  YY(limit0) = std::min(YY(limit0), atom.y);
263  ZZ(limit0) = std::min(ZZ(limit0), atom.z);
264 
265  XX(limitF) = std::max(XX(limitF), atom.x);
266  YY(limitF) = std::max(YY(limitF), atom.y);
267  ZZ(limitF) = std::max(ZZ(limitF), atom.z);
268 
269  double weight;
270  if (atom.name == "EN")
271  {
272  if (useBFactor)
273  weight = atom.bfactor;
274  else
275  weight = atom.occupancy;
276  }
277  else
278  {
279  if (atom.record == "HETATM")
280  continue;
281  weight = (double) atomCharge(atom.name);
282  }
283  total_mass += weight;
284  XX(centerOfMass) += weight * atom.x;
285  YY(centerOfMass) += weight * atom.y;
286  ZZ(centerOfMass) += weight * atom.z;
287  }
288 
289  // Finish calculations
290  centerOfMass /= total_mass;
291 }
void min(Image< double > &op1, const Image< double > &op2)
void read(const FileName &fnPDB, const bool pseudoatoms=false, const double threshold=0.0)
Read rich phantom from either a PDB of CIF file.
Definition: pdb.cpp:704
int atomCharge(const std::string &atom)
Definition: pdb.cpp:122
#define XX(v)
Definition: matrix1d.h:85
void max(Image< double > &op1, const Image< double > &op2)
void initZeros()
Definition: matrix1d.h:592
#define YY(v)
Definition: matrix1d.h:93
std::vector< RichAtom > atomList
List of atoms.
Definition: pdb.h:257
void resizeNoCopy(int Xdim)
Definition: matrix1d.h:458
void initConstant(T val)
Definition: matrix1d.cpp:83
#define ZZ(v)
Definition: matrix1d.h:101

◆ distanceHistogramPDB()

void distanceHistogramPDB ( const PDBPhantom phantomPDB,
size_t  Nnearest,
double  maxDistance,
int  Nbins,
Histogram1D hist 
)

Compute distance histogram of a PDB phantom. Consider the distance between each atom and its N nearest neighbours. Then, compute the histogram of these distances with Nbin samples.

Definition at line 1627 of file pdb.cpp.

1628 {
1629  // Compute the histogram of distances
1630  const std::vector<Atom> &atoms=phantomPDB.atomList;
1631  int Natoms=atoms.size();
1632  MultidimArray<double> NnearestDistances;
1633  NnearestDistances.resize((Natoms-1)*Nnearest);
1634  for (int i=0; i<Natoms; i++)
1635  {
1636  std::vector<double> NnearestToThisAtom;
1637  const Atom& atom_i=atoms[i];
1638  for (int j=i+1; j<Natoms; j++)
1639  {
1640  const Atom& atom_j=atoms[j];
1641  double diffx=atom_i.x-atom_j.x;
1642  double diffy=atom_i.y-atom_j.y;
1643  double diffz=atom_i.z-atom_j.z;
1644  double dist=sqrt(diffx*diffx+diffy*diffy+diffz*diffz);
1645  if (maxDistance>0 && dist>maxDistance)
1646  continue;
1647  //std::cout << "Analyzing " << i << " and " << j << " -> d=" << dist << std::endl;
1648  size_t nearestSoFar=NnearestToThisAtom.size();
1649  if (nearestSoFar==0)
1650  {
1651  NnearestToThisAtom.push_back(dist);
1652  //std::cout << "Pushing d" << std::endl;
1653  }
1654  else
1655  {
1656  size_t idx=0;
1657  while (idx<nearestSoFar && NnearestToThisAtom[idx]<dist)
1658  idx++;
1659  if (idx<nearestSoFar)
1660  {
1661  NnearestToThisAtom.insert(NnearestToThisAtom.begin()+idx,1,dist);
1662  if (NnearestToThisAtom.size()>Nnearest)
1663  NnearestToThisAtom.erase(NnearestToThisAtom.begin()+Nnearest);
1664  }
1665  if (idx==nearestSoFar && nearestSoFar<Nnearest)
1666  {
1667  NnearestToThisAtom.push_back(dist);
1668  //std::cout << "Pushing d" << std::endl;
1669  }
1670  }
1671  }
1672  if (i<Natoms-1)
1673  for (size_t k=0; k<Nnearest; k++)
1674  NnearestDistances(i*Nnearest+k)=NnearestToThisAtom[k];
1675  }
1676  compute_hist(NnearestDistances, hist, 0, NnearestDistances.computeMax(), Nbins);
1677 }
double z
Position Z.
Definition: pdb.h:123
void resize(size_t Ndim, size_t Zdim, size_t Ydim, size_t Xdim, bool copy=true)
void sqrt(Image< double > &op)
double x
Position X.
Definition: pdb.h:117
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
void compute_hist(const MultidimArrayGeneric &array, Histogram1D &hist, int no_steps)
Definition: histogram.cpp:572
Definition: pdb.h:110
#define j
double y
Position Y.
Definition: pdb.h:120
std::vector< Atom > atomList
List of atoms.
Definition: pdb.h:131
T computeMax() const

◆ electronFormFactorFourier()

double electronFormFactorFourier ( double  f,
const Matrix1D< double > &  descriptors 
)

Compute the electron Form Factor in Fourier space. The electron scattering factor at a frequency f (Angstroms^-1) is computed as f_el(f)=sum_i(ai exp(-bi*x^2)).

Definition at line 1059 of file pdb.cpp.

1060 {
1061  double retval=0;
1062  for (int i=1; i<=5; i++)
1063  {
1064  double ai=VEC_ELEM(descriptors,i);
1065  double bi=VEC_ELEM(descriptors,i+5);
1066  retval+=ai*exp(-bi*f*f);
1067  }
1068  return retval;
1069 }
#define VEC_ELEM(v, i)
Definition: matrix1d.h:245
#define i
double * f

◆ electronFormFactorRealSpace()

double electronFormFactorRealSpace ( double  r,
const Matrix1D< double > &  descriptors 
)

Compute the electron Form Factor in Real space. Konwing the electron form factor in Fourier space is easy to make an inverse Fourier transform and express it in real space. r is the distance to the center of the atom in Angstroms.

Definition at line 1087 of file pdb.cpp.

1089 {
1090  double retval=0;
1091  for (int i=1; i<=5; i++)
1092  {
1093  double ai=descriptors(i);
1094  double bi=descriptors(i+5);
1095  double b=bi/(4*PI*PI);
1096  retval+=ai*sqrt(PI/b)*exp(-r*r/(4*b));
1097  }
1098  retval/=2*PI;
1099  return retval;
1100 }
void sqrt(Image< double > &op)
#define i
doublereal * b
#define PI
Definition: tools.h:43

◆ projectPDB()

void projectPDB ( const PDBPhantom phantomPDB,
const AtomInterpolator interpolator,
Projection proj,
int  Ydim,
int  Xdim,
double  rot,
double  tilt,
double  psi 
)

Project PDB. Project the PDB following a certain projection direction.

Definition at line 1603 of file pdb.cpp.

1606 {
1607  // Initialise projection
1608  proj().initZeros(Ydim, Xdim);
1609  proj().setXmippOrigin();
1610  proj.setAngles(rot, tilt, psi);
1611 
1612  // Compute volume to Projection matrix
1613  Matrix2D<double> VP = proj.euler;
1614  Matrix2D<double> PV = VP.inv();
1615 
1616  // Project all elements
1617  for (size_t i = 0; i < phantomPDB.getNumberOfAtoms(); i++)
1618  {
1619  try
1620  {
1621  projectAtom(phantomPDB.getAtom(i), proj, VP, PV, interpolator);
1622  }
1623  catch (XmippError &XE) {}
1624  }
1625 }
Matrix2D< double > euler
void inv(Matrix2D< T > &result) const
Definition: matrix2d.cpp:663
#define i
const Atom & getAtom(int i) const
Get Atom at position i.
Definition: pdb.h:143
size_t getNumberOfAtoms() const
Get number of atoms.
Definition: pdb.h:149
double psi(const double x)
void setAngles(double _rot, double _tilt, double _psi)
void projectAtom(const Atom &atom, Projection &P, const Matrix2D< double > &VP, const Matrix2D< double > &PV, const AtomInterpolator &interpolator)
Definition: pdb.cpp:1446