49 #define G4cout std::cout 
   50 #define G4cerr std::cerr  
   51 #define G4endl std::endl  
   52 #define G4String std::string // string included in PDBatom.hh 
   67     fNbNucleotidsPerStrand(0)
 
   84                         unsigned short int& isDNA,
 
   85                         unsigned short int verbose = 0)
 
   89   infile.open(filename.c_str());
 
   92     G4cout << 
"PDBlib::load >> file " << filename << 
" not found !!!!" 
  103     Atom * AtomicOld = 
nullptr;
 
  104     Atom * AtomicNext = 
nullptr;
 
  113     Residue * residueOld = 
nullptr;
 
  114     Residue * residueFirst = 
nullptr;
 
  115     Residue * residueNext = 
nullptr;
 
  124     double minGlobZ, maxGlobZ;
 
  125     double minGlobX, maxGlobX;
 
  126     double minGlobY, maxGlobY;
 
  127     double minX, maxX, minY, maxY, minZ, maxZ; 
 
  147     unsigned short int numModel = 0;
 
  148     unsigned short int model = 0;
 
  158       getline(infile, sLine);
 
  159       std::size_t found = sLine.find(
"DNA");
 
  160       if(found != G4String::npos)
 
  167       found = sLine.find(
"HEADER");
 
  168       if(found == G4String::npos)
 
  171         infile.open(filename.c_str());
 
  173         G4cout << 
"PDBlib::load >> No header found !!!!" << 
G4endl;
 
  179       getline(infile, sLine);
 
  181       if((sLine.substr(0, 6)).compare(
"NUMMDL") == 0)
 
  183         istringstream((sLine.substr(10, 4))) >> numModel;
 
  185       if((numModel > 0) && ((sLine.substr(0, 6)).compare(
"MODEL ") == 0))
 
  187         istringstream((sLine.substr(10, 4))) >> 
model;
 
  193       if((sLine.substr(0, 6)).compare(
"SEQRES") == 0)
 
  200       if((numModel > 0) && ((sLine.substr(0, 6)).compare(
"ENDMDL") == 0))
 
  204       else if((sLine.substr(0, 6)).compare(
"TER   ") == 0) 
 
  209         if(ter > terMax) 
break;
 
  222         if(moleculeOld == NULL)
 
  225           moleculeOld = 
new Molecule(nameMol, nbMolecule);
 
  226           moleculeOld->
SetFirst(residueFirst);
 
  228           moleculeFirst = moleculeOld;
 
  232           moleculeNext = 
new Molecule(nameMol, nbMolecule);
 
  233           moleculeOld->
SetNext(moleculeNext);
 
  234           moleculeNext->
SetFirst(residueFirst);
 
  236           moleculeOld = moleculeNext;
 
  241         moleculeOld->
fCenterX = (
int) ((minX + maxX) / 2.);
 
  242         moleculeOld->
fCenterY = (
int) ((minY + maxY) / 2.);
 
  243         moleculeOld->
fCenterZ = (
int) ((minZ + maxZ) / 2.);
 
  275       else if((sLine.substr(0, 6)).compare(
"ATOM  ") == 0)
 
  280         istringstream((sLine.substr(6, 5))) >> serial;
 
  284         atomName = sLine.substr(12, 4);
 
  285         if(atomName.substr(0, 1).compare(
" ") == 0) element = sLine.substr(13,
 
  287         else element = sLine.substr(12, 1);
 
  290         double vdwRadius = -1.;
 
  295         else if(element == 
"C")
 
  299         else if(element == 
"N")
 
  303         else if(element == 
"O")
 
  307         else if(element == 
"P")
 
  311         else if(element == 
"S")
 
  318           G4cerr << 
"Element not recognized : " << element << 
G4endl;
 
  323           errMsg << 
"Element not recognized : " << element << 
G4endl;
 
  326                       "ELEM_NOT_RECOGNIZED",
 
  336           resName = sLine.substr(17, 3);
 
  338           istringstream((sLine.substr(22, 4))) >> resSeq;
 
  340           stringstream((sLine.substr(30, 8))) >> 
x;
 
  341           stringstream((sLine.substr(38, 8))) >> y;
 
  342           stringstream((sLine.substr(46, 8))) >> 
z;
 
  346           if(minGlobZ < z) minGlobZ = 
z;
 
  347           if(maxGlobZ > z) maxGlobZ = 
z;
 
  348           if(minGlobX < x) minGlobX = 
x;
 
  349           if(maxGlobX > x) maxGlobX = 
x;
 
  350           if(minGlobY < y) minGlobY = y;
 
  351           if(maxGlobY > y) maxGlobY = y;
 
  352           if(minX > x) minX = 
x;
 
  353           if(maxX < x) maxX = 
x;
 
  354           if(minY > y) minY = y;
 
  355           if(maxY < y) maxY = y;
 
  356           if(minZ > z) minZ = 
z;
 
  357           if(maxZ < z) maxZ = 
z;
 
  360           if(AtomicOld == NULL)
 
  362             AtomicOld = 
new Atom(serial,
 
  378             AtomicNext = 
new Atom(serial,
 
  390             AtomicOld->
SetNext(AtomicNext);
 
  391             AtomicOld = AtomicNext;
 
  397         if(residueOld == NULL)
 
  399           if(verbose > 2) 
G4cout << 
"residueOld == NULL" << 
G4endl;
 
  402           residueOld = 
new Residue(resName, resSeq);
 
  405           residueFirst = residueOld;
 
  411           if(lastResSeq == resSeq)
 
  421             residueNext = 
new Residue(resName, resSeq);
 
  423             residueOld->
SetNext(residueNext);
 
  424             residueOld->
fNbAtom = nbAtom - 1;
 
  427             residueOld = residueNext;
 
  438     return moleculeFirst;
 
  468   while(moleculeListTemp)
 
  470     residueListTemp = moleculeListTemp->
GetFirst();
 
  476     int correctNumerotationNumber = 0;
 
  477     if(k == 2 && residueListTemp->
fResSeq > 1)
 
  479       correctNumerotationNumber = residueListTemp->
fResSeq;
 
  482     while(residueListTemp)
 
  484       AtomTemp = residueListTemp->
GetFirst();
 
  488       if(correctNumerotationNumber != 0)
 
  491             - correctNumerotationNumber
 
  496       double baryX = 0., baryY = 0., baryZ = 0.;
 
  497       double baryBaseX = 0., baryBaseY = 0., baryBaseZ = 0.;
 
  498       double barySugX = 0., barySugY = 0., barySugZ = 0.;
 
  499       double baryPhosX = 0., baryPhosY = 0., baryPhosZ = 0.;
 
  500       unsigned short int nbAtomInBase = 0;
 
  502       for(
int i = 0; i < residueListTemp->
fNbAtom; i++)
 
  505         baryX += AtomTemp->
fX;
 
  506         baryY += AtomTemp->
fY;
 
  507         baryZ += AtomTemp->
fZ;
 
  509         if(residueListTemp->
fResSeq == 1)
 
  513             baryPhosX += AtomTemp->
fX;
 
  514             baryPhosY += AtomTemp->
fY;
 
  515             baryPhosZ += AtomTemp->
fZ;
 
  519             barySugX += AtomTemp->
fX;
 
  520             barySugY += AtomTemp->
fY;
 
  521             barySugZ += AtomTemp->
fZ;
 
  529               baryBaseX += AtomTemp->
fX;
 
  530               baryBaseY += AtomTemp->
fY;
 
  531               baryBaseZ += AtomTemp->
fZ;
 
  540             baryPhosX += AtomTemp->
fX;
 
  541             baryPhosY += AtomTemp->
fY;
 
  542             baryPhosZ += AtomTemp->
fZ;
 
  546             barySugX += AtomTemp->
fX;
 
  547             barySugY += AtomTemp->
fY;
 
  548             barySugZ += AtomTemp->
fZ;
 
  556               baryBaseX += AtomTemp->
fX;
 
  557               baryBaseY += AtomTemp->
fY;
 
  558               baryBaseZ += AtomTemp->
fZ;
 
  563         AtomTemp = AtomTemp->
GetNext();
 
  566       baryX = baryX / (double) residueListTemp->
fNbAtom;
 
  567       baryY = baryY / (
double) residueListTemp->
fNbAtom;
 
  568       baryZ = baryZ / (double) residueListTemp->
fNbAtom;
 
  570       if(residueListTemp->
fResSeq != 1) 
 
  572         baryPhosX = baryPhosX / 4.;
 
  573         baryPhosY = baryPhosY / 4.;
 
  574         baryPhosZ = baryPhosZ / 4.;
 
  576       barySugX = barySugX / 7.;
 
  577       barySugY = barySugY / 7.;
 
  578       barySugZ = barySugZ / 7.;
 
  579       baryBaseX = baryBaseX / (double) nbAtomInBase;
 
  580       baryBaseY = baryBaseY / (double) nbAtomInBase;
 
  581       baryBaseZ = baryBaseZ / (double) nbAtomInBase;
 
  584       if(BarycenterOld == NULL)
 
  586         BarycenterOld = 
new Barycenter(j + j_old, baryX, baryY, baryZ, 
 
  596         BarycenterFirst = BarycenterOld;
 
  613         BarycenterOld->
SetNext(BarycenterNext);
 
  614         BarycenterOld = BarycenterNext;
 
  620       AtomTemp = residueListTemp->
GetFirst();
 
  623       for(
int ii = 0; ii < residueListTemp->
fNbAtom; ii++)
 
  625         dT3Dp = DistanceTwo3Dpoints(AtomTemp->
fX,
 
  632         if(dT3Dp > max) max = dT3Dp;
 
  633         AtomTemp = AtomTemp->
GetNext();
 
  637       residueListTemp = residueListTemp->
GetNext();
 
  644     moleculeListTemp = moleculeListTemp->
GetNext();
 
  647   if(BarycenterNext != NULL)
 
  652   return BarycenterFirst;
 
  670   double minminX, minminY, minminZ; 
 
  671   double maxmaxX, maxmaxY, maxmaxZ; 
 
  680   while(moleculeListTemp)
 
  682     if(minminX > moleculeListTemp->
fMaxGlobX)
 
  686     if(minminY > moleculeListTemp->
fMaxGlobY)
 
  690     if(minminZ > moleculeListTemp->
fMaxGlobZ)
 
  694     if(maxmaxX < moleculeListTemp->fMinGlobX)
 
  698     if(maxmaxY < moleculeListTemp->fMinGlobY)
 
  702     if(maxmaxZ < moleculeListTemp->fMinGlobZ)
 
  707     moleculeListTemp = moleculeListTemp->
GetNext();
 
  710   dX = (maxmaxX - minminX) / 2. + 1.8; 
 
  711   dY = (maxmaxY - minminY) / 2. + 1.8;
 
  712   dZ = (maxmaxZ - minminZ) / 2. + 1.8;
 
  714   tX = minminX + (maxmaxX - minminX) / 2.;
 
  715   tY = minminY + (maxmaxY - minminY) / 2.;
 
  716   tZ = minminZ + (maxmaxZ - minminZ) / 2.;
 
  733   while(moleculeListTemp)
 
  735     residueListTemp = moleculeListTemp->
GetFirst();
 
  740     while(residueListTemp)
 
  743       residueListTemp = residueListTemp->
GetNext();
 
  747     moleculeListTemp = moleculeListTemp->
GetNext();
 
  750   fNbNucleotidsPerStrand = j_old / 2;
 
  769   unsigned short int matchFound = 0;
 
  771   Molecule *mLTsavedPointer = moleculeListTemp;
 
  774   short int strandNum = 0; 
 
  777   unsigned short int BSP = 2; 
 
  789   moleculeListTemp = mLTsavedPointer;
 
  790   BarycenterList = BLsavedPointer;
 
  793   while(moleculeListTemp)
 
  796     residueListTemp = moleculeListTemp->
GetFirst();
 
  802     while(residueListTemp)
 
  806       if(j - j_save > 2) 
break;
 
  808       distEdepDNA = DistanceTwo3Dpoints(x,
 
  814       if(distEdepDNA < BarycenterList->GetRadius())
 
  819         AtomTemp = residueListTemp->
GetFirst();
 
  820         for(
int iii = 0; iii < residueListTemp->
fNbAtom; iii++)
 
  823           distEdepAtom = DistanceTwo3Dpoints(x,
 
  830           if((distEdepAtom < AtomTemp->GetVanDerWaalsRadius()) && (smallestDist
 
  837               residueNum = fNbNucleotidsPerStrand + 1
 
  842               residueNum = residueListTemp->
fResSeq;
 
  845             baseName = (residueListTemp->
fResName)[2];
 
  846             if(residueListTemp->
fResSeq == 1)
 
  848               if(iii == 0) BSP = 0; 
 
  849               else if(iii < 8) BSP = 1; 
 
  855               else if(iii < 11) BSP = 1; 
 
  859             smallestDist = distEdepAtom;
 
  863             if(j_save == j_max_value) j_save = j;
 
  866           AtomTemp = AtomTemp->
GetNext();
 
  869       BarycenterList = BarycenterList->
GetNext();
 
  870       residueListTemp = residueListTemp->
GetNext();
 
  872     moleculeListTemp = moleculeListTemp->
GetNext();
 
  875   numStrand = strandNum;
 
  876   numNucleotid = residueNum;
 
  884 double PDBlib::DistanceTwo3Dpoints(
double xA,
 
  891   return sqrt((xA - xB) * (xA - xB) + (yA - yB) * (yA - yB)
 
  892               + (zA - zB) * (zA - zB));
 
int fCenterZ
"Z center" of this Molecule (for rotation...) 
 
Molecule * Load(const std::string &filename, unsigned short int &isDNA, unsigned short int verbose)
Load PDB file into memory. 
 
std::ostringstream G4ExceptionDescription
 
void SetRadius(double)
Set the distance between the farther atom and nucleotide barycenter. 
 
double fCenterY
"Y coordinate" of this nucelotide Barycenter 
 
double fCenterX
"X coordinate" of this nucelotide Barycenter 
 
void SetNext(Molecule *)
Set the next Molecule. 
 
int fNbAtom
Number of atoms into a residue (usage before vector) 
 
Barycenter * ComputeNucleotideBarycenters(Molecule *moleculeListTemp)
Compute nucleotide barycenter from memory. 
 
Residue * GetFirst()
Get the first Residue. 
 
Residue * GetNext()
Get the next residue. 
 
double fZ
Z orthogonal coordinates in Angstroms. 
 
void SetFirst(Residue *)
Set the first Residue. 
 
double GetX()
Return the X position for the Atom. 
 
void SetNext(Atom *)
Set the next atom. 
 
int fCenterX
"X center" of this Molecule (for rotation...) 
 
std::string fResName
Residue name. 
 
void SetDistance(int i, double)
Set the distance between atom i and nucleotide barycenter. 
 
int fNumInRes
its number in residue sequence 
 
G4GLOB_DLL std::ostream G4cout
 
double GetZ()
Return the Z position for the Atom. 
 
int fCenterY
"Y center" of this Molecule (for rotation...) 
 
void SetNext(Barycenter *)
Set the next Barycenter. 
 
void ComputeNbNucleotidsPerStrand(Molecule *moleculeListTemp)
Compute number of nucleotide per strand. 
 
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
 
unsigned short int ComputeMatchEdepDNA(Barycenter *, Molecule *, double x, double y, double z, int &numStrand, int &numNucleotid, int &codeResidue)
Compute if energy is deposited in per atom. 
 
Molecule * GetNext()
information about molecule (not implemented) 
 
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
 
Barycenter * GetNext()
Get the next Barycenter. 
 
int fNbResidue
Number of residue inside the molecule. 
 
T max(const T t1, const T t2)
brief Return the largest of the two arguments 
 
Atom * GetFirst()
Get the first atom. 
 
void SetNext(Residue *)
Set the next residue. 
 
void ComputeBoundingVolumeParams(Molecule *moleculeListTemp, double &dX, double &dY, double &dZ, double &tX, double &tY, double &tZ)
Compute the corresponding bounding volume parameters. 
 
double fX
X orthogonal coordinates in Angstroms. 
 
Atom * GetNext()
Returns the next Atom. 
 
double fY
Y orthogonal coordinates in Angstroms. 
 
std::string fElement
Element symbol extracted from 'atom name'. 
 
int fResSeq
Residue sequence number. 
 
double fCenterZ
"Z coordinate" of this nucelotide Barycenter 
 
const XML_Char XML_Content * model
 
PDBlib()
First constructor. 
 
double GetY()
Return the Y position for the Atom. 
 
G4GLOB_DLL std::ostream G4cerr
 
Definition of the PDBlib class. 
 
void SetFirst(Atom *)
Set the first Atom of the residue.