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

Python scripting

Dear Sir

I am trying to learn ovito python interface scripting. I am following the python interface pages and got the below error. Can you tell me why I am getting an error.

input:

from ovito.io import import_file
pipeline = import_file("/home/zahid/Research/Project_Ti_core_shell/10_1/test_interior.dump")

output:

Invalid Python modifier script. There is no function with the name 'modify()'.

Dear Mohammad,

as explained here https://www.ovito.org/docs/current/python/introduction/running.php there are different ways you can use the scripting interface.

  1. It's important to understand that on the one hand you can write a stand-alone script that runs without user action and execute that from the terminal. You would then set up the script analogous to every action you perform in the GUI, i.e. first you import a file, then you add modifiers to your pipeline etc.
  2. On the other hand it's also possible to extend the capabilities of OVITO's GUI by writing short custom modifier functions. For the latter you would insert a python script modifier into your pipeline and edit the template that appears when you open the modifier settings. Note that such a function has to have the following form:
def modify(frame, data):
    #....your code

-Constanze