Skip to content

Instantly share code, notes, and snippets.

@egonw
Forked from olas/buildmol
Created April 16, 2009 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save egonw/96594 to your computer and use it in GitHub Desktop.
Save egonw/96594 to your computer and use it in GitHub Desktop.
Build a molecule using Bioclipse script for JChemPaint
/*******************************************************************************
* 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