Customizing input generators

Dear developers,

I have (quite foolishly) become an advisor for a bachelor’s thesis related to customizing Avogadro input generator plugins. We had previously used some quite sophisticated system written in Access/VBA to generate Gaussian (and ORCA) input files for relevant jobs (multi-step, multi-geometry, etc.) and the idea was to transfer at least major parts of it to Avogadro plugin (and use student’s work for mutual benefit).

I would like to ask if there is a way to:

  1. change form element visibility based on choices for other elements;
  2. add controls other than drop-down lists, check boxes and input fields (e.g., buttons and tabs).

In case this is relevant, I attached a screenshot of our old VBA/Access form. I do understand that making it absolutely like that is probably not possible (or am I underestimating the plugin API?) but I hope we can get at least to some point. This abomination was developed by 3 different non-programmers (myself included) over the course of 10 years… The interface is mainly in Latvian, though.

2 Likes

Welcome and thank you very much - sounds like a great project so hopefully we can help you with it!

Both of these have been on my wishlist for a while, but aren’t active in the current code. I have some free time, so I can probably hammer out some development code for either one in about a week.

Tabs are probably the easiest and highest on my list. Since the plugins provide JSON, it seems like adding tabs would involve adding support for nesting inside an array.

I’m not sure what a button would do… Can you provide some details there?

As far as changing form visibility… I really want to enable this type of form, because it makes for better user interface. Right now the model is that the script passes JSON back to Avogadro to render the form using Qt.

So changing visibility either requires:

  • interaction between the script and Avogadro as the users pick options
  • adding code for Avogadro to trigger visibility

The first seems to make more sense, since the scripts already generate the preview text.

So perhaps the JSON for the form specifies all elements, but some have “visible: false” in the initial layout and the script can send a list of elements to hide/show along with generating preview text?

Thoughts?

2 Likes

Dear Dr. Hutchinson,

Thank You for the quick reply and nice comments!

The button was used on the “Basis set” (“Bāze”) tab to add custom basis set/ECP for certain elements (You probably know how strict Gaussian is – if You add basis set for an element which is not present in calculation, it will fail the job). Please see the screenshot attached – I think You will understand despite that the interface was in Latvian. In the left column (input field) elements (grouped) were added by pressing the button (on the left for basis set and on the right for ECP) and in the right one the corresponding basis sets/ECPs are displayed. There is also a silly error in that screenshot, as the internal field separator obviously was a comma (see the right column). This part of form was never actively used, though.

Another thing for button was the ability to enter a filename regex so that a batch will be prepared with the same job specifications but with geometries taken from those files matched by the regexp. The button would also nicely open the dialog to pick files (to use the full name as the basis for said regexp or for jobs like adiabatic/relaxed ionization energy/electron affinity calculation with structures already present).

I agree with You that the first option with respect to visibility seems the most appropriate.

Now the greatest problem from our side is about time. My student is employed on some job with a horrible schedule (in a tech support center) and, as we discussed today, it doesn’t seem too possible for him to finish his bachelor thesis in time (he has to pre-defend this Thursday and finish the thing until the June), so he will probably take a year off to not lose his sanity. And my time is also cramped, as I have to (finally) finish my PhD draft until the end of June, so I cannot promise much productivity until then. Yes, this was indeed a foolish thing from my side to propose this bachelor thesis topic now, but we both will try to be as useful as possible. In fact, I needed the ability to prepare batch Gaussian input files to waste less time on technicalities for my PhD in the first place.

Still looking forward to a fruitful cooperation :slight_smile:

Sounds great. My time is a bit more open now that classes are finished. There’s some support for batch jobs and for buttons to pick files already.

I’m hoping to have some time to add in the visibility part to the generators this week. Tabs might take a bit longer. (This might also be a good opportunity to make sure the scripts have support for localization too. :slight_smile: )

I’ll make sure to update the thread when visibility is finished, and I’ve been thinking through how the code for tabs should work.

I like the idea of having some function similar to generateInputFile that accepts opts and, based on their values, returns a list of fields that should be visible. I think being able to dynamically control what fields are presented would definitely help keep the UI clean as more and more options are added to the Input Generators.

1 Like

I’ll need a bit more time to think about the hide / show interactivity. But I did a cleanup and added tabbed interfaces (you just make sure “userOptions” is an array).

The hide / show capability is easy from the script side - you’d return a bunch of field names when you generate input. I just need to think more about how the C++ bits work.

1 Like