Forum Navigation
You need to log in to create posts and topics.

Python scripting and data export capabilities

Dear Alex and Constanze:

I have a couple of suggestions. Apologies and redirections on how to do what I intent if it is the case that I am asking for something already available or adressed in another thread on this forum.

  1. Could future versions of the edit script window in the "Python script" modifier, be better equipped with basic editing capabilities? I would not expect a full on editor to be invoked as in that case I can, as I believe it was the original intention, simply copy-paste anything into my go-to editor but it would help productivity to have an autocomplete feature plus some keyboard shortcuts for comments and indentation. I think this would be useful as it is convenient to code directly into that window for readily testing scripts.
  2. Could a comment-adding feature be incorporated when exporting data? Perhaps my very own need for that feature could also be met with the capability to rename modifiers with more descriptive words or phrases that would get printed into the header of an exported data file, but I believe it would also be of use to be able to add comments at the start of data files, without having to open them and edit them later.

Thanks in advance and more apologies if my two cents are superflous.

-Gonzalo

Hi Gonzalo,

Thank you for these suggestions.

I agree that the existing script editor component in OVITO is rather rudimentary and doesn't provide the right type of environment to write anything but a few lines of Python code. Unfortunately, it's difficult to find fully-featured and well-maintained code editor components that we could integrate into OVITO (which is a native C++ application based on the Qt framework). There are not that many options to choose from, but perhaps we can license a commercial component in the future to replace the current preliminary solution. I will also look into the following options:

  • While native C++ code editor components are very scarce as I said, there could exist some more options in the Python or Javascript/web world. Perhaps it is possible to integrate such foreign editor components into the OVITO UI.
  • Another option could be to rely entirely on an external IDE application (e.g. VS Code, PyCharm, or whatever the user's preference is) and make sure that changes the user makes to the code file(s) are automatically reflected back to OVITO.
  • Yet another approach could be to gradually improve the current solution to eliminate at least its most severe shortcomings. But we will of course never be able to reach all the capabilities a fully-fledged IDE solution provides and which professional Python developers want.

Regarding your second suggestion: I think this mostly is a matter of the export file format and the kind of metadata they can accommodate. In some cases we could have OVITO write more extensive information into the file header or wherever such metadata needs to go. Do you have a specific file format in mind?

-Alex