[ase-users] Error reading xsd files
Gaël Donval
G.Donval at bath.ac.uk
Fri May 19 21:24:46 CEST 2017
Hi,
> 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?
I don't know, but if it is not working for you and as long as nothing
else gets broken in the process, I don't see why it should be limited
like so.
> and, if it need fixing, what should I do to suggest a fixed version?
Well, the best path would be to submit a merge request on gitlab with
your changes and a test (with a file known not to work until now).
If you are not sure how to do that or don't have much time to spend on
this, you could submit a bug on gitlab instead with the code and a non-
working file in comments.
A proper merge request will make the inclusion faster but requires you
to learn about the git versioning system whereas a bug is just a report
as you would do here but it's easier for us to track.
If I remember about this on Monday, I'll make a merge request.
>
> 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
Thanks again for your contribution.
Gaël
> ...
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
More information about the ase-users
mailing list