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

How to delete specific molecules from the whole dump structure

I have structure has H2O, O2, and H2

There are two types of H2O in this structure:

1- Original inserted H2O (which I need to delete)

2-New H2O that formed by (O2 and H2 after dissociation) and I need to count these "new H2O"

I have done this process:

------------------------------------------------------

Compute property:

Output property >> delete_original_H2O

Cutoff radius 0.96

Neighbor expression (@ParticleType == 3) && (ParticleType == 2)

Expression selection:

Operate On -> particles

Boolean expression delete_original_H2O == 2

-----------------------------------------------------------

But this progress will not delete them entirely and in other frames if this condition not true the original H2O appears again,

So is there any way to do that?

 

Thank you

Uploaded files:

Hi,

I would suggest to use the Freeze Property modifier to freeze the result of the Compute property modifier at frame 0. That way you can make this property accessible at subsequent frames too and you can compare the current oxygen coordination count to the one at frame 0.

I attached a screenshot for you to show the workflow. Let me know if you have further questions,

Constanze

Uploaded files:
  • workflow.png

Thank you Constanze

it works for me somehow,

But I don't know how to use the command of expression selection "O_coordination_frame0 != 0" it is not active for me,

also is there any way to delete the (hydrogen atoms type 2 that connected with the Oxygen atom type 3) at frame0?

initially, I want to delete the whole H2O molecules at frames zero

 

Thank you

I froze the property "O_coordination" at frame 0 and saved that in a new property "O_coordination_frame0", simply edit the output property field in the Freeze property Modifier.

Concerning your second question, yes, this should be possible by working with the Expand Selection Modifier to also select the hydrogen atoms. Then you can use another instance of the Freeze Property Modifier to freeze this selection at frame 0. Finally, you can delete the selection with the Delete Selected modifier.

Does that work for you?

Thank you, Constanze

It works very well

 

appreciated

Dear Constanze

I have another question,

If we would like to calculate the number of OO-H or H-OO-H (not H2O), for example, from the above (Dump_H2O_H2_O2.dump) file

how can we do that,?

Note: Particle type = "3" for H and "2" for O

 

I have tried this way:

Compute property:

Output property >> number_of_OOH

Cutoff radius 1.29

Neighbor expression (@ParticleType == 2) && (ParticleType == 3)

Expression selection:

Operate On -> particles

Boolean expression number_of_OOH == 1

But of course not work for me, is there any recommended way?

 

Thank you

Hi,

I don't think you can achieve that with the Compute property modifier.
What you could do is to use the Create bonds modifier and either write a custom python modifier that counts the different molecules, or you also might find the new Bond analysis modifier helpful, at least to count the frequency of O-O-H bond pairs.

Please see attached screenshot for an example.

Let me know if that works for you.

Uploaded files:
  • bond_analysis.png

Dear Constanze Kalcher

 

Thank you I have tried this with ovito Pro, but still, cant export the number of OOH or HOOH

any other suggestion?

 

Thank you

The number of OOH bonds at least you could take from the bond angle distribution data table, either by exporting the data table and summing up the bond counts of the OOH histogram externally or by using the python interface in the OVITO GUI.

This is an example of a Python script modifier, that let's you access the bond angle distribution data table, sum up the bond counts and stores that information as a global attributes so you can export their time series from the GUI. (Simply go to the Global Attributes tab in the Data Inspector and use the save button shown on the right).

from ovito.data import *
import numpy as np 
def modify(frame, data):
    histogram = data.tables['bond-angle-distr'].y
    # Sum up the individual columns of the vector-valued property array:
    for column, name in enumerate(histogram.component_names):
        data.attributes["{}".format(name)] = np.sum(histogram[:,column])

However, for more complicated molecules, you will need to develop your own bond counting function using the python interface.