| Bsoft 2.0.5 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 fpdb << "REMARK PDB file written by Bsoft: " << asctime(localtime(&t));
367 if ( molgroup->comment.length() )
368 fpdb << "REMARK " << molgroup->comment << endl;
369
370 if ( verbose & VERB_DEBUG )
371 cout << "DEBUG writePDB: remarks done" << endl;
372
373 for ( mol = molgroup->mol; mol; mol = mol->next ) {
374 chain = mol->id[0];
375 for ( sec = mol->sec; sec; sec = sec->next ) {
376 if ( sec->type < Strand && sec->first && sec->last ) {
377 // fpdb << "HELIX %4d %3s %3s %c %4d%1s %3s %c %4d%1s%2d\n",
378 fpdb << "HELIX " << right << setw(4) << sec->num << " " <<
379 left << setw(4) << sec->id <<
380 setw(4) << sec->first->type << chain <<
381 right << setw(5) << sec->first->num <<
382 left << sec->first->insert << " " <<
383 setw(4) << sec->last->type << chain <<
384 right << setw(5) << sec->last->num <<
385 left << sec->last->insert <<
386 right << setw(2) << sec->type << endl;
387 }
388 }
389 }
390
391 if ( verbose & VERB_DEBUG )
392 cout << "DEBUG writePDB: helices done" << endl;
393
394 for ( mol = molgroup->mol; mol; mol = mol->next ) {
395 chain = mol->id[0];
396 for ( sec = mol->sec; sec; sec = sec->next ) {
397 if ( sec->type == Strand && sec->first && sec->last ) {
398 // fpdb << "SHEET %4d %3s%2d %3s %c%4d%1s %3s %c%4d%1s%2d\n",
399 fpdb << "SHEET " << right << setw(4) << sec->num << " " <<
400 left << setw(3) << sec->id <<
401 right << setw(2) << sec->nstrands << " " <<
402 left << setw(4) << sec->first->type << chain <<
403 right << setw(4) << sec->first->num <<
404 left << sec->first->insert << " " <<
405 setw(4) << sec->last->type << chain <<
406 right << setw(4) << sec->last->num <<
407 left << sec->last->insert <<
408 right << setw(2) << sec->sense << endl;
409 }
410 }
411 }
412
413 if ( verbose & VERB_DEBUG )
414 cout << "DEBUG writePDB: sheets done" << endl;
415
416 for ( mol = molgroup->mol; mol; mol = mol->next ) {
417 chain = mol->id[0];
418 for ( sec = mol->sec; sec; sec = sec->next ) {
419 if ( sec->type == Turn ) {
420 // fpdb << "TURN %4d %3s %3s %c%4d%1s %3s %c%4d%1s\n",
421 fpdb << "TURN " << right << setw(4) << sec->num << " " <<
422 left << setw(4) << sec->id <<
423 setw(4) << sec->first->type << chain <<
424 right << setw(4) << sec->first->num <<
425 left << sec->first->insert << " " <<
426 setw(4) << sec->last->type << chain <<
427 right << setw(4) << sec->last->num <<
428 left << sec->last->insert << endl;
429 }
430 }
431 }
432
433 if ( verbose & VERB_DEBUG )
434 cout << "DEBUG writePDB: turns done" << endl;
435
436 // fpdb << "CRYST1%9.3f%9.3f%9.3f%7.2f%7.2f%7.2f%11s%4d\n",
437 fpdb << "CRYST1" << fixed << setprecision(3) << setw(9) << unitcell.a() << setw(9) <<
438 unitcell.b() << setw(9) << unitcell.c() << setprecision(2) << setw(7) <<
439 unitcell.alpha()*180.0/M_PI << setw(7) << unitcell.beta()*180.0/M_PI <<
440 setw(7) << unitcell.gamma()*180.0/M_PI << setw(11) <<
441 molgroup->sgstring << setw(4) << molgroup->spacegroup << endl;
442
443 if ( verbose & VERB_DEBUG )
444 cout << "DEBUG writePDB: crystal parameters done" << endl;
445
446 pnum = molgroup->mol->res->atom->num - 1;
447 strcpy(sid, " ");
448 sid[4] = 0;
449 for ( mol = molgroup->mol; mol; mol = mol->next ) {
450 chain = mol->id[0];
451 nw = 0;
452 for ( res = mol->res; res; res = res->next ) {
453 for ( atom = res->atom; atom; atom = atom->next ) {
454 if ( atom->num <= pnum ) atom->num = pnum + 1;
455 if ( atom->num > 99999 ) atom->num = 1;
456 pnum = atom->num;
457 if ( atom->sel ) {
458 if ( atom->sel < 2 ) strncpy(atomtag, "ATOM ", 6);
459 else strncpy(atomtag, "HETATM", 6);
460 atomtag[6] = 0;
461 if ( strlen(atom->type) < 4 )
462 snprintf(atomtype, 12, " %s", atom->type);
463 else
464 snprintf(atomtype, 12, "%s", atom->type);
465 atomtype[4] = 0;
466 strncpy(esm, atom->el, 2);
467 esm[2] = 0;
468 if ( strlen(esm) < 2 ) esm[1] = ' ';
469 // fpdb << "%6s%5d %-4s%1s%3s %c%4d%1s %8.3f%8.3f%8.3f%6.2f%6.2f %4s%2s%6.3f\n",
470 fpdb << setw(6) <<
471 atomtag << right << setw(5) << atom->num << " " << left << setw(4) << atomtype << alt <<
472 setw(3) << res->type << " " << chain << right << setw(4) << res->num << res->insert << " " <<
473 setprecision(3) << setw(8) << atom->coord[0] << setw(8) <<
474 atom->coord[1] << setw(8) << atom->coord[2] <<
475 setprecision(2) << setw(6) << atom->q << setw(6) << atom->b << " " <<
476 setw(4) << sid << setw(2) << esm << setprecision(3) << setw(6) << atom->chrg << endl;
477 nw++;
478 }
479 }
480 }
481 if ( nw > 0 ) {
482 nmol++;
483 fpdb << "TER" << endl;
484 }
485 }
486
487 if ( verbose & VERB_DEBUG )
488 cout << "DEBUG writePDB: atoms done" << endl;
489
490 for ( bond = molgroup->bond; bond; bond = bond->next ) {
491 a1 = 10*bond->atom1->num;
492 a2 = 10*bond->atom2->num;
493 for ( i=0; i<10 && al[a1+i]; i++ ) ;
494 if ( i<10 ) al[a1+i] = bond->atom2->num;
495 for ( i=0; i<10 && al[a2+i]; i++ ) ;
496 if ( i<10 ) al[a2+i] = bond->atom1->num;
497 }
498
499 for ( i=1; i<100000; i++ ) if ( al[i*10] ) {
500 fpdb << "CONECT" << setw(5) << i;
501 for ( j=0; j<10 && al[i*10+j]; j++ ) {
502 if ( j == 4 ) fpdb << endl << "CONECT" << setw(5) << i;
503 fpdb << setw(5) << al[i*10+j];
504 }
505 fpdb << endl;
506 }
507
508 delete[] al;
509
510 if ( verbose & VERB_DEBUG )
511 cout << "DEBUG writePDB: bonds done" << endl;
512
513 fpdb << "END" << endl;
514
515 fpdb.close();
516
517 if ( verbose & VERB_DEBUG )
518 cout << "DEBUG writePDB: File " << filename << " closed" << endl;
519
520 return nmol;
521 }
522
Bmolecule::id
Bstring id
Definition: rwmolecule.h:110
UnitCell
Definition: UnitCell.h:22
Bmolgroup::mol
Bmolecule * mol
Definition: rwmolecule.h:189
Bmolgroup::sgstring
Bstring sgstring
Definition: rwmolecule.h:178
insert
string insert(string &filename, string ins)
Definition: string_util.cpp:48
readPDB
int readPDB(Bstring &filename, Bmolgroup *molgroup)
Reads a PDB format coordinate file.
Definition: rwPDB.cpp:31
writePDB
int writePDB(Bstring &filename, Bmolgroup *molgroup)
Writes a PDB format coordinate file.
Definition: rwPDB.cpp:330
UnitCell::gamma
void gamma(double d)
Definition: UnitCell.h:41
Bsecondary::sense
int sense
Definition: rwmolecule.h:92
utilities.h
Header file for general utilities.
VERB_DEBUG
#define VERB_DEBUG
Definition: utilities.h:112
Bmolecule::res
Bresidue * res
Definition: rwmolecule.h:122
UnitCell::beta
void beta(double d)
Definition: UnitCell.h:40
Bmolgroup::unitcell
UnitCell unitcell
Definition: rwmolecule.h:179
LeftHandedOmega
Definition: rwmolecule.h:71
Bresidue::insert
char insert[2]
Definition: rwmolecule.h:52
add_item
char * add_item(char **list, unsigned long size)
Adds an item to a linked list.
Definition: linked_list.cpp:26
Bstring::length
long length() const
Definition: Bstring.cpp:263
TwoSevenRibbon
Definition: rwmolecule.h:73
rwPDB.h
Header file for reading and writing PDB coordinate files.
Matrix.h
Generalized matrix class.
Bsecondary::num
int num
Definition: rwmolecule.h:90
UnitCell::a
void a(double d)
Definition: UnitCell.h:36
MAXLINELEN
#define MAXLINELEN
Definition: utilities.h:44
Bresidue::type
char type[6]
Definition: rwmolecule.h:53
Bmolgroup::select
Bstring select
Definition: rwmolecule.h:185
LeftHandedAlpha
Definition: rwmolecule.h:70
Bsecondary::next
Bsecondary * next
Definition: rwmolecule.h:88
Vector3::distance
double distance(const Vector3 &v)
Definition: Vector3.h:227
Turn
Definition: rwmolecule.h:76
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
Batom::q
double q
Definition: rwmolecule.h:31
Bsecondary::nstrands
int nstrands
Definition: rwmolecule.h:93
residue_add
Bresidue * residue_add(Bresidue **res, const char *type)
Adds a residue to a linked list.
Definition: rwmolecule.cpp:113
Batom::sel
int sel
Definition: rwmolecule.h:34
Bmolecule::sec
Bsecondary * sec
Definition: rwmolecule.h:123
Batom::type
char type[8]
Definition: rwmolecule.h:28
Bbond::atom2
Batom * atom2
Definition: rwmolecule.h:137
Batom::num
int num
Definition: rwmolecule.h:26
Bstring::contains
bool contains(const Bstring &s)
Definition: Bstring.cpp:584
M_PI
#define M_PI
Definition: utilities.h:59
linked_list.h
Header file for generalized linked list functions.
Bsecondary::last
Bresidue * last
Definition: rwmolecule.h:95
Bmolgroup
Definition: rwmolecule.h:170
verbose
int verbose
RightHanded310
Definition: rwmolecule.h:69
Bmolgroup::comment
Bstring comment
Definition: rwmolecule.h:175
Bsecondary::id
char id[4]
Definition: rwmolecule.h:91
RightHandedGamma
Definition: rwmolecule.h:68
UnitCell::b
void b(double d)
Definition: UnitCell.h:37
Bmolecule::next
Bmolecule * next
Definition: rwmolecule.h:108
molecule_add
Bmolecule * molecule_add(Bmolecule **mol, char *name)
Adds a molecule to a linked list.
Definition: rwmolecule.cpp:76
RightHandedAlpha
Definition: rwmolecule.h:65
Batom::b
double b
Definition: rwmolecule.h:31
Polyproline
Definition: rwmolecule.h:74
Bresidue::atom
Batom * atom
Definition: rwmolecule.h:54
Bstring::c_str
const char * c_str()
Definition: Bstring.h:70
Bmolecule
Definition: rwmolecule.h:107
atom_add
Batom * atom_add(Batom **atom, const char *type)
Adds an atom to a linked list.
Definition: rwmolecule.cpp:152
Bmolgroup::bond
Bbond * bond
Definition: rwmolecule.h:190
Bresidue::next
Bresidue * next
Definition: rwmolecule.h:50
Bresidue
Definition: rwmolecule.h:49
get_integer
int get_integer(char *ptr, int len)
Converts a defined length string into an integer.
Definition: utilities.cpp:459
UnitCell::alpha
void alpha(double d)
Definition: UnitCell.h:39
Bstring
Definition: Bstring.h:29
Batom
Definition: rwmolecule.h:24
Bsecondary::first
Bresidue * first
Definition: rwmolecule.h:94
LeftHandedGamma
Definition: rwmolecule.h:72
Bbond::atom1
Batom * atom1
Definition: rwmolecule.h:136
Bresidue::num
int num
Definition: rwmolecule.h:51
Batom::coord
Vector3< double > coord
Definition: rwmolecule.h:30
Bbond
Definition: rwmolecule.h:134
Bbond::next
Bbond * next
Definition: rwmolecule.h:135
Batom::el
char el[4]
Definition: rwmolecule.h:27
Bmolgroup::spacegroup
int spacegroup
Definition: rwmolecule.h:176
RightHandedOmega
Definition: rwmolecule.h:66
Batom::chrg
double chrg
Definition: rwmolecule.h:33
Strand
Definition: rwmolecule.h:75
Bsecondary::type
SecondaryType type
Definition: rwmolecule.h:89
get_float
float get_float(char *ptr, int len)
Converts a defined length string into a floating point number.
Definition: utilities.cpp:482
Batom::next
Batom * next
Definition: rwmolecule.h:25
error_show
int error_show(string message, string file, int line)
Displays the error with file and line reference.
Definition: utilities.cpp:755
UnitCell::c
void c(double d)
Definition: UnitCell.h:38
RightHandedPi
Definition: rwmolecule.h:67
Bsecondary
Definition: rwmolecule.h:87