I’ve been talking with Paul Boone, an experienced Python programmer on staff
here at Pitt (and soon to be PhD student) about the Python interface to Avo2.
Short message - we think it's easy to add script support for a *lot* of use
cases without much work.
- Scripts could pop up an options dialog, receive a cjson molecule, and pass
back a new cjson and optionally some messages.
Consider the case of a script (Python or not) that modifies the molecule
somehow. Maybe it scales the bonds. Maybe it generates a crystal structure…
That script probably wants an options dialog in Avogadro and then a “run”
script that passes back the modified molecule in cjson format. Avogadro adds an
undo/redo between the two structures.
The beauty is that it's really easy to write this kind of script, either for
personal use, or to distribute and it's powerful. Imagine a "stack" script that
replicates the molecule X times along the x/y/z axis after translating by Y
Angstroms.
Much of the code we want is already there in the input generators - building
the dialog GUI.
- Except the input generators currently don’t allow floating point #s
- They don’t (always) receive the current molecule when asked to create the
input dialog JSON
- They don’t have any sort of language / localization
- They don't allow multiple tabs/panels
My suggestion here is to refactor the InputDialog class to OptionsDialog
- Allow floating point numbers (with constraints on precision and range)
- Add a --language=en flag to the script to load different JSON depending on
the user's default language
- Always pass the molecule as CJSON (and drop the CML version) - allowing the
dialog to change based on the molecule
.. for example maybe showing a different interface if a unit cell is present,
or filtering basis sets based on atoms
- Add a syntax for multiple panels, e.g.
"Basic" : [ .. ],
"Advanced": [ .. ]
I'd also suggest that to better support an "installer" feature, that we change
the scripts to live in separate directories:
gaussian/
.. run
.. install
.. package.json
qchem/
.. run
.. install
.. package.json
This means that while we'd encourage Python, in principal, users could write
their plugin scripts in *any* language as long as it meets the minimal API
(i.e., pass back JSON for the dialog).
Thoughts?
-Geoff
------------------------------------------------------------------------------
_______________________________________________
Avogadro-devel mailing list
Avogadro-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/avogadro-devel