[ase-users] Error reading xsd files
Oscar Xavier Guerrero
oscarxavier.ox at gmail.com
Fri May 19 02:22:16 CEST 2017
Hello,
When reading xsd files of a molecule (with no cell) I got None in return.
The read_xsd function in ase/io/xsd.py reads the atom positions (Atom3d)
only when the file has them inside either IdentityMapping or Molecule in
the xml structure. But my files have them directly under root, thus they
don't get read.
Is there a reason the function only reads those places?
and, if it need fixing, what should I do to suggest a fixed version?
Here's the modification I made to fix it temporarily
...
elif atomtreeroot.find('Molecule') is not None:
system = atomtreeroot.find('Molecule')
else:
system = atomtreeroot
coords = list()
formula = str()
for atom in system:
if atom.tag == 'Atom3d':
symbol = atom.get('Components')
formula += symbol
xyz = atom.get('XYZ')
coord = [float(coord) for coord in xyz.split(',')]
coords.append(coord)
atoms = Atoms(formula, pbc=False)
atoms.set_scaled_positions(coords)
return atoms
...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20170518/4965cedc/attachment.html>
More information about the ase-users
mailing list