Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save olas/97248 to your computer and use it in GitHub Desktop.
Save olas/97248 to your computer and use it in GitHub Desktop.
Iteratively build mol using JCP
/*******************************************************************************
* Bioclipse-script to iteratively build a molecule in JChemPaint
* Author: Ola Spjuth
* Author: Egon Willighagen
******************************************************************************/
//Start with a carbon and open in JCP
mol=cdk.fromSMILES("C")
mol2=cdk.generate2dCoordinates(mol)
ui.open(mol2)
//Add some atoms and bonds and wait 1 sec in between
atom=jcp.getModel().getAtomContainer().getAtom(0);
jcp.moveTo(atom,jcp.newPoint2d(5,5));
atom=jcp.addAtom("C", atom)
js.delay(1)
atom=jcp.addAtom("C", atom)
js.delay(1)
atom=jcp.addAtom("C", atom)
js.delay(1)
atom=jcp.addAtom("C", atom)
js.delay(1)
jcp.addPhenyl(atom)
js.delay(1)
molecule=jcp.getModel().getAtomContainer()
atom=molecule.getAtom(molecule.getAtomCount()-1);
atom=jcp.addAtom("C", atom)
js.delay(1)
atom=jcp.addAtom("C", atom)
js.delay(1)
jcp.addRing(atom,5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment