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 - Constanze Kalcher

Pages: [1] 2 3 ... 8

thanks for letting us know. However, I have difficulties reproducing the error. I can open your file without any trouble with both OVITO 2.9 and the latest developer version. Can you tell us what Ubuntu version you are using?
Also, does this happen with any file?


Support Forum / Re: How to calculate the defect cluster.
« on: April 23, 2019, 10:47:38 AM »

can you explain what you would like to analyze specifically?


Support Forum / Re: How can we get a bond angle distribution in ovito?
« on: April 23, 2019, 10:44:40 AM »

it does not make much sense to me why you import, export and then re-importing your files.
It's sufficient to just load your trajectory once and then loop over all the frames using the compute(<frame>) function which takes the current frame number as an argument.
Also you should only append the Create Bonds modifier to the pipeline once. Just do it before you loop over all frames, otherwise you add an additional Create Bonds modifier every time you go to a new frame.
Code: [Select]
node = import_file(f1,  multiple_frames = True)
create_bonds_mod = CreateBondsModifier(mode=CreateBondsModifier.Mode.Pairwise)
create_bonds_mod.set_pairwise_cutoff('Type 2', 'Type 5', 2.3)

for frame in range(node.source.num_frames):
    data = node.compute(frame)


Support Forum / Re: save 2d stress plot
« on: April 17, 2019, 09:30:57 AM »
Dear huddack,

at the moment you cannot export the preview image of the bin grid. You need to export the data as text file and then plot it with your usual plotting tool.


Support Forum / Re: Error involving particles xyz positions at 0/
« on: April 15, 2019, 04:59:12 PM »
Hello benjy,

the basic XYZ format does not contain simulation cell information. OVITO takes the axis-aligned bounding box of particles as the simulation box instead. In your case of only 3 particles that might not always work properly
and then the Affine Transformation modifier cannot be applied onto a non-exisiting cell. In order to avoid this, I would recommend to use the extended xyz format instead, which includes an extra line in the header that contains information on the simulation cell.

Please also have a look at the introduction on running scripts first:
Running a stand alone batch script (like the one you attached) using the ovitos script interpreter and defining a custom modifier function with the Python script modifier in the GUI are two different things.

In short, in order to fix your problem you should not use the Affine Transformation modifier. Instead, please use a Python script modifier, edit the script and insert the function set_cell() from your attached batch script. However, you need to make sure that when you do that in the GUI, the function has to be named modify(), that's why OVITO is complaining.

Code: [Select]
def modify(frame, data):
    with data.cell_:
        data.cell_[:,0] = [10., 0., 0.]
        data.cell_[:,1] = [0., 10., 0.]
        data.cell_[:,2] = [0., 0., 10.]
        #cell origin
        data.cell_[:,3] = [-5.,   -5.  ,  -5.]
        #set periodic boundary conditions
        data.cell_.pbc = (True, True, True)

The second error is possibly due to the fact that you somehow ran the script from within the GUI?  Let me know if that's not the case.
That's how it's supposed to be executed from the terminal:
Code: [Select]

Support Forum / Re: About the FreezePropertyModifier
« on: April 12, 2019, 11:21:31 AM »

that is quite possibly a bug. Could you please try this:
Code: [Select]
from ovito import dataset
dataset.anim.current_frame = 12

Alternatively, I would recommend you to upgrade to the latest developer version ovito-3.0.0-dev and use:
Code: [Select]
modifier = FreezePropertyModifier(source_property = 'Selection',
                                  destination_property = 'Selection',
                                  freeze_at = 12)


Support Forum / Re: Including axes in a video snapshot
« on: April 10, 2019, 10:37:51 AM »
if you mean the coordinate tripod, you can go to the Viewport overlay tab
and click on "Add overlay" --> Coordinate tripod.


Support Forum / Re: error in "NeighborMode.Bonded" in cluster analysis
« on: April 09, 2019, 12:26:33 PM »
Dear x.he,

thank you for letting me know, it's actually a typo in the documentation. If you have imported or generated bonds (e.g. with the CreateBondsModifier or the VoronoiAnalysisModifier)
you can set the neighbor mode of the Cluster Analysis modifier like this:

Code: [Select]
cluster.neighbor_mode = ClusterAnalysisModifier.NeighborMode.Bonding
Does that solve your problem?

Support Forum / Re: twinning
« on: April 08, 2019, 01:38:08 PM »
Hello Leo,

just to clarify, the CNA and Atomic Strain analyses are two independent analysis methods. With the help of the CNA you already revealed that there is HCP ordering in your FCC structure, which are indicators for either a stacking fault (the red double layers) or potential twinning planes. But in order to be sure that twinning occurred, you should also compare these results to the strain field you obtain from the Atomic Strain modifier. As cutoff it is recommended that you use a value between the first and second neighbor shell. To exclude the stacking faults from the strain field color coding, you can create a selection based on the structure type and then apply the Color coding modifier only on FCC like atoms.


Support Forum / Re: call modifiers before import
« on: April 08, 2019, 12:00:20 PM »
Dear Movaffaq,

I checked your script and it seems fine to me. Whenever you import a new dump file you set up a new pipeline and thus also have to append the modifiers, so everything you did is correct. One thing I noticed though, is that you calculate a histogram of the potential energy which is not used or exported in the following, so you could remove these two lines if you don't need them.

Is your goal to calculate partial RDFS? Note that the latest developer version ovito.3.0.0-dev has a built-in modifier function for that.
so you can skip all these extra steps where you first create bonds and then create a histogram etc, which will probably bring quite some speed up.

Let me know if you have questions.


Support Forum / Re: VGL Error
« on: April 04, 2019, 07:52:38 PM »
Hi Icosta,

no unfortunately that doesn't work.
Maybe you know this already, but OVITO also has the option to import remote files.
So if the issue is that you cannot copy the files, that might be a solution for you.


Support Forum / Re: about CNA
« on: April 03, 2019, 10:55:42 AM »
Dear nfer,

no you don't need to install python. As a first step open the windows command line prompt. Then go into the folder that contains your script and data using
Code: [Select]
cd "<type your path here>"
If you have installed OVITO in C:\ProgramFiles, you execute ovitos like this:
Code: [Select]
"C:\Program Files\Ovito\ovitos.exe" CNA.pyor you add that folder to your path variable
Code: [Select]
set PATH=%PATH%;"C:\Program Files\Ovito\"so you don't need to type the whole path every time.


Support Forum / Re: loading parallel output dumpfile
« on: April 01, 2019, 08:34:03 PM »
Hi Pavel,

the current issue is that OVITO can only auto-detect a file sequence if there is only one * wildcard character in the filename and you have two in your filepattern (for the timestep and processor).
But it is possible to import your dump files with a little workaround:  In the GUI you can merge the different dump-partitions belonging to the same timestep by using the CombineDataset modifier, see
If e.g. you have used 8 processors, you would have to import the first file sequence "dump.step_*.proc_0.lammpstrj" and then add 7 of those modifiers to your pipeline and make sure you correctly edit the "File sequence" for each new modifier to "dump.step_*.proc_1.lammpstrj", "dump.step_*.proc_2.lammpstrj" etc.
I just tried and it works.

Since that's not really practical, here is a small python script for you that you can save in the same folder where your dump files are. Then simply run it from the GUI (choose File --> Run python script).
Code: [Select]
from import *
from import import_file
from ovito.modifiers import *
import glob

filepattern = "dump.step_*.proc_"
format = ".lammpstrj"
N_proc = int(sorted(glob.glob("dump.step_*.proc_*"))[-1].split(".proc_")[1].split(".lammpstrj")[0]) + 1

pipeline = import_file(filepattern + "0" + format)
for i in range(1, N_proc):
        modifier = CombineDatasetsModifier()
        modifier.source.load(filepattern + str(i) + format)

It should import and combine everything automatically into the GUI version of the latest developer version OVITO 3-dev.
Let me know if that works for you.


Support Forum / Re: Calculating overall RDF via Python Script
« on: April 01, 2019, 10:57:26 AM »
Hi benjy,

you can define a custom modifier function that takes care of that. Just make sure to add this to your code before the Coordination analysis modifier is added to the pipeline, because the order of the modifiers matters (like in the GUI).

Code: [Select]
def set_cell(frame, data):
    with data.cell_:
        data.cell_[:,0] = [10., 0., 0.]
        data.cell_[:,1] = [0., 10., 0.]
        data.cell_[:,2] = [0., 0., 10]
        #cell origin
        data.cell_[:,3] = [-5.,   -5.  ,  -5.]
        #set periodic boundary conditions
        data.cell_.pbc = (True, True, True)

or in short:

Code: [Select]
def set_cell(frame, data):
    with data.cell_:
        data.cell_[...] = [[10., 0., 0., -5.], [0., 10., 0., -5.], [0., 0., 10., -5.]]
        data.cell_.pbc = (True, True, True)


Support Forum / Re: Calculating overall RDF via Python Script
« on: March 29, 2019, 05:23:12 PM »
Hi benjy,

how to calculate a time-averaged RDF is explained in the scripting manual of the latest developer version:
You can simply copy the code example and adapt the cutoff and number of bins in the coordination analysis modifier to your needs.
Let me know if you have questions.

If you're not comfortable with the python scripting interface (yet) you could also achieve this with the help of the graphical user interface of OVITO as discussed here:


Support Forum / Re: Extracting surface atoms
« on: March 29, 2019, 11:03:39 AM »
Hello xodiyo,

it wasn't clear to me what you're trying to do.
In the reference you mentioned it seems like they also chose a criterion based on the number of neighbor atoms, i.e. they applied the Coordination analysis modifier to calculate the number of neighbors. Then they created a selection based on the number of neighbors and exported the coordinates of that selection.
In short, you can invert your selection, delete the bulk atoms and then make use of the export file-function to export the coordinates of the surface atoms.


Support Forum / Re: Surface indexing using ovito
« on: March 28, 2019, 07:03:03 PM »
Hello Mehran,

I'm afraid there is no automatized way of doing this with OVITO.


Support Forum / Re: Lattice rotation
« on: March 28, 2019, 05:22:46 PM »
Hello Rajdeep,

instead of rotating everything you need to apply the rotation only on the atoms.


Support Forum / Re: color coding as a function of liquid density
« on: March 28, 2019, 02:58:47 PM »
Hi Dezhao,

ah okay, yes of course that makes sense. Thank you for your explanations.

Concerning your questions, there are two ways to create new particle properties, you can either use the Compute property modifier
or a Python script modifier

As a very simple example, say the particle masses you need to calculate the density are not part of your input data (as is e.g. the case for a lammps dump file). Then we could create a new particle property called "Mass". Let's assume you have 2 particle types (e.g. Cu and Zr) with type ID's 1 and 2 and their masses are 63.5u and 91.2u. This is how you would go about this then:

Approach 1) Compute property modifier
Output property -> Mass
Expression -> ParticleType == 1? 63.5:91.2

Approach 2) Python script modifier
Code: [Select]
from import *

def modify(frame, data):
    #create a standard particle property
    my_prop = data.particles_.create_property('Mass')
    ptypes = data.particles["Particle Type"]

    with my_prop:
        my_prop[(ptypes == 1)] = 63.5
        my_prop[(ptypes == 2)] = 91.3

You can use that newly created particle property "Mass" in the Spatial binning modifier to calculate the density.
Note that at the moment there is no direct export function to export the grid you computed. However, with the help of a
small python script modifier (which you would insert on top of you pipeline/ after the Spatial binning modifier) you can do it.

Example for a 2D - grid:
Code: [Select]
grid = data.grids['binning[Mass]']
        array = grid['Mass']
        array_2d = np.reshape(array, grid.shape)
        numpy.savetxt("My_array.txt", array_2d)

Example to export a 3D grid:
Code: [Select]
    import numpy as np
    grid = data.grids['binning[Mass]']
    array = grid['Mass']
    array_2d = np.reshape(array, grid.shape)
    with open("outfile.txt", "w") as out:
        for i in range(0,array_2d.shape[0]):
            for j in range(0,array_2d.shape[1]):
                for k in range(array_2d.shape[2]):
                    out.write( "{:f} \t {:f} \t {:f} \t {:.4f} \n".format( i, j, k, array_2d[i][j][k] ))

To visualize this a trick that I sometimes use is to make the export format match the extended-xyz  or dump file format so I can reimport it with OVITO (You can add the additional data as a second pipeline, slice it, add some color coding and change the "particle shape" to cubes or squares).
See attached pictures.


Support Forum / Re: Size bar issues in v3.0.0-dev322
« on: March 27, 2019, 02:57:12 PM »
Dear Rob,

yes, in OVITO 3 quite some changes have been made to the python API (and also the PythonViewportOverlay class). Please see
for a detailed overview.

Here you can find the updated version of the scale-bar example script:


Support Forum / Re: color coding as a function of liquid density
« on: March 27, 2019, 10:46:53 AM »
Dear Dezhao,

what exactly would you like to color? Do you only need to color the atoms in the liquid phase or are you trying to overlay a density plot from your external data? The latter could possibly be done with a little work around.

Could you send me an example of your data, and also the density profiles? If you don't want to upload it here you can use the official mail support.

Just in case you didn't know, OVITO also has a Spatial binning modifier,
It creates so-called Voxel grids
which can be used by the Create Isosurface modifier
to render iso-level surfaces for any grid field you computed/imported. Maybe that could be of interest to you.

Edit: I attached to two example pictures for you so it's easier to understand what OVITO can do. For the first one I used the spatial binning modifier (on an artificially created particle property that's radially increasing) and then added several isosurfaces. In the second one the color coding modifier was used.


Support Forum / Re: Partial radial distribution function (RDF)
« on: March 27, 2019, 08:55:51 AM »
Hi Safy,

sorry you lost me there. I don’t understand what you mean by you “incorrectly determined the coordination spheres.” It’s a simple bcc structure, if you like you can crosscheck by calculating the next neighbor distances using pen and paper.



thank you for letting us know, we are looking into this.


Support Forum / Re: Extracting surface atoms
« on: March 26, 2019, 11:56:20 AM »

the Coordination analysis modifier not only calculates the RDF but creates a new particle property "Coordination" which as the name suggests is the number of neighbor atoms found within the the user specified cutoff range of each particle.
In a next step, you can create a selection based on the coordination number. Simply add an Expression selection modifier to your pipeline and edit the Boolean expression field, e.g.
Code: [Select]
Coordination < 12
Alternatively, you can use the recently implemented feature of the Construct surface mesh modifier which lets you select particles on the surface by activating the checkbox Select particles on the surface.

In both cases, you can easily export the number of surface atoms which is stored in the global attribute "SelectExpression.num_selected" for each frame using the File export function and choosing Table of Values as export file format.


Support Forum / Re: Calculate slip vector
« on: March 25, 2019, 11:43:58 AM »
Dear Wenbo,

yes it should be possible to calculate that with a small batch script, see
for more details.

The Calculate Displacements modifier can be used to calculate the displacement of an atom with respect to its position in a reference configuration.
What is more helpful in your case is probably the Nearest Neighbor Finder function, which returns the distance vectors between each atom and its N nearest neighbors.

Let me know if you have further questions.


Support Forum / Re: How can we get a bond angle distribution in ovito?
« on: March 19, 2019, 06:43:13 PM »
Hello Sean,

the script loops over all particles regardless of their particle type and uses all bonds that you have created with the Create Bonds modifier.

1) yes, in this case you only need to create bonds between Si and O.

2) In order to obtain the two different bond angle distributions, you could try and modify the part of the script where you iterate over all particles
such that you keep track of two histograms, one which is incremented when the central particle is Si and one that is only incremented when
the central particle is O.

Code: [Select]
tprop = data.particles["Particle Type"]
Si_type_id = tprop.type_by_name('Si').id
O_type_id = tprop.type_by_name('O').id
for particle_index in range(data.number_of_particles):
    if (tprop[particle_index] == Si_type_id):
        angle_cosine_histogram_1 += np.histogram(angle_cosines, bins=bin_count, range=(-1.0,1.0))[0]
    elif (tprop[particle_index] == O_type_id):
        angle_cosine_histogram_2 += np.histogram(angle_cosines, bins=bin_count, range=(-1.0,1.0))[0]


Support Forum / Re: Partial radial distribution function (RDF)
« on: March 19, 2019, 02:22:06 PM »

the neighbor distances in the conventional BCC unit cell are:
nearest neighbor sqrt(3)/2*a
next-nearest neighbor   a
3N neighbor   sqrt(2)*a
etc... That matches well the values you have specified above.

Furthermore, in BCC there are octahedral sites at face centers {0.5, 0.5, 0} and edge centers {0.5, 0, 0}.
(It's easier to see if you make use of the Create Bonds modifier and then Slice through the structure.)
In that case the nearest neighbor distances to these interstitial site is a/2 and sqrt(2)/2*a, which is exactly what the partial rdfs show.

Maybe I didn't understand your question correctly. What is troubling you?


Support Forum / Re: Lattice rotation
« on: March 15, 2019, 10:03:25 AM »
Dear Rajdeep,

note that the Affine Transformation modifier takes the transformation matrix that you enter and applies it onto your system. So what you need to enter there is the rotation matrix between your two coordinate systems.


Support Forum / Re: SIZE of the clusters
« on: March 15, 2019, 09:51:18 AM »

you could select the clusters in question and use the Surface mesh modifier on this selection.


Support Forum / Re: Fatal Python error: deallocating None
« on: March 15, 2019, 09:47:13 AM »
Dear Michelle,

thanks for letting us know, we are looking into this.


Pages: [1] 2 3 ... 8