Forum Navigation
You need to log in to create posts and topics.

data manipulation

Hi, I have a very simple question regarding the dataframe object in python interface. How can I remove particular indices from a data structure without using "DeleteSelectedModifier()". In other words, is there any command similar to create_particles that remove particular atoms from both position and particleType array accordingly?

Thanks

Hi,

The PropertyContainer class doesn't provide a direct method yet to delete elements. We can add that in a future version of OVITO if there is a need. In the meantime, I suggest you create a particle selection first and then apply the DeleteSelectedModifier in place by calling DataCollection.apply():

indices = [97, 24, 203] # The particle indices to delete

data.particles_.create_property('Selection')[indices] = 1
data.apply(DeleteSelectedModifier(operate_on={'particles'}))

-Alex