Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StructureDiagramGenerator ignores setBondLength for ring bonds #384

Closed
bw800402 opened this issue Nov 17, 2017 · 3 comments
Closed

StructureDiagramGenerator ignores setBondLength for ring bonds #384

bw800402 opened this issue Nov 17, 2017 · 3 comments

Comments

@bw800402
Copy link

Setting bond length for StructureDiagramGenerator has no affect on the bond length of ring bonds. A minimal demonstration:

SmilesParser sp = new SmilesParser(SilentChemObjectBuilder.getInstance());
IAtomContainer m = null;
m = sp.parseSmiles("CCCCCC1CCCCC1");
StructureDiagramGenerator sdg = new StructureDiagramGenerator();
sdg.setBondLength(28);
sdg.setMolecule(m);
sdg.generateCoordinates();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
MDLV2000Writer writer = new MDLV2000Writer(
baos
);
writer.write((IAtomContainer)sdg.getMolecule());
System.out.println(new String(baos.toByteArray()));
writer.close();

This results in a molecule with very long acyclic bonds and tiny (relatively) ring bonds.

@johnmay
Copy link
Member

johnmay commented Nov 17, 2017

I'll deprecate that method, the correct way to do this is layout the molecule then scale it.

@bw800402
Copy link
Author

bw800402 commented Nov 17, 2017 via email

@johnmay
Copy link
Member

johnmay commented Nov 18, 2017

Possible - but abbreviations are best implemented as display shortcuts, the entire structure is laid out and the abbreviations is tagged to simply hide the contracted parts and rename the connections. ChemAxon have this idea that you can contract and expand the physical connection table but this isn't really how it works in the MDL and ChemDraw formats.

More here:
http://efficientbits.blogspot.co.uk/2015/11/bringing-molfile-sgroups-to-cdk.html

@johnmay johnmay closed this as completed Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants