Is there any code library (in any programming language) or software capable of producing images of ball and stick diagrams?

Example of an image of a ball-and-stick model for Ammonia:

Ball and stick diagram for Ammonia

(Image source)


  • It should be capable of producing images programmatically through a code library. Any mainstream programming language (C, Java, Python, etc.) is acceptable.
  • It should be able to take chemical descriptions as input to produce images of ball and stick diagrams as output.
  • It should be free and open source.

I know that it is possible to create these models using Mathematica's ChemicalData built-in symbol, but I am looking for something that can integrate better into my existing code base (hence the preference for free and open source libraries in mainstream programming languages).

  • 3
    $\begingroup$ You should try JSmol, it is free and easy to use. Have a look at one of the many Wikipedia pages that use this for drawing molecules. $\endgroup$
    – porphyrin
    May 17, 2019 at 7:13

2 Answers 2


For general open source solutions:

  • Avogadro - Molecular editor GUI. Has a Python API.
  • Jmol - Chemical structure viewer. Fully scriptable using a custom scripting language. It also has a JavaScript-only version named 'JSmol', allowing models to be displayed in web browsers.
  • ghemical - Has a GUI for editing molecules, but no API.

For a $\LaTeX$ solution, see this question on the $\TeX$ Stack Exchange site: Help creating solid cylinders along a path in Tikz for crystal lattice diagram

Other solutions:

  • If you have access to Mathematica (e.g. on a Raspberry Pi running Raspbian [which comes with a free copy of Mathematica]), you can use Mathematica's ChemicalData built-in symbol to create ball and stick models.

I would also mention QuteMole:

QuteMol is an open source (GPL), interactive, high quality molecular visualization system. QuteMol exploits the current GPU capabilites through OpenGL shaders to offers an array of innovative visual effects. QuteMol visualization techniques are aimed at improving clarity and an easier understanding of the 3D shape and structure of large molecules or complex proteins.

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.