Aha! There was an obvious problem : a map is made between atoms in the original reaction and the cloned atoms. This is called "atomatomMap".

However, the problem is that only the reactants are put into the map, so mappings between reactant and product make mappings with null product atoms.