Add H atom to the system randomly

Hi all:
I am trying to add H atoms to a system randomly, limiting with the constant distance between O and H, the detailed steps are shown in the figure.


But i do not know whether the pymatgen can realize this process, Can someone help me with this?

Red

Hi Red,

Not sure if you already solved this by now but to give you a rough layout of how to do this with pymatgen:

Loop through sites in your pymatgen structure:

  1. if the site is an oxygen store its cartesian coordinates
  2. Initialize a random vector (e.g. with numpy) divide it by its length and multiply it by 0.98.
  3. Add site of H with the following cartesian coordinates: The oxygen cartesian coordinates from step 1 plus the random vector from step 2.

-Peter