Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Alexander Stukowski

Pages: 1 [2] 3 4 ... 31
Support Forum / Re: Scripting Every Nth frame
« on: September 07, 2018, 11:21:37 PM »
This time it's not a bug in Ovito :) It's a typo in your script:

Code: [Select]
dataset.anim.frames_per_second = 2,

Remove the trailing comma at the end of the line. Python interprets this expression as a one-element tuple, not an integer value. See

Support Forum / Re: Scripting Every Nth frame
« on: September 07, 2018, 09:11:06 AM »

Probably this is due to a bug in the old OVITO version, see this discussion thread:

Maybe it helps to insert a call to Viewport.zoom_all() right before rendering the animation.


See this part of the documentation:

In your particular case:

Code: [Select]
from ovito.vis import TextLabelOverlay
from PyQt5 import QtCor

overlay = TextLabelOverlay(
    text = '[SourceFrame]',
    alignment = QtCore.Qt.AlignRight ^ QtCore.Qt.AlignBottom,
    offset_y = 0.1,
    font_size = 0.03,
    text_color = (0,0,0))

Support Forum / Re: Scripting Every Nth frame
« on: September 06, 2018, 06:34:20 PM »

The answer depends on which version of OVITO you are using. In the old 2.9.0 release, there has been an undocumented parameter in the RenderSettings class, which you can set, e.g.

Code: [Select]
render_settings.everyNthFrame = 5

If you already switched to OVITO 3.0.0-dev, the new Viewport.render_anim() method provides the every_nth keyword parameter.


Support Forum / Re: CNA and bond-angle analysis criterion
« on: September 04, 2018, 02:01:14 PM »
Dear spar,

The CNA and the bond-angle analysis (also known as Ackland-Jones structure identification method) both use fixed rules for identifying crystalline and fully coordinated bulk atoms. There is no way to change these rules without touching the source code of the actual algorithm.

The CNA, for example, requires an atom to have 12 nearest neighbors to be identified as FCC. Additionally, these 12 neighbors must be arranged in a particular way. In other words, the coordination number is not the only criterion used in the CNA.

If you are interested in identifying surface atoms just by the number of neighbors, you can do that in OVITO using its Coordination Analysis modifier, which counts the number of atomic neighbors within a given spherical range, followed by an Expression Selection modifier. The latter lets you select those atoms which have a coordination number within a certain range.

More sophisticated identification and selection schemes are possible to catch specific surface atoms. For example, you could combine the CNA and the coordination analysis. First use CNA to identify and select the bulk FCC atoms, then use the Expand Selection modifier to select their nearest neighbors and refine the selection based on the computed coordination numbers.

I am not sure what you are looking for exactly. If possible, please specify more precisely what you would like to do.


Support Forum / Re: Sum of spatial Burgers vector
« on: September 03, 2018, 10:08:37 AM »
Dear SC,

It is not clear to me what the physical meaning of the quantity is that you are asking for, but in principle ispossible to calculate it using OVITO's scripting capabilities. For example, you could insert the following user-defined modifier function into the data pipeline to analyze the results of the DXA modifier:

Code: [Select]
import numpy as np
def modify(frame, input, output):
    total_b = np.zeros(3)
    for segment in input.dislocations.segments:
         total_b += segment.spatial_burgers_vector

This function simply computes the vector sum of the Burgers vectors of all spatial dislocations. Note however that this approach ignores the line sense of the dislocations, which may vary from line to line (as will the sign of the Burgers vector). So the Burgers vector summation doesn't make much sense, unless you know that all lines are pointing in the same direction.


Support Forum / Re: Save the distance between two particles
« on: August 29, 2018, 07:51:16 AM »
I have attached a screenshot for you showing how to set up the Python script modifier. Please compare with your own setup.

The "Attributes" tab of the data inspector at the bottom of the main window lists all global attributes that have been produced by the current pipeline, including the the "Distance" attribute coming from our user-defined modifier function. All these global attributes are also available for export to a text file when you select the "Table of values" output format in the file selection dialog (not shown in the screenshot) that pops up first when you select "Export file" from the menu.

(Note: The screenshot image is very large and might not display well on this web page. Better click on the image filename to download the screenshot to your computer for viewing it there.)

Dear RU,

Are you running this script within a graphical program session via the "Run Script File" function from the menu of Ovito 2.9.0?

Under these conditions I was able to reproduce the error, which seems to be due to an old bug in the Python interface. Python modules imported outside of the user-defined modifier function are not visible inside the function. The problem does not occur if you run the script outside of a graphical program session using the "ovitos" interpreter. And in Ovito 3.0 the problem has been solved altogether.

As a workaround, I suggest to import the module inside the assign_color() function:

Code: [Select]
def assign_color(frame, input, output):
    from import ParticleProperty
    color_property = output.create_particle_property(ParticleProperty.Type.Color)
    color_property.marray[:] = (0.0, 0.5, 1.0)


Support Forum / Re: LAMMPS input file with atomic mass information?
« on: August 28, 2018, 08:22:59 PM »
I've created a feature request in our issue tracker to keep track of the planned addition:

Support Forum / Re: LAMMPS input file with atomic mass information?
« on: August 28, 2018, 08:07:41 PM »
Dear RU,

That's true, the current versions of OVITO ignore the mass values in a LAMMPS data file. Mainly this is because OVITO stores masses on a per-particle basis, while data files specify mass values on a per-type basis. But of course it would be possible to simply map the per-type masses to the "Mass" per-particle property in OVITO. And I will certainly extend OVITO in the future to do exactly this.

In the meantime, you could manually assign the masses within the program, for example using the Compute property modifier. For the example you posted, with only two atom types, you could enter the following compute expression to assign the right masses:

Code: [Select]
ParticleType==1 ? 1 : 2

A more advanced solution, requiring more work, would be to write a user-defined modifier function in Python that actually parses the masses from the data file and assigns them to the particles. 


Support Forum / Re: Question on detecting and following perticular atoms
« on: August 28, 2018, 07:26:00 AM »
Dear Ali,

You can use the Freeze property modifier for that. It lets you copy the state of a particle property from one time frame to all others.


Support Forum / Re: Save the distance between two particles
« on: August 28, 2018, 07:23:00 AM »
Yes, global attributes like the one this Python function computes can be saved to a text file as a tabulated function of time. See here:

Support Forum / Re: Utility tab in ovito 3
« on: August 22, 2018, 11:13:19 AM »
Right, that's the one function from Ovito 2.9 for which there is no replacement yet in the current development release. I am going to add a measurement function for bond angles in one of the next release iterations.

Support Forum / Re: Utility tab in ovito 3
« on: August 21, 2018, 09:39:16 PM »
Dear Ali,

The "Utilities" tab has been removed in the new program version. (Almost) all functions from this tab, which used to be part of previous versions, are now provided by the new data inspector panel of Ovito 3.0. See this section of the user manual:


Support Forum / Re: Problem with Ovito Installation
« on: August 17, 2018, 09:26:02 AM »
Dear Big,

Which version of Ovito did you install? 2.9.0?

Crashes during startup or when opening a data file are often due to compatibility problems with the graphics driver. To find out if this is the case, you can try running the ovitos.exe executable (not ovito.exe) found in the installation directory. This is the script interpreter, which doesn't open any graphics windows. Thus, if ovitos runs without problems, it would indicate that the crash is probably due to graphics driver problem, not a general installation problem.


Support Forum / Re: Bond Angle Distribution
« on: August 11, 2018, 09:14:34 AM »
Hi Ali,

This code should for work for non-periodic or mixed periodic/non-periodic cells as well. For every bond in the system, OVITO keeps track of whether it crosses a periodic boundary of the simulation. This information is stored in the data.bonds.pbc_vectors array, which contains a triplet of integers for each bond specifying which boundaries it crosses, how many times and in which directions. For bonds that do not cross any boundary, the triple will be (0,0,0). In your case, the cell is non-periodic in Z, so the third number of the triplet will be zero for every bond, because there simply are no bonds crossing the z-boundaries of the cell in your system. Due to that 0 entry in the data.bonds.pbc_vectors array, the z-components of the calculated bond vectors will be left untouched by the calculation performed in line 2 of your code.

The above statement assumes that OVITO is informed about the mixed PBCs of your system. For LAMMPS dump files this information gets automatically read from the input file. You can verify that by inspecting the pbc field of the SimulationCell object.


Pages: 1 [2] 3 4 ... 31