parameters = {
    'O': {
        '0': [3.0, 13.2, 2.2, 5.7, 1.5, 0.3, 0.8, 32.9, 0.2],
        '1-': [4.1, 12.8, 1.6, 4.1, 1.53, 47.0, -20.3, -0.0, 21.9],
    },
    'Si': {
        '0': [5.6, 2.6, 3.0, 38.6, 2.6, 0.9, 1.3, 93.5, 1.2],
        '4+': [4.4, 1.6, 3.2, 3.4, 1.1, 0.2, 0.4, 6.6, 0.7],
    },
}

charges = {
    'O': '0',
    'Si': '0',
}

md_trajectory = nlread('SiO2simulation_traj.hdf5', MDTrajectory,)[0]

xray_scattering = XRayScattering(
    md_trajectory,
    maximum_q_value=15.0 * Angstrom**-1,
    q_resolution=0.05 * Angstrom**-1,
    cutoff_radius=10 * Angstrom,
    time_resolution=399*fs,
    charges=charges,
    parameters=parameters
)

# Get the q-values and the X-ray structure function.
q_values = xray_scattering.qRange()
s_q      = xray_scattering.data()

model = Plot.PlotModel(x_unit=Angstrom**-1)
model.title().setText('X-ray scattering')
model.xAxis().setLabel('q')
model.yAxis().setLabel('S(q)')
model.legend().setVisible(True)

line = Plot.Line(q_values, s_q)
line.setLabel('Amorphous hafnia')
model.addItem(line)

# Set the ranges and show the plot
model.setLimits()
Plot.show(model)
