General workflow
of the perturbation topology builder. Algorithm
steps are shown on the left side. Step (0) initializes all relevant
attributes and parameters needed for the search and performs a simple
analysis of the input topologies (e.g., finding rings). After the
initialization step, an iterative search procedure is initiated. Step
(1) based on the current solution (in the very first call, empty solution,
i.e., no matched atoms) generates a list of all possible and allowed
atom matches (pairs) and sorts them according to the estimated number
of additional atom matches that are possible after the atom match
in the question is added to the solution (related to the score calculated
in step 3). Step (2) adds the next atom pair (match) from the sorted
list from step 1 to the current solution and updates it. Step (3)
calculates a score based on the user-defined function and compares
it to the best score (the best solution) enumerated thus far in the
execution of the algorithm. If the score is better than the one of
the current best, the algorithm continues with a next iteration of
step 1. If all atoms of all input topologies are present in the solution,
the solution is saved. An illustration of the execution of the algorithm
is shown on the right based on a toy perturbation problem between
methanol and ethane (compounds represented according to the GROMOS
force field where the methyl groups are modeled as a single united-atom
particle). The current solution in step 1 with two methyl groups matched
(in blue) is shown. Accordingly, the list of potential next atom matches
is generated based on the first neighbors of the atoms in the current
solution. Note that matches with dummy atoms are also explicitly included
in the algorithm. The updated current solution after adding the next
atom match between the oxygen and the second methyl in step 2 is shown
(highlighted in red to notify perturbation in atom type, partial charge,
and mass, with perturbed bonds also marked in red). Finally, the solution
with the maximum number of matched atoms is shown at the bottom, where
the hydrogen atom in the methanol state is marked for removal, i.e.,
perturbation into a noninteracting dummy atom and the other way around
in the ethane state (dummy atom highlighted in light gray).