ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/openbabel/tinkerformat.hpp
Revision: 2445
Committed: Wed Nov 16 21:22:51 2005 UTC (18 years, 8 months ago) by tim
File size: 2493 byte(s)
Log Message:
adding more readers/writers

File Contents

# User Rev Content
1 tim 2445 /**********************************************************************
2     Copyright (C) 2000 by OpenEye Scientific Software, Inc.
3     Some portions Copyright (C) 2001-2005 by Geoffrey R. Hutchison
4     Some portions Copyright (C) 2004 by Chris Morley
5    
6     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation version 2 of the License.
9    
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13     GNU General Public License for more details.
14     ***********************************************************************/
15     #ifndef OB_TINKERFORMAT_HPP
16     #define OB_TINKERFORMAT_HPP
17    
18     #include "mol.hpp"
19     #include "obconversion.hpp"
20    
21     using namespace std;
22     namespace OpenBabel
23     {
24    
25     class TinkerFormat : public OBFormat
26     {
27     public:
28     //Register this format type ID
29     TinkerFormat()
30     {
31     OBConversion::RegisterFormat("txyz",this);
32     }
33    
34     virtual const char* Description() //required
35     {
36     return
37     "Tinker MM2 format\n \
38     No comments yet\n";
39     };
40    
41     virtual const char* SpecificationURL()
42     {return "http://dasher.wustl.edu/tinker/";}; //optional
43    
44     //Flags() can return be any the following combined by | or be omitted if none apply
45     // NOTREADABLE READONEONLY NOTWRITABLE WRITEONEONLY
46     virtual unsigned int Flags()
47     {
48     return NOTREADABLE | WRITEONEONLY;
49     };
50    
51     //*** This section identical for most OBMol conversions ***
52     ////////////////////////////////////////////////////
53     /// The "API" interface functions
54     virtual bool WriteMolecule(OBBase* pOb, OBConversion* pConv);
55    
56     ////////////////////////////////////////////////////
57     /// The "Convert" interface functions
58     virtual bool WriteChemObject(OBConversion* pConv)
59     {
60     //Retrieve the target OBMol
61     OBBase* pOb = pConv->GetChemObject();
62     OBMol* pmol = dynamic_cast<OBMol*> (pOb);
63     bool ret=false;
64     if(pmol)
65     ret=WriteMolecule(pmol,pConv);
66    
67     std::string auditMsg = "OpenBabel::Write molecule ";
68     std::string description(Description());
69     auditMsg += description.substr( 0, description.find('\n') );
70     obErrorLog.ThrowError(__FUNCTION__,
71     auditMsg,
72     obAuditMsg);
73    
74     delete pOb;
75     return ret;
76     };
77     };
78     }
79     #endif