Bsoft  2.1.0
Bernard's software package
rwPDB.cpp
Go to the documentation of this file.
1 
9 #include "rwPDB.h"
10 #include "Matrix.h"
11 #include "linked_list.h"
12 #include "utilities.h"
13 #include <fstream>
14 
15 // Declaration of global variables
16 extern int verbose; // Level of output to the screen
17 
31 int readPDB(Bstring& filename, Bmolgroup *molgroup)
32 {
33  if ( verbose & VERB_DEBUG )
34  cout << "DEBUG readPDB: filename=" << filename << endl;
35 
36  // Open pdb file read only
37  ifstream fpdb(filename.c_str());
38  if ( fpdb.fail() ) {
39  cerr << "Error: File " << filename << " not opened!" << endl;
40  return -1;
41  }
42 
43  int readflag, linenum(0);
44  int i, nmol(0), natom(0), nsec(0);
45  int resnum, resnum2, prev_resnum = -10000;
46  int atomnum, ba, helixclass;
47  char chain, insert, prev_insert = ' ';
48  char sgstring[32];
49  char label[12], restype[12], atomtype[12], satomnum[8];
50  char aline[MAXLINELEN], *aptr;
51  Bstring molname(" ");
52  double d;
53 
54  Bmolecule* mol = NULL;
55  Bresidue* res = NULL;
56  Bsecondary* sec = NULL;
57  Batom* atom = NULL;
58  Batom* atom2 = NULL;
59  Bbond* bond = NULL;
60  UnitCell unitcell = molgroup->unitcell;
61 
62  Batom** al = new Batom*[100000];
63  memset(al, 0, 100000*sizeof(Batom*));
64 
65  nmol = natom = 0;
66  chain = '%';
67 
68  while ( !fpdb.eof() ) {
69  fpdb.getline(aline, MAXLINELEN);
70  linenum++;
71  readflag = 0;
72  if ( verbose & VERB_DEBUG )
73  cout << "DEBUG readPDB: " << aline << endl;
74  if ( strncmp(aline, "TER", 3) == 0 || strncmp(aline, "END", 3) == 0 ) chain = '%';
75  if ( strncmp(aline, "CRYST1", 6) == 0 ) {
76  i = sscanf(aline, "%6c%9lf%9lf%9lf%7lf%7lf%7lf%11c%4d",
77  label, &unitcell[0], &unitcell[1], &unitcell[2],
78  &unitcell[3], &unitcell[4], &unitcell[5],
79  sgstring, &molgroup->spacegroup);
80  molgroup->sgstring = sgstring;
81 // unitcell.alf += M_PI/180.0;
82 // unitcell.bet += M_PI/180.0;
83 // unitcell.gam += M_PI/180.0;
84  if ( i < 9 ) molgroup->sgstring = "P 1";
85  }
86  if ( ( strncmp(aline, "ATOM", 4) == 0 ) || ( strncmp(aline, "HETATM", 6) == 0 ) ) {
87  if ( molgroup->select.contains("ATOM") ) {
88  if ( strstr(aline,"ATOM") ) readflag = 1;
89  } else if ( molgroup->select.contains("HETATM") ) {
90  if ( strstr(aline,"HETATM") ) readflag = 1;
91  } else if ( molgroup->select.contains("CA") ) {
92  if ( strncmp(&aline[13],"CA", 2) == 0 ) readflag = 1;
93  } else readflag = 1;
94  if ( strstr(aline, "nan") || strstr(aline, "NAN") ) {
95  cerr << "Warning: NAN at line number " << linenum << endl;
96  readflag = 0;
97  }
98  if ( aline[16] == 'B' ) readflag = 0;
99  if ( verbose & VERB_DEBUG )
100  cout << "DEBUG readPDB: readflag=" << readflag << endl;
101  if ( readflag ) {
102 // if ( !isspace(aline[21]) && aline[21] != chain ) {
103  if ( aline[21] != chain ) {
104  chain = aline[21];
105  molname[0] = chain;
106  mol = molecule_add(&mol, molname);
107  if ( !molgroup->mol ) molgroup->mol = mol;
108  nmol++;
109  res = NULL;
110  prev_resnum = -10000;
111  if ( verbose & VERB_DEBUG )
112  cout << "DEBUG readPDB: chain=" << chain << " nmol=" << nmol << endl;
113  }
114  memset(satomnum, 0, 8);
115  atomnum = get_integer(aline + 6, 5);
116  if ( atomnum < 1 ) atomnum = natom + 1;
117  strncpy(atomtype, aline + 12, 4);
118  strncpy(restype, aline + 17, 3);
119  resnum = get_integer(aline + 22, 4);
120 // if ( resnum < 1 ) resnum = natom + 1;
121  insert = aline[26];
122  restype[3] = 0; // Residue names only 3 characters
123  atomtype[4] = 0; // Atom names only 4 characters
124  if ( natom < 1 || resnum != prev_resnum || insert != prev_insert ) {
125  if ( verbose & VERB_DEBUG )
126  cout << "DEBUG readPDB: resnum=" << resnum << " restype=" << restype << endl;
127  if ( !mol ) {
128  error_show("No molecule structure allocated!", __FILE__, __LINE__);
129  return -1;
130  }
131  res = residue_add(&res, restype);
132  if ( !mol->res ) mol->res = res;
133  res->num = resnum;
134  res->insert[0] = insert;
135  prev_resnum = resnum;
136  prev_insert = insert;
137  atom = NULL;
138  }
139  if ( verbose & VERB_DEBUG )
140  cout << "DEBUG readPDB: atomnum=" << atomnum << " atomtype=" << atomtype << endl;
141  atom = atom_add(&atom, atomtype);
142  if ( !res->atom ) res->atom = atom;
143  atom->num = atomnum;
144  atom->coord[0] = get_float(aline + 30, 8);
145  atom->coord[1] = get_float(aline + 38, 8);
146  atom->coord[2] = get_float(aline + 46, 8);
147  atom->q = get_float(aline + 54, 6);
148  atom->b = get_float(aline + 60, 6);
149  atom->chrg = get_float(aline + 78, 6);
150  if ( verbose & VERB_DEBUG )
151  cout << "DEBUG readPDB: " << atom->num << " " << res->num << " " << atom->coord << " " << atom->chrg << endl;
152  atom->sel = 1; /* All atoms read selected */
153  if ( strncmp(aline, "HETATM", 6) == 0 ) atom->sel = 2;
154  al[atomnum] = atom; /* Atom list */
155  if ( natom <= atomnum ) natom = atomnum + 1;
156  }
157  }
158  if ( strncmp(aline, "CONECT", 6) == 0 ) { // Assumed to always be after all ATOM records
159  atomnum = ba = get_integer(aline + 6, 5);
160  if ( atomnum < natom ) for ( i=0, aptr=aline+11; ba && strlen(aptr) > 4; aptr+=5, i++ ) {
161  ba = get_integer(aptr, 5);
162  if ( ba <= natom && ba > atomnum && al[atomnum] && al[ba] ) {
163  if ( verbose & VERB_DEBUG )
164  printf ("DEBUG readPDB: Atom %d bound to %d\n", atomnum, ba);
165  atom = al[atomnum];
166  atom2 = al[ba];
167  d = atom->coord.distance(atom2->coord);
168  bond = bond_add(&bond, atom, atom2, d, 1);
169  if ( !molgroup->bond ) molgroup->bond = bond;
170  }
171  }
172  }
173  }
174 
175  delete[] al;
176 
177  if ( natom ) nmol++;
178  else nmol = -1;
179 
180 // fseek(fpdb, 0, SEEK_SET);
181  fpdb.clear();
182  fpdb.seekg(0, ios::beg);
183 
184  mol = molgroup->mol;
185 
186  chain = 0;
187  sec = NULL;
188  while ( !fpdb.eof() ) {
189  fpdb.getline(aline, MAXLINELEN);
190  if ( strncmp(aline, "HELIX", 5) == 0 ) {
191  chain = aline[19];
192 // if ( sec ) {
193 // while ( mol && chain != mol->id[0] ) mol = mol->next;
194 // if ( !mol )
195  for ( mol = molgroup->mol; mol && chain != mol->id[0]; mol = mol->next ) ;
196 // }
197  if ( mol ) {
198  sec = (Bsecondary *) add_item((char **) &mol->sec, sizeof(Bsecondary));
199  sec->num = get_integer(aline + 6, 4);
200  strncpy(sec->id, aline + 11, 3);
201  helixclass = get_integer(aline + 38, 2);
202  switch ( helixclass ) {
203  case 1: sec->type = RightHandedAlpha; break;
204  case 2: sec->type = RightHandedOmega; break;
205  case 3: sec->type = RightHandedPi; break;
206  case 4: sec->type = RightHandedGamma; break;
207  case 5: sec->type = RightHanded310; break;
208  case 6: sec->type = LeftHandedAlpha; break;
209  case 7: sec->type = LeftHandedOmega; break;
210  case 8: sec->type = LeftHandedGamma; break;
211  case 9: sec->type = TwoSevenRibbon; break;
212  case 10: sec->type = Polyproline; break;
213  }
214  resnum = get_integer(aline + 21, 4);
215  resnum2 = get_integer(aline + 33, 4);
216  for ( res=mol->res; res; res=res->next ) {
217  if ( res->num == resnum ) sec->first = res;
218  if ( res->num == resnum2 ) sec->last = res;
219  }
220  nsec++;
221  if ( !sec->first )
222  cerr << "Warning: First residue " << resnum << " not found!" << endl;
223  if ( !sec->last )
224  cerr << "Warning: Last residue " << resnum2 << " not found!" << endl;
225  }
226  }
227  if ( ( strncmp(aline, "ATOM", 4) == 0 ) || ( strncmp(aline, "HETATM", 6) == 0 ) )
228  break;
229  }
230 
231 // fseek(fpdb, 0, SEEK_SET);
232  fpdb.clear();
233  fpdb.seekg(0, ios::beg);
234 
235  mol = molgroup->mol;
236 
237  chain = 0;
238  sec = NULL;
239  while ( !fpdb.eof() ) {
240  fpdb.getline(aline, MAXLINELEN);
241  if ( strncmp(aline, "SHEET", 5) == 0 ) {
242  chain = aline[21];
243 // if ( sec ) {
244 // while ( mol && chain != mol->id[0] ) mol = mol->next;
245 // if ( !mol )
246  for ( mol = molgroup->mol; mol && chain != mol->id[0]; mol = mol->next ) ;
247 // }
248  if ( mol ) {
249  sec = (Bsecondary *) add_item((char **) &mol->sec, sizeof(Bsecondary));
250  sec->num = get_integer(aline + 6, 4);
251  strncpy(sec->id, aline + 11, 3);
252  sec->type = Strand;
253  sec->sense = get_integer(aline + 38, 2);
254  sec->nstrands = get_integer(aline + 14, 2);
255  resnum = get_integer(aline + 22, 4);
256  resnum2 = get_integer(aline + 33, 4);
257  for ( res=mol->res; res; res=res->next ) {
258  if ( res->num == resnum ) sec->first = res;
259  if ( res->num == resnum2 ) sec->last = res;
260  }
261  nsec++;
262  if ( !sec->first )
263  cerr << "Warning: First residue " << resnum << " not found!" << endl;
264  if ( !sec->last )
265  cerr << "Warning: Last residue " << resnum2 << " not found!" << endl;
266  }
267  }
268  if ( ( strncmp(aline, "ATOM", 4) == 0 ) || ( strncmp(aline, "HETATM", 6) == 0 ) )
269  break;
270  }
271 
272 // fseek(fpdb, 0, SEEK_SET);
273  fpdb.clear();
274  fpdb.seekg(0, ios::beg);
275 
276  mol = molgroup->mol;
277 
278  chain = 0;
279  sec = NULL;
280  while ( !fpdb.eof() ) {
281  fpdb.getline(aline, MAXLINELEN);
282  if ( strncmp(aline, "TURN", 4) == 0 ) {
283  chain = aline[19];
284 // if ( sec ) {
285 // while ( mol && chain != mol->id[0] ) mol = mol->next;
286 // if ( !mol )
287  for ( mol = molgroup->mol; mol && chain != mol->id[0]; mol = mol->next ) ;
288 // }
289  if ( mol ) {
290  sec = (Bsecondary *) add_item((char **) &mol->sec, sizeof(Bsecondary));
291  sec->num = get_integer(aline + 7, 4);
292  strncpy(sec->id, aline + 11, 3);
293  sec->type = Turn;
294  resnum = get_integer(aline + 20, 4);
295  resnum2 = get_integer(aline + 31, 4);
296  for ( res=mol->res; res; res=res->next ) {
297  if ( res->num == resnum ) sec->first = res;
298  if ( res->num == resnum2 ) sec->last = res;
299  }
300  nsec++;
301  }
302  }
303  if ( ( strncmp(aline, "ATOM", 4) == 0 ) || ( strncmp(aline, "HETATM", 6) == 0 ) )
304  break;
305  }
306 
307  fpdb.close();
308 
309  if ( verbose & VERB_DEBUG ) {
310  cout << "DEBUG readPDB: Number of molecules = " << nmol << endl;
311  cout << "DEBUG readPDB: Secondary structures = " << nsec << endl;
312  }
313 
314  return nmol;
315 }
316 
330 int writePDB(Bstring& filename, Bmolgroup *molgroup)
331 {
332  if ( verbose & VERB_DEBUG )
333  cout << "DEBUG writePDB: filename=" << filename << endl;
334 
335  if ( !molgroup ) return -1;
336 
337  ofstream fpdb(filename.c_str());
338  if ( fpdb.fail() ) {
339  cerr << "Error: File " << filename << " not opened!" << endl;
340  return -1;
341  }
342 
343  int i, j, nw(0), nmol(0), a1, a2, pnum;
344  char atomtag[8], atomtype[12];
345  char alt[4] = " ", sid[8] = " ", esm[4] = " ", chain;
346 
347  if ( verbose & VERB_DEBUG )
348  cout << "DEBUG writePDB: New file name: " << filename << endl;
349 
350 // if ( ( fpdb = fopen(filename.c_str(), "w") ) == NULL ) return -1;
351 
352  if ( verbose & VERB_DEBUG )
353  cout << "DEBUG writePDB: File " << filename << " opened" << endl;
354 
355  Bmolecule* mol;
356  Bresidue* res;
357  Bsecondary* sec;
358  Batom* atom;
359  Bbond* bond;
360  UnitCell unitcell = molgroup->unitcell;
361 
362  int* al = new int[1000000];
363  for ( i=0; i<1000000; i++ ) al[i] = 0;
364 
365  time_t t = time(NULL);
366  tm* ltm = localtime(&t);
367  char stm[16];
368  strftime(stm, sizeof(stm), "%d-%b-%y", ltm);
369  Bstring title = command_line();
370 // fpdb << left << setw(50) << "HEADER Written by Bsoft" << asctime(localtime(&t));
371 // fpdb << left << setw(50) << "HEADER Written by Bsoft" <<
372 // ltm->tm_mday << "-" << ltm->tm_mon << "-" << ltm->tm_year << endl;
373  fpdb << left << setw(50) << "HEADER Written by Bsoft" << stm << endl;
374  fpdb << "TITLE " << title << endl;
375 // if ( molgroup->comment.length() )
376 // fpdb << "REMARK " << molgroup->comment << endl;
377 
378  if ( verbose & VERB_DEBUG )
379  cout << "DEBUG writePDB: remarks done" << endl;
380 
381  for ( mol = molgroup->mol; mol; mol = mol->next ) {
382  chain = mol->id[0];
383  for ( sec = mol->sec; sec; sec = sec->next ) {
384  if ( sec->type < Strand && sec->first && sec->last ) {
385 // fpdb << "HELIX %4d %3s %3s %c %4d%1s %3s %c %4d%1s%2d\n",
386  fpdb << "HELIX " << right << setw(4) << sec->num << " " <<
387  left << setw(4) << sec->id <<
388  setw(4) << sec->first->type << chain <<
389  right << setw(5) << sec->first->num <<
390  left << sec->first->insert << " " <<
391  setw(4) << sec->last->type << chain <<
392  right << setw(5) << sec->last->num <<
393  left << sec->last->insert <<
394  right << setw(2) << sec->type << endl;
395  }
396  }
397  }
398 
399  if ( verbose & VERB_DEBUG )
400  cout << "DEBUG writePDB: helices done" << endl;
401 
402  for ( mol = molgroup->mol; mol; mol = mol->next ) {
403  chain = mol->id[0];
404  for ( sec = mol->sec; sec; sec = sec->next ) {
405  if ( sec->type == Strand && sec->first && sec->last ) {
406 // fpdb << "SHEET %4d %3s%2d %3s %c%4d%1s %3s %c%4d%1s%2d\n",
407  fpdb << "SHEET " << right << setw(4) << sec->num << " " <<
408  left << setw(3) << sec->id <<
409  right << setw(2) << sec->nstrands << " " <<
410  left << setw(4) << sec->first->type << chain <<
411  right << setw(4) << sec->first->num <<
412  left << sec->first->insert << " " <<
413  setw(4) << sec->last->type << chain <<
414  right << setw(4) << sec->last->num <<
415  left << sec->last->insert <<
416  right << setw(2) << sec->sense << endl;
417  }
418  }
419  }
420 
421  if ( verbose & VERB_DEBUG )
422  cout << "DEBUG writePDB: sheets done" << endl;
423 
424  for ( mol = molgroup->mol; mol; mol = mol->next ) {
425  chain = mol->id[0];
426  for ( sec = mol->sec; sec; sec = sec->next ) {
427  if ( sec->type == Turn ) {
428 // fpdb << "TURN %4d %3s %3s %c%4d%1s %3s %c%4d%1s\n",
429  fpdb << "TURN " << right << setw(4) << sec->num << " " <<
430  left << setw(4) << sec->id <<
431  setw(4) << sec->first->type << chain <<
432  right << setw(4) << sec->first->num <<
433  left << sec->first->insert << " " <<
434  setw(4) << sec->last->type << chain <<
435  right << setw(4) << sec->last->num <<
436  left << sec->last->insert << endl;
437  }
438  }
439  }
440 
441  if ( verbose & VERB_DEBUG )
442  cout << "DEBUG writePDB: turns done" << endl;
443 
444 // fpdb << "CRYST1%9.3f%9.3f%9.3f%7.2f%7.2f%7.2f%11s%4d\n",
445  fpdb << "CRYST1" << fixed << setprecision(3) << setw(9) << unitcell.a() << setw(9) <<
446  unitcell.b() << setw(9) << unitcell.c() << setprecision(2) << setw(7) <<
447  unitcell.alpha()*180.0/M_PI << setw(7) << unitcell.beta()*180.0/M_PI <<
448  setw(7) << unitcell.gamma()*180.0/M_PI << setw(11) <<
449  molgroup->sgstring << setw(4) << molgroup->spacegroup << endl;
450 
451  if ( verbose & VERB_DEBUG )
452  cout << "DEBUG writePDB: crystal parameters done" << endl;
453 
454  pnum = molgroup->mol->res->atom->num - 1;
455  strcpy(sid, " ");
456  sid[4] = 0;
457  for ( mol = molgroup->mol; mol; mol = mol->next ) {
458  chain = mol->id[0];
459  nw = 0;
460  for ( res = mol->res; res; res = res->next ) {
461  for ( atom = res->atom; atom; atom = atom->next ) {
462  if ( atom->num <= pnum ) atom->num = pnum + 1;
463  if ( atom->num > 99999 ) atom->num = 1;
464  pnum = atom->num;
465  if ( atom->sel ) {
466  if ( atom->sel < 2 ) strncpy(atomtag, "ATOM ", 6);
467  else strncpy(atomtag, "HETATM", 6);
468  atomtag[6] = 0;
469  if ( strlen(atom->type) < 4 )
470  snprintf(atomtype, 12, " %s", atom->type);
471  else
472  snprintf(atomtype, 12, "%s", atom->type);
473  atomtype[4] = 0;
474  strncpy(esm, atom->el, 2);
475  esm[2] = 0;
476  if ( strlen(esm) < 2 ) esm[1] = ' ';
477 // fpdb << "%6s%5d %-4s%1s%3s %c%4d%1s %8.3f%8.3f%8.3f%6.2f%6.2f %4s%2s%6.3f\n",
478  fpdb << setw(6) <<
479  atomtag << right << setw(5) << atom->num << " " << left << setw(4) << atomtype << alt <<
480  setw(3) << res->type << " " << chain << right << setw(4) << res->num << res->insert << " " <<
481  setprecision(3) << setw(8) << atom->coord[0] << setw(8) <<
482  atom->coord[1] << setw(8) << atom->coord[2] <<
483  setprecision(2) << setw(6) << atom->q << setw(6) << atom->b << " " <<
484  setw(4) << sid << setw(2) << esm << setprecision(3) << setw(6) << atom->chrg << endl;
485  nw++;
486  }
487  }
488  }
489  if ( nw > 0 ) {
490  nmol++;
491  fpdb << "TER" << endl;
492  }
493  }
494 
495  if ( verbose & VERB_DEBUG )
496  cout << "DEBUG writePDB: atoms done" << endl;
497 
498  for ( bond = molgroup->bond; bond; bond = bond->next ) {
499  a1 = 10*bond->atom1->num;
500  a2 = 10*bond->atom2->num;
501  for ( i=0; i<10 && al[a1+i]; i++ ) ;
502  if ( i<10 ) al[a1+i] = bond->atom2->num;
503  for ( i=0; i<10 && al[a2+i]; i++ ) ;
504  if ( i<10 ) al[a2+i] = bond->atom1->num;
505  }
506 
507  for ( i=1; i<100000; i++ ) if ( al[i*10] ) {
508  fpdb << "CONECT" << setw(5) << i;
509  for ( j=0; j<10 && al[i*10+j]; j++ ) {
510  if ( j == 4 ) fpdb << endl << "CONECT" << setw(5) << i;
511  fpdb << setw(5) << al[i*10+j];
512  }
513  fpdb << endl;
514  }
515 
516  delete[] al;
517 
518  if ( verbose & VERB_DEBUG )
519  cout << "DEBUG writePDB: bonds done" << endl;
520 
521  fpdb << "END" << endl;
522 
523  fpdb.close();
524 
525  if ( verbose & VERB_DEBUG )
526  cout << "DEBUG writePDB: File " << filename << " closed" << endl;
527 
528  return nmol;
529 }
530 
MAXLINELEN
#define MAXLINELEN
Definition: utilities.h:45
RightHandedPi
@ RightHandedPi
Definition: rwmolecule.h:67
atom_add
Batom * atom_add(Batom **atom, const char *type)
Adds an atom to a linked list.
Definition: rwmolecule.cpp:152
residue_add
Bresidue * residue_add(Bresidue **res, const char *type)
Adds a residue to a linked list.
Definition: rwmolecule.cpp:113
Bsecondary::next
Bsecondary * next
Definition: rwmolecule.h:88
Bmolgroup::select
Bstring select
Definition: rwmolecule.h:185
VERB_DEBUG
#define VERB_DEBUG
Definition: utilities.h:116
Bresidue::next
Bresidue * next
Definition: rwmolecule.h:50
LeftHandedOmega
@ LeftHandedOmega
Definition: rwmolecule.h:71
Bstring
Definition: Bstring.h:29
Bbond::next
Bbond * next
Definition: rwmolecule.h:135
UnitCell::c
void c(double d)
Definition: UnitCell.h:38
add_item
char * add_item(char **list, unsigned long size)
Adds an item to a linked list.
Definition: linked_list.cpp:26
Bbond::atom1
Batom * atom1
Definition: rwmolecule.h:136
Bresidue::atom
Batom * atom
Definition: rwmolecule.h:54
Batom::num
int num
Definition: rwmolecule.h:26
Bmolgroup::sgstring
Bstring sgstring
Definition: rwmolecule.h:178
get_integer
int get_integer(char *ptr, int len)
Converts a defined length string into an integer.
Definition: utilities.cpp:423
Bmolgroup::mol
Bmolecule * mol
Definition: rwmolecule.h:189
TwoSevenRibbon
@ TwoSevenRibbon
Definition: rwmolecule.h:73
error_show
int error_show(string message, string file, int line)
Displays the error with file and line reference.
Definition: utilities.cpp:719
Batom::el
char el[4]
Definition: rwmolecule.h:27
readPDB
int readPDB(Bstring &filename, Bmolgroup *molgroup)
Reads a PDB format coordinate file.
Definition: rwPDB.cpp:31
UnitCell::b
void b(double d)
Definition: UnitCell.h:37
Turn
@ Turn
Definition: rwmolecule.h:76
Bbond::atom2
Batom * atom2
Definition: rwmolecule.h:137
Batom::q
double q
Definition: rwmolecule.h:31
rwPDB.h
Header file for reading and writing PDB coordinate files.
Batom::next
Batom * next
Definition: rwmolecule.h:25
Bresidue::num
int num
Definition: rwmolecule.h:51
LeftHandedAlpha
@ LeftHandedAlpha
Definition: rwmolecule.h:70
Bmolecule::res
Bresidue * res
Definition: rwmolecule.h:122
Bstring::c_str
const char * c_str()
Definition: Bstring.h:70
Bmolgroup::unitcell
UnitCell unitcell
Definition: rwmolecule.h:179
Vector3::distance
double distance(const Vector3 &v)
Definition: Vector3.h:227
RightHanded310
@ RightHanded310
Definition: rwmolecule.h:69
Bsecondary::id
char id[4]
Definition: rwmolecule.h:91
Bsecondary::num
int num
Definition: rwmolecule.h:90
insert
string insert(string &filename, string ins)
Definition: string_util.cpp:48
RightHandedGamma
@ RightHandedGamma
Definition: rwmolecule.h:68
RightHandedAlpha
@ RightHandedAlpha
Definition: rwmolecule.h:65
Bbond
Definition: rwmolecule.h:134
Bmolecule::next
Bmolecule * next
Definition: rwmolecule.h:108
Bmolecule
Definition: rwmolecule.h:107
Bsecondary::first
Bresidue * first
Definition: rwmolecule.h:94
UnitCell::alpha
void alpha(double d)
Definition: UnitCell.h:39
Bmolgroup::bond
Bbond * bond
Definition: rwmolecule.h:190
Polyproline
@ Polyproline
Definition: rwmolecule.h:74
Bmolecule::sec
Bsecondary * sec
Definition: rwmolecule.h:123
Batom::type
char type[8]
Definition: rwmolecule.h:28
UnitCell::a
void a(double d)
Definition: UnitCell.h:36
Bsecondary::nstrands
int nstrands
Definition: rwmolecule.h:93
command_line
string command_line(int argc, char **argv)
Definition: string_util.cpp:16
Bsecondary::last
Bresidue * last
Definition: rwmolecule.h:95
writePDB
int writePDB(Bstring &filename, Bmolgroup *molgroup)
Writes a PDB format coordinate file.
Definition: rwPDB.cpp:330
Batom::b
double b
Definition: rwmolecule.h:31
M_PI
#define M_PI
Definition: utilities.h:63
utilities.h
Header file for general utilities.
Bsecondary::type
SecondaryType type
Definition: rwmolecule.h:89
bond_add
Bbond * bond_add(Bbond **bond, Batom *atom1, Batom *atom2, double l, double k)
Adds a bond to a linked list.
Definition: rwmolecule.cpp:269
Bresidue::type
char type[6]
Definition: rwmolecule.h:53
get_float
float get_float(char *ptr, int len)
Converts a defined length string into a floating point number.
Definition: utilities.cpp:446
Batom::sel
int sel
Definition: rwmolecule.h:34
Matrix.h
Generalized matrix class.
Bresidue::insert
char insert[2]
Definition: rwmolecule.h:52
LeftHandedGamma
@ LeftHandedGamma
Definition: rwmolecule.h:72
Bresidue
Definition: rwmolecule.h:49
linked_list.h
Header file for generalized linked list functions.
Bmolgroup
Definition: rwmolecule.h:170
UnitCell::beta
void beta(double d)
Definition: UnitCell.h:40
UnitCell
Definition: UnitCell.h:22
Strand
@ Strand
Definition: rwmolecule.h:75
RightHandedOmega
@ RightHandedOmega
Definition: rwmolecule.h:66
Batom::chrg
double chrg
Definition: rwmolecule.h:33
Bstring::contains
bool contains(const Bstring &s)
Definition: Bstring.cpp:592
Bsecondary
Definition: rwmolecule.h:87
verbose
int verbose
molecule_add
Bmolecule * molecule_add(Bmolecule **mol, char *name)
Adds a molecule to a linked list.
Definition: rwmolecule.cpp:76
Bsecondary::sense
int sense
Definition: rwmolecule.h:92
Bmolgroup::spacegroup
int spacegroup
Definition: rwmolecule.h:176
Batom::coord
Vector3< double > coord
Definition: rwmolecule.h:30
UnitCell::gamma
void gamma(double d)
Definition: UnitCell.h:41
Batom
Definition: rwmolecule.h:24
Bmolecule::id
Bstring id
Definition: rwmolecule.h:110