# Define elements
elements = [Hydrogen, Oxygen, Hydrogen]

# Define coordinates
cartesian_coordinates = [[ 0.474853, -0.026505, -0.631087],
                         [-0.34219 ,  0.029981, -0.147925],
                         [-0.132663, -0.003476,  0.779012]]*Angstrom

# Set up configuration
molecule_configuration = MoleculeConfiguration(
    elements=elements,
    cartesian_coordinates=cartesian_coordinates
    )

# Set up bonds between the atoms.
molecule_configuration.findBonds()

# -------------------------------------------------------------
# Calculator
# -------------------------------------------------------------

# Set up a new TremoloXPotentialSet
potential_set = TremoloXPotentialSet(name='water_urey_bradley')

# Add particle types for Carbon and Hydrogen.
potential_set.addParticleType(
    ParticleType.fromElement(Oxygen)
)
potential_set.addParticleType(
    ParticleType.fromElement(Hydrogen)
)

# Set up a new Urey-Bradley angle potential for H-O-H angles and add it to the potential set.
angle_potential = HarmonicUreyBradleyAnglePotential(
    particleType1='H',
    particleType2='O',
    particleType3='H',
    k=4.33641*eV,
    theta0=1.824218,
    k_ub=5.0*eV/Ang**2,
    S_0=1.54*Ang,
)
potential_set.addPotential(angle_potential)

# Create a new TremoloXCalculator with this potential.
calculator = TremoloXCalculator(parameters=potential_set)

molecule_configuration.setCalculator(calculator)
