[ase-users] Changing atom indices in an existing atoms object
Ask Hjorth Larsen
asklarsen at gmail.com
Wed Nov 29 18:46:32 CET 2017
Hi Andrew,
2017-11-29 18:17 GMT+01:00 Andrew Rosen via ase-users
<ase-users at listserv.fysik.dtu.dk>:
> Hi ASE users,
>
> Given an existing atoms object, is there a way to swap the indices of
> certain atoms? Each atom in the atoms object has an index property, but
> changing it only changes the copy.
I think you cannot because Atoms (apparently) does not implement
__setitem__. One could well implement it, and it would be logical to
have.
Meanwhile one would have to do something terrible like:
atoms2 = atoms[my_permutation_indices]
del atoms[:]
atoms += atoms2
Now the atoms object was changed in-place :)
Best regards
Ask
>
> Andrew
>
> _______________________________________________
> 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