Combinations and Filters

So there is now the beginning of a possible re-write of the DBST that uses basically the same approach, but is a bit more flexible. The code is here, but it's still a bit rough.

The original idea seems to have been to encode arrangements of double bonds for different ring sizes as a kind of 'library'. For each ring, a particular arrangement is picked until all possible combinations are generated. As a concrete example, see this example for a napthalene skeleton:

Here, the arrangements (1, 2) are applied to each ring (A, B) and then these are combined. Of the four combinations (A1B1, A2B1, A1B2, A2B2) only three are valid. The A1B2 combination has two atoms highlighted in red that have two double bonds and one single bond.

So one way to filter the combinations is to try and type the atoms, and reject any structure that has untypeable atoms. Another possible filter rejects structures that don't have atoms that are SP2 hybridized. Both of these are from the original code, but implemented as instances of a ChemicalFilter interface.

This is quite similar - uncoincidentally- to the approach in SMSD where graph-theoretical tools are used to generate possible subgraph matches, and then a chemical filter is used to rank the results. Ranking and filtering are not quite the same, so perhaps there should be a ChemicalRanker interface? It would be a little like an Enumeration, except that it might not be a total ordering, but a partial order.