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

# Create the soft matter calculator
builder = OPLSPotentialBuilder()
calculator = SoftMatterCalculator(builder)
configuration.setCalculator(calculator)

# Create simulation
method = NVTNoseHoover(
    time_step=2 * fs,
    initial_velocity=ConfigurationVelocities(),
)
simulation = SoftMatterDynamicsSimulation(
    configuration, method, bond_constraints=HydrogenBonds
)
simulation.setLogging(1000)
simulation.setTrajectory(1000, "pvc_trajectory.hdf5")

# Create a measurement of the pressure
hook = SoftMatterDynamicsMeasurements(dipole=All, call_interval=100)

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

# Get the final configuration
final_configuration = simulation.currentConfiguration()
nlsave("pvc_trajectory.hdf5", final_configuration)
