# Load the configuration
configuration = nlread("equilibrated_acrylonitrile.hdf5")[0]

# Create and set the calculator
builder = OPLSPotentialBuilder()
calculator = SoftMatterCalculator(builder, use_lennard_jones_pme=True, assign_atom_types=True)
configuration.setCalculator(calculator)

# Set the simulation
atomic_constraints = [FixCenterOfMass()]
method = NVTNoseHoover()
simulation = SoftMatterDynamicsSimulation(configuration, method, atomic_constraints=atomic_constraints)
simulation.setLogging(1000)
simulation.setTrajectory(10000, "acrylonitrile_trajectory.hdf5")

# Set the measurement hook
measurement = SoftMatterDynamicsMeasurements(
    kinetic_energy=True,
    potential_energy=True,
    dipole=All,
    pressure=DiagonalOnly,
    call_interval=100,
)

# Run the simulation
simulation.simulate(100000, hook_functions=[measurement])
