ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-2.0/src/openbabel/gromos96format.hpp
Revision: 2518
Committed: Fri Dec 16 21:52:50 2005 UTC (18 years, 6 months ago) by tim
File size: 4154 byte(s)
Log Message:
changed __FUNCTION__ to __func__ to match C99 standard, and then added
an autoconf test to check for __func__ usability.  Changed some default
compile flags for the Sun architecture

File Contents

# Content
1 /**********************************************************************
2 Copyright (C) 1998-2001 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
16 /* contributed by Walter Scott (wscott@igc.phys.chem.ethz.ch)
17
18 (Actually the routine was copied from write_xyz and and write_pdb and
19 then modified...)
20
21 This is a small routine to write a GROMOS96 formatted
22 "position coordinate block" (POSITION) or a
23 "reduced position coordinate block" (POSITIONRED)
24 The former has name information (atom and residue names) while
25 the latter only has coordinates.
26 This version does not support the writing of binary
27 GROMOS files.
28
29 NOTE 1: the actual formats used in writing out the coordinates
30 do not matter, as GROMOS96 uses free formatted reads.
31 Each line may not be longer than 80 characters.
32
33 (Note, however, in the POSITION block, the first 24 (twenty four)
34 character on each line are ignored when the line is read in by GROMOS)
35 Comments lines, beginning with hash (#) may occur within a block and are
36 used as delimiters for easier reading.
37
38 NOTE 2: Many programs specify the units of the coordinates (e.g. Angstrom).
39 GROMOS96 does NOT, as all physical constants, from K_B to EPS are
40 NOT hardwired into the code, but specified by the user.
41 This allows some (mostly Americans) to use GROMOS96 in KCal and
42 Angstrom and the rest of us to use kJoule and nm.
43 It also makes it easy to use reduced units.
44
45 We get around this by supplying a routine, wr_sco_gr96, which
46 will scale the coordinates by a factor before writing.
47 This routine is then called with the factor set to 1.0 in
48 write_gr96A, or to 0.1 in write_gr96N depending on the users choice.
49 Thus, we always assume that we have read coordinates in Angstrom.
50 *** But now handled by a command line option in new framework.
51 */
52
53 #ifndef OB_GROMOS96FORMAT_HPP
54 #define OB_GROMOS96FORMAT_HPP
55
56 #include "mol.hpp"
57 #include "obconversion.hpp"
58
59 using namespace std;
60 namespace OpenBabel
61 {
62
63 class GROMOS96Format : public OBFormat
64 {
65 public:
66 //Register this format type ID
67 GROMOS96Format()
68 {
69 OBConversion::RegisterFormat("gr96",this);
70 }
71
72 virtual const char* Description() //required
73 {
74 return
75 "GROMOS96 format\n \
76 Write Options e.g. -xn\n\
77 n output nm (not Angstroms)\n";
78 };
79
80 virtual const char* SpecificationURL()
81 {
82 return "";
83 }; //optional
84
85 //Flags() can return be any the following combined by | or be omitted if none apply
86 // NOTREADABLE READONEONLY NOTWRITABLE WRITEONEONLY
87 virtual unsigned int Flags()
88 {
89 return NOTREADABLE | WRITEONEONLY;
90 };
91
92 ////////////////////////////////////////////////////
93 /// The "API" interface functions
94 virtual bool WriteMolecule(OBBase* pOb, OBConversion* pConv);
95
96 ////////////////////////////////////////////////////
97 /// The "Convert" interface functions
98 virtual bool WriteChemObject(OBConversion* pConv)
99 {
100 //Retrieve the target OBMol
101 OBBase* pOb = pConv->GetChemObject();
102 OBMol* pmol = dynamic_cast<OBMol*> (pOb);
103 bool ret=false;
104 if(pmol)
105 ret=WriteMolecule(pmol,pConv);
106
107 std::string auditMsg = "OpenBabel::Write molecule ";
108 std::string description(Description());
109 auditMsg += description.substr( 0, description.find('\n') );
110 obErrorLog.ThrowError(__func__,
111 auditMsg,
112 obAuditMsg);
113
114 delete pOb;
115 return ret;
116 };
117 };
118 }
119 #endif