13 |
|
GNU General Public License for more details. |
14 |
|
***********************************************************************/ |
15 |
|
|
16 |
< |
#include "mol.hpp" |
17 |
< |
#include "obconversion.hpp" |
18 |
< |
#include "obmolecformat.hpp" |
16 |
> |
#include "xyzformat.hpp" |
17 |
|
|
20 |
– |
#ifdef HAVE_SSTREAM |
21 |
– |
#include <sstream> |
22 |
– |
#else |
23 |
– |
#include <strstream> |
24 |
– |
#endif |
18 |
|
|
19 |
|
using namespace std; |
20 |
|
namespace OpenBabel |
21 |
|
{ |
22 |
|
|
30 |
– |
class XYZFormat : public OBMoleculeFormat |
31 |
– |
{ |
32 |
– |
public: |
33 |
– |
//Register this format type ID |
34 |
– |
XYZFormat() |
35 |
– |
{ |
36 |
– |
OBConversion::RegisterFormat("xyz", this, "chemical/x-xyz"); |
37 |
– |
} |
38 |
– |
|
39 |
– |
virtual const char* Description() //required |
40 |
– |
{ |
41 |
– |
return |
42 |
– |
"XYZ cartesian coordinates format\n \ |
43 |
– |
Read Options e.g. -as\n\ |
44 |
– |
s Output single bonds only\n\ |
45 |
– |
b Disable bonding entirely\n\n"; |
46 |
– |
}; |
47 |
– |
|
48 |
– |
virtual const char* SpecificationURL() |
49 |
– |
{return "http://openbabel.sourceforge.net/formats/xyz.shtml";}; //optional |
50 |
– |
|
51 |
– |
virtual const char* GetMIMEType() |
52 |
– |
{ return "chemical/x-xyz"; }; |
53 |
– |
|
54 |
– |
//*** This section identical for most OBMol conversions *** |
55 |
– |
//////////////////////////////////////////////////// |
56 |
– |
/// The "API" interface functions |
57 |
– |
virtual bool ReadMolecule(OBBase* pOb, OBConversion* pConv); |
58 |
– |
virtual bool WriteMolecule(OBBase* pOb, OBConversion* pConv); |
59 |
– |
}; |
60 |
– |
//*** |
61 |
– |
|
62 |
– |
//Make an instance of the format class |
63 |
– |
XYZFormat theXYZFormat; |
64 |
– |
|
65 |
– |
///////////////////////////////////////////////////////////////// |
23 |
|
bool XYZFormat::ReadMolecule(OBBase* pOb, OBConversion* pConv) |
24 |
|
{ |
25 |
|
OBMol* pmol = dynamic_cast<OBMol*>(pOb); |