In Tinker, all the modules that deal with certain interaction terms are split into one subroutine that computes only the energy, and one that computes energy and forces. In our case, we slightly deviate from the standard pattern and we added a single subroutine called ddx_run which has a logical argument for doing the forces. In turn, this is called by the Tinker subroutines for solvation, if a ddX solvation is set. Algorithm 1 shows the inner workings of the ddx_run subroutine, the subroutines called reflect the example case reported in fig. . All the inputs are read from global variables in Fortran modules, and the outputs (energy and optionally forces) are also written to global variables in modules.