1
/**********************************************************************
2
Copyright (C) 2001-2003 by Geoffrey R. Hutchison
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation version 2 of the License.
8
This program is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
GNU General Public License for more details.
12
***********************************************************************/
20
bool ReadNWChem(istream &ifs,OBMol &mol,const char *title)
22
char buffer[BUFF_SIZE];
29
while (ifs.getline(buffer,BUFF_SIZE))
31
if(strstr(buffer,"Output coordinates") != NULL)
36
ifs.getline(buffer,BUFF_SIZE); // blank
37
ifs.getline(buffer,BUFF_SIZE); // column headings
38
ifs.getline(buffer,BUFF_SIZE); // ---- ----- ----
39
ifs.getline(buffer,BUFF_SIZE);
41
while (vs.size() == 6)
44
x = atof((char*)vs[3].c_str());
45
y = atof((char*)vs[4].c_str());
46
z = atof((char*)vs[5].c_str());
47
atom->SetVector(x,y,z); //set coordinates
50
atom->SetAtomicNum(etab.GetAtomicNum(vs[1].c_str()));
52
if (!ifs.getline(buffer,BUFF_SIZE)) break;
55
} // if "output coordinates"
59
mol.PerceiveBondOrders();
65
bool WriteNWChem(ostream &ofs,OBMol &mol)
68
char buffer[BUFF_SIZE];
70
ofs << "start molecule" << endl << endl;
71
ofs << "title " << endl << " " << mol.GetTitle() << endl << endl;
73
ofs << "geometry units angstroms print xyz autosym" << endl;
76
for(i = 1;i <= mol.NumAtoms(); i++)
78
atom = mol.GetAtom(i);
79
sprintf(buffer,"%3s%15.5f%15.5f%15.5f",
80
etab.GetSymbol(atom->GetAtomicNum()),
84
ofs << buffer << endl;