Problem with add_element_from_formula

I have been trying to add H2O using the add_element_from_formula but instead of it automatically adding all the correct nuclide percentages, it is showing just H1 and H2 atomic percentages. Please guide me on how to proceed further

Using add_element should handle the nuclide percentages automatically.

water = openmc.Material(name='water')
water.set_density('g/cc', 1.0)
water.add_element('H', 2)
water.add_element('O', 1)
print(water)

Hi Aditya, welcome to the openmc community,
Just to make sure, are you typing ‘H2O’ or ‘H20’ in your script? It looks like H20 from your screenshot.

1 Like

Thank You for clarifying and catching such a dumb mistake. I am not proud of the time I wasted on this.