13 |
|
GNU General Public License for more details. |
14 |
|
***********************************************************************/ |
15 |
|
|
16 |
< |
#include <set> |
17 |
< |
|
18 |
< |
#include "mol.hpp" |
19 |
< |
#include "obconversion.hpp" |
20 |
< |
#include "obmolecformat.hpp" |
21 |
< |
|
22 |
< |
#ifdef HAVE_SSTREAM |
23 |
< |
#include <sstream> |
24 |
< |
#else |
25 |
< |
#include <strstream> |
26 |
< |
#endif |
27 |
< |
|
28 |
< |
using namespace std; |
16 |
> |
#include "oopseformat.hpp" |
17 |
|
namespace OpenBabel |
18 |
|
{ |
19 |
|
|
32 |
– |
class OOPSEFormat : public OBMoleculeFormat |
33 |
– |
{ |
34 |
– |
public: |
35 |
– |
//Register this format type ID |
36 |
– |
OOPSEFormat() |
37 |
– |
{ |
38 |
– |
OBConversion::RegisterFormat("in", this, "chemical/x-in"); |
39 |
– |
} |
40 |
– |
|
41 |
– |
virtual const char* Description() //required |
42 |
– |
{ |
43 |
– |
return |
44 |
– |
"oopse cartesian coordinates format\n"; |
45 |
– |
}; |
46 |
– |
|
47 |
– |
virtual const char* SpecificationURL() |
48 |
– |
{ return "";}; //optional |
49 |
– |
|
50 |
– |
virtual const char* GetMIMEType() |
51 |
– |
{ return "chemical/x-in"; }; |
52 |
– |
|
53 |
– |
virtual unsigned int Flags() { return WRITEONEONLY;} |
54 |
– |
|
55 |
– |
//*** This section identical for most OBMol conversions *** |
56 |
– |
//////////////////////////////////////////////////// |
57 |
– |
/// The "API" interface functions |
58 |
– |
//virtual bool ReadMolecule(OBBase* pOb, OBConversion* pConv); |
59 |
– |
virtual bool WriteMolecule(OBBase* pOb, OBConversion* pConv); |
60 |
– |
|
61 |
– |
private: |
62 |
– |
bool AreSameFragments(OBMol& mol, vector<int>& frag1, vector<int>& frag2); |
63 |
– |
void findAngles(OBMol& mol); |
64 |
– |
OBMol* createMolFromFragment(OBMol& mol, vector<int>& fragment); |
65 |
– |
void WriteMDFile(vector<OBMol*> mols, vector<int> numMols); |
66 |
– |
void WriteINFile(OBMol& mol, ostream& ofs, vector<int>& indices); |
67 |
– |
}; |
68 |
– |
|
69 |
– |
|
70 |
– |
//Make an instance of the format class |
71 |
– |
OOPSEFormat theOOPSEFormat; |
72 |
– |
|
73 |
– |
//////////////////////////////////////////////////////////////// |
74 |
– |
|
20 |
|
bool OOPSEFormat::WriteMolecule(OBBase* pOb, OBConversion* pConv) |
21 |
|
{ |
22 |
|
OBMol* pmol = dynamic_cast<OBMol*>(pOb); |