| 13 |
|
GNU General Public License for more details. |
| 14 |
|
***********************************************************************/ |
| 15 |
|
|
| 16 |
< |
#include "mol.hpp" |
| 17 |
< |
#include "obconversion.hpp" |
| 16 |
> |
#include "tinkerformat.hpp" |
| 17 |
|
|
| 18 |
|
using namespace std; |
| 19 |
|
namespace OpenBabel |
| 20 |
|
{ |
| 21 |
|
|
| 23 |
– |
class TinkerFormat : public OBFormat |
| 24 |
– |
{ |
| 25 |
– |
public: |
| 26 |
– |
//Register this format type ID |
| 27 |
– |
TinkerFormat() |
| 28 |
– |
{ |
| 29 |
– |
OBConversion::RegisterFormat("txyz",this); |
| 30 |
– |
} |
| 31 |
– |
|
| 32 |
– |
virtual const char* Description() //required |
| 33 |
– |
{ |
| 34 |
– |
return |
| 35 |
– |
"Tinker MM2 format\n \ |
| 36 |
– |
No comments yet\n"; |
| 37 |
– |
}; |
| 38 |
– |
|
| 39 |
– |
virtual const char* SpecificationURL() |
| 40 |
– |
{return "http://dasher.wustl.edu/tinker/";}; //optional |
| 41 |
– |
|
| 42 |
– |
//Flags() can return be any the following combined by | or be omitted if none apply |
| 43 |
– |
// NOTREADABLE READONEONLY NOTWRITABLE WRITEONEONLY |
| 44 |
– |
virtual unsigned int Flags() |
| 45 |
– |
{ |
| 46 |
– |
return NOTREADABLE | WRITEONEONLY; |
| 47 |
– |
}; |
| 48 |
– |
|
| 49 |
– |
//*** This section identical for most OBMol conversions *** |
| 50 |
– |
//////////////////////////////////////////////////// |
| 51 |
– |
/// The "API" interface functions |
| 52 |
– |
virtual bool WriteMolecule(OBBase* pOb, OBConversion* pConv); |
| 53 |
– |
|
| 54 |
– |
//////////////////////////////////////////////////// |
| 55 |
– |
/// The "Convert" interface functions |
| 56 |
– |
virtual bool WriteChemObject(OBConversion* pConv) |
| 57 |
– |
{ |
| 58 |
– |
//Retrieve the target OBMol |
| 59 |
– |
OBBase* pOb = pConv->GetChemObject(); |
| 60 |
– |
OBMol* pmol = dynamic_cast<OBMol*> (pOb); |
| 61 |
– |
bool ret=false; |
| 62 |
– |
if(pmol) |
| 63 |
– |
ret=WriteMolecule(pmol,pConv); |
| 64 |
– |
|
| 65 |
– |
std::string auditMsg = "OpenBabel::Write molecule "; |
| 66 |
– |
std::string description(Description()); |
| 67 |
– |
auditMsg += description.substr( 0, description.find('\n') ); |
| 68 |
– |
obErrorLog.ThrowError(__FUNCTION__, |
| 69 |
– |
auditMsg, |
| 70 |
– |
obAuditMsg); |
| 71 |
– |
|
| 72 |
– |
delete pOb; |
| 73 |
– |
return ret; |
| 74 |
– |
}; |
| 75 |
– |
}; |
| 76 |
– |
//*** |
| 77 |
– |
|
| 78 |
– |
//Make an instance of the format class |
| 79 |
– |
TinkerFormat theTinkerFormat; |
| 80 |
– |
|
| 81 |
– |
///////////////////////////////////////////////////////////////// |
| 82 |
– |
|
| 22 |
|
bool TinkerFormat::WriteMolecule(OBBase* pOb, OBConversion* pConv) |
| 23 |
|
{ |
| 24 |
|
OBMol* pmol = dynamic_cast<OBMol*>(pOb); |