1
/**********************************************************************
2
Copyright (C) 1998-2001 by OpenEye Scientific Software, Inc.
3
Some portions Copyright (c) 2001-2003 by Geoffrey R. Hutchison
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation version 2 of the License.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
***********************************************************************/
22
bool ReadFeat(istream &ifs,OBMol &mol, const char *title)
24
char buffer[BUFF_SIZE];
27
ifs.getline(buffer,BUFF_SIZE);
28
sscanf(buffer,"%d",&natoms);
30
mol.ReserveAtoms(natoms);
33
if (!ifs.getline(buffer,BUFF_SIZE)) return(false);
39
for (i = 0; i < natoms;i++)
41
if (!ifs.getline(buffer,BUFF_SIZE)) return(false);
42
sscanf(buffer,"%s %lf %lf %lf",
49
atom->SetVector(x,y,z);
50
atom->SetAtomicNum(etab.GetAtomicNum(type));
57
bool WriteFeat(ostream &ofs,OBMol &mol)
59
char buffer[BUFF_SIZE];
61
ofs << mol.NumAtoms() << endl;
62
ofs << mol.GetTitle() << endl;
65
vector<OBNodeBase*>::iterator i;
66
for(atom = mol.BeginAtom(i);atom;atom = mol.NextAtom(i))
68
sprintf(buffer,"%-3s %8.5f %8.5f %8.5f ",
69
etab.GetSymbol(atom->GetAtomicNum()),
73
ofs << buffer << endl;