The custom force called MLForce that implements the loss function was then added to the system. This is initialized using a PyTorch model to calculate the AEVs, loss function values, and derivatives, as well as a set of target features. This can also include a set of distance restraints between ghost particles that we refer to as "second-order restraints", since they use assignments of two atoms to define a restraint energy. Unless otherwise noted below, we use a distance restraint between every pair of atoms in the molecule that takes a harmonic form: E(r) = k r (rr 0 ) 2 , where r 0 is the distance between those atoms in the target structure and k r is a force constant. Note that the s parameter (Eq. 6) modulates the entire MLForce energy, including the second-order restraints.