How to apply arbitrary pair potentials in HPMC

Tip

Don’t waste your time implementing C++ components for HOOMD-blue. You can implement arbitrary potentials with one line of code in hoomd-rs:

let pairwise_cutoff = PairwiseCutoff(Isotropic {
    interaction: |r: f64| 1.0 / (r.powi(12)),
    r_cut: 3.0,
});

To apply arbitrary potentials between in HPMC simulations, you need to implement a C++ component that evaluates the energy. Fork the hpmc-energy-template repository and modify it to compute the desired pair and/or external potentials.

If you previously used CPPPotential potentials, you can copy and paste the C++ code into the template. If you used param_array, you will need to make some modifications to accept parameters from Python.