[ase-users] How to get the joint images of multiple trajectories?

Shuang Han shuha at dtu.dk
Sun May 24 11:28:39 CEST 2020


Hi all,


Does anyone know how to get the joint images (intersections) of multiple trajectories? The thing is that I am using a bootstrap approach to generate 10 trajectories, each trajectory has the same length but not all same images. Now I want to write a script to get a trajectory of all the joint images contained in all 10 trajectories.

I tried some thing like this:

from ase.io import *
import os

trajs={}
for i, filename in enumerate(sorted(os.listdir('bootstrap-1-training/training-images/'))):
    trajs['{}'.format(i)] = read('bootstrap-1-training/training-images/'+filename, index=':')
joint = set(trajs["0"])
for images in trajs.values():
    joint = joint.intersection(images)
write('joint_images.traj', joint)


However, I got the error that tells me the Atoms objects are unhashable. This means I cannot use set(), and therefore cannot use the Python intersection() function. So I want to know how to get the joint trajectory of multiple trajectories? Also, I would like to know if there are any unique attribute of Atoms project that can be used as identifier of images? For example, if the attribute of image 10 in trajectory 1 is equal to that of image 20 in trajectory 2, we can say these are the same Atoms object.


Best,

Shuang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20200524/45cf79a3/attachment.html>


More information about the ase-users mailing list