I'm using the 2.3 release.

Using bond.setDisplay(IBond.Display.Solid) does work, but there's a big gotcha. If the molecule still needs to be layed out (e.g. no 2D coordinates) then when the DepictionGenerator does the layout the bond's display property gets reset to the chiral representation.

The workaround is to make sure that 2D coordinates are present (e.g. using StructureDiagramGenerator) and then set the display property.

Tim


On 20/08/2019 17:31, John Mayfield wrote:
Are you using the very latest release? I think it's an over site. Try

    bond.setDisplay(IBond.Display.Solid);


On Tue, 20 Aug 2019 at 16:40, Tim Dudgeon <tdudgeon...@gmail.com <mailto:tdudgeon...@gmail.com>> wrote:

    Hi, I'm wanting to depict a molecule without sterochemistry, but
    the DepictionGenerator stubbornly seems to add it back.
    What is the way to do this? In the example below a squiggle bond
    is displayed even though all bonds have been set to Stereo.NONE
    and I have already layed out the molecule.

    void "no stereo"() {
IAtomContainer mol = ChemUtils.readSmiles("c1ccc(N=C2SCCN2c2ccccc2)cc1")
         StructureDiagramGenerator sdg =new StructureDiagramGenerator();
         sdg.setMolecule(mol);
         sdg.generateCoordinates(new Vector2d(0,1));
         mol = sdg.getMolecule();
         for (IBond bond : mol.bonds()) {
             bond.setStereo(IBond.Stereo.NONE);
         }
         DepictionGenerator g =new DepictionGenerator()
         Depiction d = g.depict(mol)

         when:
         def img = d.toImg()
         ByteArrayOutputStream out =new ByteArrayOutputStream();
         ImageIO.write(img,"png", out);
         out.close();
         byte[] png = out.toByteArray();
         Files.write(java.nio.file.Paths.get("/tmp/myimage5.png"), png)

         then:
         png !=null png.length > 0 }


    _______________________________________________
    Cdk-user mailing list
    Cdk-user@lists.sourceforge.net <mailto:Cdk-user@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/cdk-user

_______________________________________________
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to