1 |
/********************************************************************** |
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_OOPSEFORMAT_HPP |
16 |
#define OB_OOPSEFORMAT_HPP |
17 |
|
18 |
#include <set> |
19 |
|
20 |
#include "mol.hpp" |
21 |
#include "obconversion.hpp" |
22 |
#include "obmolecformat.hpp" |
23 |
|
24 |
#ifdef HAVE_SSTREAM |
25 |
#include <sstream> |
26 |
#else |
27 |
#include <strstream> |
28 |
#endif |
29 |
|
30 |
using namespace std; |
31 |
namespace OpenBabel |
32 |
{ |
33 |
|
34 |
class OOPSEFormat : public OBMoleculeFormat |
35 |
{ |
36 |
public: |
37 |
//Register this format type ID |
38 |
OOPSEFormat() { |
39 |
OBConversion::RegisterFormat("md", this, "chemical/x-md"); |
40 |
} |
41 |
|
42 |
virtual const char* Description() //required |
43 |
{ |
44 |
return |
45 |
"OOPSE combined meta-data / cartesian coordinates format\n"; |
46 |
}; |
47 |
|
48 |
virtual const char* SpecificationURL() |
49 |
{ return "http://www.oopse.org";}; //optional |
50 |
|
51 |
virtual const char* GetMIMEType() |
52 |
{ return "chemical/x-md"; }; |
53 |
|
54 |
virtual unsigned int Flags() { return WRITEONEONLY;} |
55 |
|
56 |
//*** This section identical for most OBMol conversions *** |
57 |
//////////////////////////////////////////////////// |
58 |
/// The "API" interface functions |
59 |
//virtual bool ReadMolecule(OBBase* pOb, OBConversion* pConv); |
60 |
virtual bool WriteMolecule(OBBase* pOb, OBConversion* pConv); |
61 |
|
62 |
private: |
63 |
bool AreSameFragments(OBMol& mol, vector<int>& frag1, vector<int>& frag2); |
64 |
void findAngles(OBMol& mol); |
65 |
OBMol* createMolFromFragment(OBMol& mol, vector<int>& fragment); |
66 |
void WriteMDFile(vector<OBMol*> mols, vector<int> numMols, ostream& os, OBMol& mol, vector<int>& indices); |
67 |
}; |
68 |
} |
69 |
#endif |