|
25 | 25 | #include <algorithm>
|
26 | 26 | #include <iomanip>
|
27 | 27 | #include <ctime>
|
| 28 | +#include <boost/format.hpp> |
28 | 29 |
|
29 | 30 | #include "ObjCryst/Quirks/VFNStreamFormat.h"
|
30 | 31 | #include "ObjCryst/ObjCryst/Molecule.h"
|
@@ -2292,8 +2293,12 @@ void Molecule::XMLOutput(ostream &os,int indent)const
|
2292 | 2293 | for(pos=mvRigidGroup.begin();pos!=mvRigidGroup.end();++pos)
|
2293 | 2294 | {
|
2294 | 2295 | XMLCrystTag tagg("RigidGroup",false,true);
|
2295 |
| - for(set<MolAtom *>::const_iterator at=(*pos)->begin();at!=(*pos)->end();++at) |
2296 |
| - tagg.AddAttribute("Atom",(*at)->GetName()); |
| 2296 | + // Need to use Atom1, Atom2 etc.. so a valid XML is produced |
| 2297 | + // See https://github.com/vincefn/objcryst/issues/52 |
| 2298 | + // This won't be backwards-compatible |
| 2299 | + int idx = 0; |
| 2300 | + for (set<MolAtom*>::const_iterator at = (*pos)->begin(); at != (*pos)->end(); ++at) |
| 2301 | + tagg.AddAttribute((boost::format("Atom%d") %idx++).str(), (*at)->GetName()); |
2297 | 2302 | /*
|
2298 | 2303 | tagg.AddAttribute("Q0",(*pos)->mQuat.Q0());
|
2299 | 2304 | tagg.AddAttribute("Q1",(*pos)->mQuat.Q1());
|
@@ -2384,7 +2389,7 @@ void Molecule::XMLInput(istream &is,const XMLCrystTag &tag)
|
2384 | 2389 | {
|
2385 | 2390 | RigidGroup s;
|
2386 | 2391 | for(unsigned int i=0;i<tagg.GetNbAttribute();i++)
|
2387 |
| - if("Atom"==tagg.GetAttributeName(i)) |
| 2392 | + if(tagg.GetAttributeName(i).rfind("Atom", 0)==0) |
2388 | 2393 | s.insert(&(this->GetAtom(tagg.GetAttributeValue(i))));
|
2389 | 2394 | this->AddRigidGroup(s);
|
2390 | 2395 | }
|
|
0 commit comments