Home   Manual

Improving Avogadro v2 "Workflow" plugins


One of the key additions in Avogadro2 will be the addition of Python and other scripting interfaces:

  • file format readers (i.e., flexibly import files into Avogadro)
  • input generators (i.e., flexibly export files from Avogadro)
  • commands/workflows (modify the molecule)

We’ve been working on a lot of this at Pitt, including a downloader feature and some work on a plugin repository website.

The “big idea” of the workflows is to make it really easy to add new commands - either for your own use or to share with others. The downloader makes it easy to update from GitHub (e.g., there’s a new version of Gaussian, NWChem, whatever and the Avogadro plugin now supports feature X.)

Some possible commands:

  • Get / modify selection
  • Scale coordinates
  • “Flatten” (e.g., set all the z-coordinates to 0.0)
  • Building new structures:
    • Scikit-nano Nanotubes / Fullerenes
    • ASE
    • pymatgen
    • oligosaccharides

In the next set of posts, I’m going to outline a few needed tasks and solicit feedback…


Plugin packages:

Right now, Avogagdrolibs expects a script is self-contained. So there’s gaussian.py and mopac.py and they’re in a directory. But in many cases, we may want a script to install some pre-requisites (e.g., into a virtual environment) or come packaged with some data files, graphics, translations, etc.

Here’s an example:

  • README.md
  • plugin.json
  • requirements.txt
  • molecule_scaler.py

The requirements.txt indicates any Python requirements. Should there be an install.sh script instead? How secure is this?

The plugin.json script should be read by avogadrolibs to determine which files in the directory are real commands (as opposed to library modules):

  "author": "Paul Boone",
  "version": 0.1,
  "name": "molecule_scaler",
  "url": "https://github.com/paulboone/avogadro-plugin-examples",
  "description": "This is a template plugin you can use as a starting point when designing your own plugins.",
  "commands": [{
      "name": "molecule_scaler",
      "command": "avogadro-plugin-python-run",
      "args": "molecule_scaler"


Right now, the plugin loading code doesn’t have any idea about plugin.json files or even that plugins can be found in subdirectories.

The downloader doesn’t know about requirements.txt and installing pre-requisites:


Another useful question is returning data to Avogadro from the plugin. For example, maybe a machine learning method predicts the partial charges. That could be set in CJSON or another file format.

  • What if the plugin returns the IUPAC name of the molecule? How does it get displayed?
  • What if the plugin wants to return a spectrum (e.g., finding the NMR in a database)?
  • What if the plugin returns an energy?
    • Should there be a specific plugin type for ‘calculator’ or ‘force field’ like ASE?
    • If so, the plugin should return an energy and optionally forces/gradients for Avogadro to optimize

Right now, much of this would be through the CJSON format. So we’d need to know what properties CJSON supports.

  • CJSON does not yet support multiple coordinate sets - this needs to be fixed
  • I don’t know if forces/gradients are supported via CJSON
  • CJSON needs to support constraints (e.g., if a user “freezes” an atom in the GUI)