[ase-users] error with isinstance
Tristan Maxson
tgmaxson at gmail.com
Thu Jan 12 02:19:05 CET 2017
Can you see what "print type(atom)" returns in this case? I would suspect
it is being upconverted to an Atoms object or something along those lines,
I am not sure how the classes are organized. Either way this will clarify
why isinstance is failing.
Thank you,
Tristan Maxson
On Wed, Jan 11, 2017 at 7:33 PM, Oscar Xavier Guerrero via ase-users <
ase-users at listserv.fysik.dtu.dk> wrote:
> Hello,
>
> I don't know if this is a bug or an overlook on my part.
> I'm writing some code and I'm getting errors caused by a wrongful
> evaluation of the isinstance function in the ase code. The error occurs
> when I have an ase.atoms.Atom object, lets call it atom, and I rerun a
> script that reloads ase modules, then isinstance(atom, ase.atoms.Atom)
> will return False.
>
> I noticed this happening when trying to extend an atoms object and when
> trying to write the object to file, specifically here:
>
> *ase/atoms.py*, line 862, in extend
>
> if isinstance(other, Atom):
>
>
> *ase/io/formats.py*, line 233, in _write
>
> if isinstance(images, Atoms):
>
>
> a misevaluation here leads to different errors later in the code caused by
> a call to len().
>
> This has been very bothersome since I have to constantly restart the
> kernel to avoid these errors. Is there another way to avoid it?
>
>
> Thank you in advance
>
>
>
>
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20170111/21122967/attachment.html>
More information about the ase-users
mailing list