[ase-users] error with ag

Carsten Rostgaard Carsten.Rostgaard at fysik.dtu.dk
Thu Feb 19 08:57:48 CET 2009


Jep. I just want to confirm the problem and solution. I had the same 
problem a while back.

The problem occurs if you saved trajectory files with constraints during 
the period when the base class FixConstraint in ase/constraints.py 
inherited from Object, and you try to read them in now.

To comment on JJ's question on wheter or not we should fix it:

The manual fix is, as Janne correctly suggests, that you just change 
line 15 in ase/constraints.py from
class FixConstraint:
to
class FixConstraint(Object):
and everything works (for me at least).

We could write a conversion that detects the problem, but it would be an 
ugly hack, as we should read in the file with a FixConstraint(Object), 
then remove the constraints and reattach a similar set of old-style 
constraints, then save the file.

It is doable, but maybe the manual hack is acceptable?

Janne Blomqvist wrote:
> pgmoses wrote:
>> ag used to work like at charm, but I updated it today and now I get the
>> following error when trying to read a trajectory file
> [snip]
>> AttributeError: class FixAtoms has no attribute '__new__'
>
> Er,
>
> this seems to be my fault. Sorry about that. As part of making 
> constraints work properly with Atoms.__getitem__(), I made them 
> inherit from object (new-style classes). This was around r643-r649 (no 
> link since ase-svncheckings wasn't up and running then). Then in r750 
> jensj made them old-style classes again, presumably he hit the same 
> problem as you:
>
> https://listserv.fysik.dtu.dk/pipermail/ase-svncheckins/2009-January/000096.html 
>
>
> I suppose you could temporarily add back the object superclass to 
> FixConstraint, read in your trajectory, write it out in some other 
> format, make FixConstraint old-style once again, read in the 
> trajectory and write it out in .traj format.



More information about the ase-users mailing list