 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
31 cout <<
"DEBUG readWAH: filename=" << filename << endl;
33 ifstream fwah(filename.
c_str());
35 cerr <<
"Error: File " << filename <<
" not opened!" << endl;
39 int atomnum=0, resnum, prev_resnum = -1, n = 0, nmol = 0;
41 char restype[20], atomtype[20];
48 cout <<
"Title: " << mol->
id << endl;
50 while ( !fwah.eof() ) {
52 strncpy(restype, aline + 3, 4);
54 strncpy(atomtype, aline + 11, 4);
57 if ( n < 1 || resnum != prev_resnum ) {
59 cout <<
"DEBUG readWAH: resnum=" << resnum <<
" restype=" << restype << endl;
66 cout <<
"DEBUG readWAH: atomnum=" << atomnum <<
" atomtype=" << atomtype << endl;
68 else atom =
atom_add(&atom, atomtype);
69 atom->
num = ++atomnum;
102 cout <<
"DEBUG writeWAH: filename=" << filename << endl;
104 if ( !molgroup )
return -1;
106 ofstream fwah(filename.
c_str());
108 cerr <<
"Error: File " << filename <<
" not opened!" << endl;
117 cout <<
"New file name: " << filename << endl;
123 for ( mol = molgroup->
mol; mol; mol = mol->
next ) {
125 for ( res = mol->
res; res; res = res->
next ) {
126 for ( atom = res->
atom; atom; atom = atom->
next ) {
128 snprintf(
string,
MAXLINELEN,
" %-4s%4d%-4s%10.5f%10.5f%10.5f%10.5f%10.5f\n",
136 if ( nw > 0 ) nmol++;
Batom * atom_add(Batom **atom, const char *type)
Adds an atom to a linked list.
Bresidue * residue_add(Bresidue **res, const char *type)
Adds a residue to a linked list.
int writeWAH(Bstring &filename, Bmolgroup *molgroup)
Writes a Wayne Hendrickson coordinate file.
int get_integer(char *ptr, int len)
Converts a defined length string into an integer.
Header file for reading and writing Wayne Hendrickson coordinate files.
Header file for general utilities.
float get_float(char *ptr, int len)
Converts a defined length string into a floating point number.
Bmolecule * molecule_add(Bmolecule **mol, char *name)
Adds a molecule to a linked list.
int readWAH(Bstring &filename, Bmolgroup *molgroup)
Reads a Wayne Hendrickson coordinate file.