~ubuntu-branches/ubuntu/vivid/openbabel/vivid-proposed

« back to all changes in this revision

Viewing changes to src/amber.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck
  • Date: 2002-02-01 01:19:44 UTC
  • Revision ID: james.westby@ubuntu.com-20020201011944-4a9guzcsnpezzawx
Tags: upstream-1.99
ImportĀ upstreamĀ versionĀ 1.99

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**********************************************************************
 
2
Copyright (C) 2000 by OpenEye Scientific Software, Inc.
 
3
 
 
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.
 
7
 
 
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
***********************************************************************/
 
13
 
 
14
#include "mol.h"
 
15
 
 
16
namespace OpenBabel {
 
17
 
 
18
 
 
19
bool ReadAmberPrep(istream &ifs,OBMol &mol,char *title)
 
20
{
 
21
  char buffer[BUFF_SIZE];
 
22
  string str,str1;
 
23
  OBAtom *atom;
 
24
  OBInternalCoord *coord;
 
25
  vector<string> vs;
 
26
  vector<OBInternalCoord*> internals;
 
27
 
 
28
  ttab.SetFromType("XYZ");
 
29
  mol.BeginModify();
 
30
 
 
31
  while (ifs.getline(buffer,BUFF_SIZE))
 
32
    {
 
33
      tokenize(vs,buffer);
 
34
      if (vs.size() > 8)
 
35
        {
 
36
          atom = mol.NewAtom();
 
37
          coord = new OBInternalCoord();
 
38
          if (mol.NumAtoms() > 1)
 
39
            coord->_a = mol.GetAtom(atoi(vs[4].c_str()));
 
40
          if (mol.NumAtoms() > 2)
 
41
            coord->_b = mol.GetAtom(atoi(vs[5].c_str()));
 
42
          if (mol.NumAtoms() > 3)
 
43
            coord->_c = mol.GetAtom(atoi(vs[6].c_str()));
 
44
          coord->_dst = atof(vs[7].c_str());
 
45
          coord->_ang = atof(vs[8].c_str());
 
46
          coord->_tor = atof(vs[9].c_str());
 
47
          internals.push_back(coord);
 
48
 
 
49
          atom->SetAtomicNum(etab.GetAtomicNum(vs[1].c_str()));
 
50
          ttab.SetToType("INT"); ttab.Translate(str,vs[1]); 
 
51
          atom->SetType(str);
 
52
 
 
53
          if (!ifs.getline(buffer,BUFF_SIZE)) break;
 
54
          tokenize(vs,buffer);
 
55
        }
 
56
    }
 
57
  InternalToCartesian(internals,mol);
 
58
  mol.EndModify();
 
59
 
 
60
  mol.ConnectTheDots();
 
61
  mol.SetTitle(title);
 
62
  return(true);
 
63
}
 
64
 
 
65
} // namespace