@Test
public void multipleSalts() throws Exception {

    SmilesParser sp = new SmilesParser(SilentChemObjectBuilder.getInstance());
    IAtomContainer mol = sp.parseSmiles("[K+].[Al+3].[Cl-].[Cl-].[K+].[Cl-].[Cl-].[Al+3].[Cl-].[Pt+2]([NH3])[NH3].[Cl-].[Cl-].[Cl-].[O-][C+]([O-])[O-]");
    layout(mol);
    for (IAtom atom : mol.atoms())
        assertNotNull(atom.getPoint2d());
    IAtom platinum = null;
    Set<IAtom> aluminiums = new HashSet<>();
    Set<IAtom> potassiums = new HashSet<>();
    Set<IAtom> chlorines = new HashSet<>();
    Set<IAtom> oxygens = new HashSet<>();
    for (IAtom atom : mol.atoms()) {
        if (atom.getSymbol().equals("Cl"))
            chlorines.add(atom);
        else if (atom.getSymbol().equals("O"))
            oxygens.add(atom);
        else if (atom.getSymbol().equals("Al"))
            aluminiums.add(atom);
        else if (atom.getSymbol().equals("K"))
            potassiums.add(atom);
        else if (atom.getSymbol().equals("Pt"))
            platinum = atom;
    }
    assertNotNull(platinum);
    assertThat(potassiums.size(), is(2));
    assertThat(oxygens.size(), is(3));
    assertThat(chlorines.size(), is(8));
    // platin has two chlorines...
    int ptFound = 0;
    for (IAtom chlorine : chlorines) {
        double delta = chlorine.getPoint2d().distance(platinum.getPoint2d()) - 1.5*SDG.getBondLength();
        if (Math.abs(delta) < 0.01)
            ptFound++;
    }
    assertThat(ptFound, is(2));
    // K+ each have an oxygen
    for (IAtom potassium : potassiums) {
        int kFound = 0;
        for (IAtom oxygen : oxygens) {
            double delta = oxygen.getPoint2d().distance(potassium.getPoint2d()) - 1.5*SDG.getBondLength();
            if (Math.abs(delta) < 0.01)
                kFound++;
        }
        assertThat(kFound, is(1));
    }
    // Al+3 each have 3 chlorines
    for (IAtom aluminium : aluminiums) {
        int clFound = 0;
        for (IAtom chlorine : chlorines) {
            double delta = chlorine.getPoint2d().distance(aluminium.getPoint2d()) - 1.5*SDG.getBondLength();
            if (Math.abs(delta) < 0.01)
                clFound++;
        }
        assertThat(clFound, is(3));
    }
}