Command Scripts JSON documentation

Hello!

Maybe I did not dig deep enough, but I didn’t find any docs for avogadro2 (neither app nor libs). Aren’t there any?

Greets from Paris
Heiner

What are you particularly looking for? User docs? API developer docs?

I am looking rather for the API docs. At the moment specifically for a documentation of the JSON API.

Which JSON? We use that in a variety of ways. Do you mean the chemical json file format? The JSON for scripts (user interface dialogs, callbacks, etc.) or something else?

Yepp, I am writing a small plugin using the cjson/commands interface. Would be great to have some documentation, if there is any. I already had a look at the files in the UGM2018 repository, but didn’t find what I’m looking for.

I’d like to use RDKit to perform a constrained optimization, in order to that I need access to the selected atoms, but if I understood correctly these are only provided in the cjson format while I need something like mol/mol2/sdf for RDKit. Is there a way to dump the current molecule in both formats?

Great idea!

At the moment, that’s not possible, but the command JSON API is a work in progress. So if i can summarize, you’d like:

  • a separate json entry with the selected atoms
  • more than one format

Should be pretty easy to add.

I’m also working on constraints for the new force field system, so if you have ideas on what constraints should be passed to scripts and/or the best way to represent them, please let me know.

Cool, I think these are some useful suggestions. Especially the separate json entry for selected atoms seems like something we’d want to have access to regardless of the chosen molecule format.

Concerning the implementation of contraints I like the interface in Avogadro1, maybe that could be a starting point…It’s probably a good idea to discuss in a new thread.

EDIT: new thread for discussion of constraints Constraints in Avogadro2

I should be able to get a PR for selected atoms today.

As I said, I view the JSON interface for commands to be a starting point, not a finished product. (For example, I’d love to pass back properties from the script to Avogadro, e.g. R/S labels from RDKit.)

I haven’t had a chance to fully test it, but here’s the draft patch: