| 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 |
{ |
| 40 |
OBConversion::RegisterFormat("in", this, "chemical/x-in"); |
| 41 |
} |
| 42 |
|
| 43 |
virtual const char* Description() //required |
| 44 |
{ |
| 45 |
return |
| 46 |
"oopse cartesian coordinates format\n"; |
| 47 |
}; |
| 48 |
|
| 49 |
virtual const char* SpecificationURL() |
| 50 |
{ return "http://www.oopse.org";}; //optional |
| 51 |
|
| 52 |
virtual const char* GetMIMEType() |
| 53 |
{ return "chemical/x-in"; }; |
| 54 |
|
| 55 |
virtual unsigned int Flags() { return WRITEONEONLY;} |
| 56 |
|
| 57 |
//*** This section identical for most OBMol conversions *** |
| 58 |
//////////////////////////////////////////////////// |
| 59 |
/// The "API" interface functions |
| 60 |
//virtual bool ReadMolecule(OBBase* pOb, OBConversion* pConv); |
| 61 |
virtual bool WriteMolecule(OBBase* pOb, OBConversion* pConv); |
| 62 |
|
| 63 |
private: |
| 64 |
bool AreSameFragments(OBMol& mol, vector<int>& frag1, vector<int>& frag2); |
| 65 |
void findAngles(OBMol& mol); |
| 66 |
OBMol* createMolFromFragment(OBMol& mol, vector<int>& fragment); |
| 67 |
void WriteMDFile(vector<OBMol*> mols, vector<int> numMols, ostream& os); |
| 68 |
void WriteINFile(OBMol& mol, ostream& ofs, vector<int>& indices); |
| 69 |
}; |
| 70 |
} |
| 71 |
#endif |