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 4 ... 7
Support Forum / Re: Counting specific particle types inside a cluster
« on: January 25, 2019, 11:44:17 AM »
a possible way to do this could be to apply the cluster analysis modifier,
which assigns a cluster-ID to every found cluster. Then you could select clusters based on their IDs and count the different particle types it contains, e.g. using
the Expression Selection modifier, or a Python Script modifier, or even a Compute Property modifier. There are several possibilities.
To get more specific I would need to see an example file, which you can upload here if you like.

Let me know if this works for you.


Support Forum / Re: Vornoi Analysis
« on: January 24, 2019, 11:57:54 PM »
Hi aditya,

yes it's meant to be used in OVITO 3, sorry about that, I automatically assumed you're using the latest version.

Also, note that I corrected a small mistake in the code snippet I posted above, it shouldn't be
Code: [Select]
unique_atom_IDs= list(np.union1d(atom_pairs[:,0], atom_pairs[:,1]))but
Code: [Select]
unique_atom_IDs= np.union1d(atom_pairs[:,0], atom_pairs[:,1]),
so please double-check.



I tried to reproduce your problem and you're right. I'm afraid that at the moment you'll have to do the analysis programmatically  rather than in the GUI to solve this issue.
The following script is an example of how to  loop over each frame and also update the reference configuration with the current frame. It's meant to be executed from the terminal
like this: ovitos (see also Manual of scripting usage).

Code: [Select]
from import *
from import *
from ovito.modifiers import *
from ovito.pipeline import *
import numpy as np

# Create a new pipeline with a FileSource:                                                                                                                                                                                             
pipeline = import_file('input-file.dump')
# Load the reference config from a separate input file.                                                                                                                                                                               
pipeline2 = import_file('reference-file.dump')

# Perform Wigner-Seitz analysis:                                                                                                                                                                                                       
ws = WignerSeitzAnalysisModifier(
        per_type_occupancies = True,
        affine_mapping = ReferenceConfigurationModifier.AffineMapping.ToReference)

#Loop over all frames                                                                                                                                                                                                                 
for frame_index in range(pipeline.source.num_frames):
    ws.reference = StaticSource(data = pipeline2.compute(frame_index))
    data = pipeline.compute(frame_index)

Hope this helps,


Support Forum / Re: Vornoi Analysis
« on: January 23, 2019, 11:18:19 PM »

the answer is yes - what you would like to do is achievable by writing a custom python script modifier function, similar to the example you used to extract the Voronoi indices. There are different ways to do this actually, here is one possibility:

If you have activated the option "Generate neighbor bonds" in the Voronoi analysis modifier in the GUI of OVITO, you generate bonds which are described by a bond index and a tuple that contains the particle IDs of the pair of atoms that is connected through that bond. The latter is called bond topology, see also
Once you have the particle indices of the neighboring atoms, you can then use that information to look up any of their particle properties, like in your case the positions.

As an example, the following modifier function loops over all particles and determines all neighbors and their positions for each particle.

Code: [Select]
from import *
import numpy as np

def modify(frame, data):
    bond_enumerator = BondsEnumerator(data.particles.bonds)
    bond_topology = data.particles.bonds.topology
    pos = data.particles["Position"]

    for particle_index in range(data.particles.count):
        #Get the bond indices of all bonds to the current particle
        bond_index_list = list(bond_enumerator.bonds_of_particle(particle_index))
        #Use the bond indices to look up the atoms that belong to each bond
        atom_pairs = data.bonds.topology[bond_index_list]
        unique_atom_IDs = np.union1d(atom_pairs[:,0], atom_pairs[:,1])
        #Do not include current central particle in neighbor list
        neighbor_indices = np.delete(unique_atom_IDs, np.where( unique_atom_IDs == particle_index)[0])
        #Look up the positions of the neighbor atoms
        neighbor_pos = pos[neighbor_indices]
        #Print neighbor indices and positions of current particle
        print("Current particle:", particle_index)
        for i in range(len(neighbor_pos)):
            print(neighbor_indices[i], neighbor_pos[i])

Hope that serves as a good starting point. Let me know if you have questions.


Support Forum / Re: Quantum espresso files
« on: January 23, 2019, 01:44:15 PM »
we are not sure what you mean by "script reader", please explain.


Dear wufc,

yes, from within a python modifier you can access any results stored in a Data Series  through data.series.
So if you e.g. want to store a specific dislocation type count as a global attribute to be able to export that via the File-export "Table of Values" function, you could try something along those lines:
Code: [Select]
def modify(frame, data):
    disl_count = data.series['disloc-counts']
    data.attributes["1/6<112> Shockley Count"] = disl_count.y[2]

See also


Dear wufc,

in the latest developer version of OVITO, the number of segments found during the dislocation analysis are actually stored in "Data Series" (see attached screenshot)
from where they can be exported via the file-export function in the menu or the export button marked in the screenshot.


Dear prash,

in the meantime Alexander has updated the latest developer version with a modifier function called Unwrap Trajcectories which might be of interest to you. Try it if you like, here's the corresponding manual entry:



if I understand you correctly you're asking how to obtain the coordinates of the closest image of a neighbor atom, right? Note that the NearestNeighborFinder function takes into account periodicity when calculating the distance vector to each neighbor,
it however does not "generate new atoms" for each image of an atom. Thus when you look up the position of the neighbor atom it will always be the original image.
What you have to do to obtain the coordinates of the closest image of a neighbor atom is to simply add the neighbor distance vector to the position of the central atom, try e.g.

Code: [Select]
for index in range(data.particles.count):
    neighbors = [ (neigh.index, + positions[index]) for neigh in finder.find(index) ]
    print("Neighbor Atom \t Position")
    for neigh in neighbors:
        print( "{} \t {}".format(neigh[0],neigh[1]))


Support Forum / Re: RDF in two dimensions
« on: January 18, 2019, 05:25:07 PM »

this sounds like this can be achieved with a python script modifier, or a small batch script, please also see the documentation about running scripts:

What you would have to do is create a selection of atoms based on the z-coordinate and then use only those atoms in your analysis. As a starting point
have a look at the CutoffNeighborFinder function:


Support Forum / Re: How can I fix periodic boundary during animation
« on: January 16, 2019, 04:47:48 PM »

in order to avoid this I would recommend to use the extended xyz file format, where the actual cell is defined in the header, see e.g.
for more details.

If your simulation cell does not change during the course of your simulation there is a quick workaround: You could define the cell vectors yourself by adding the Affine Transformation modifier to your pipeline - use the options "Transform to target box" and "Operate on" Simulation cell only.


Support Forum / Re: Orbit center
« on: January 16, 2019, 12:53:47 PM »
Hi Chris,

sounds like the issue solved itself. Just in case you'll need further input, can you explain to me what you mean by "orbit center" and "single center"?
No need to reply if you consider this resolved.


Support Forum / Re: OVITO 3 dev 234 vs. 322
« on: January 15, 2019, 05:32:27 PM »
Hi Ali,

please see attached download link


Hello prash,

if you activate the option "compute per-type occupancies", the occupancy count is split into type-specific counts, see section Systems with more than one atomic species in the documentation:

Note that the Expression selection expects boolean expressions, which can be combined using logical AND and OR operators (&& and ||). So if you want to select sites, with more than one atom of type 1 and more than one atom of type 2, the expression would be Occupancy.1>1 && Occupancy.2>1. Moreover, to select sites that have a total occupancy larger than 1, you could use (Occupancy.1 + Occupancy.2) >1.


Support Forum / Re: strain analysis- liminate homogeneous deformation kye
« on: January 15, 2019, 09:51:38 AM »
Dear Bahman,

it depends on what you would like to study. If you want to visualize only the plastic contribution to the overall deformation e.g., then it makes sense to eliminate any macroscopic, homogeneous deformation of the simulation cell, see the documentation about the atomic strain modifier:


Support Forum / Re: OVITO 3 dev 234 vs. 322
« on: January 15, 2019, 09:35:55 AM »
Hi Ali,
what operating system are you using?

Dear prash,

could you please explain again what the actual question is? If I'm not mistaken, the last file you uploaded is actually a periodic (infinite) structure, which in that sense has no center of mass, right?
Are you trying to calculate some sort of drift vector?

About unwrapping the coordinates, the easiest way is actually to dump snapshots with unwrapped particles in the first place. If you need to unwrap them now in post-processing, note that
each atom carries the information in which periodic image it is situated. When you calculate displacement vectors, OVITO automatically takes care of that. So what you could do is to loop over
all frames, calculate the displacement vectors in reference to the previous frame and then modify the position vectors accordingly. This works only though if the displacement between two frames is smaller than half of the simulation box length.


Support Forum / Re: Cropping pictures using Ovito
« on: January 11, 2019, 02:08:38 PM »
In that case, you could just edit the output image size in the Render Settings, see attached screenshot.
Also, note that you can change the camera view to "Preview Mode", when you click on the current viewport's caption in the top left corner (also marked in the screenshot).
This way you can get a preview of what your rendered image will look like and still zoom, turn or translate your structure until you have the desired viewing angle.

For the record, here's the documentation about rendering images.

Support Forum / Re: combine ovito python script with lammps
« on: January 11, 2019, 01:47:18 PM »
Hi Christophe,

Yes, that's what I was hinting at. Since Shijun tries to avoid having to dump a large amount of snapshots, this seems to be the preferred way.


Support Forum / Re: Cropping pictures using Ovito
« on: January 11, 2019, 01:42:14 PM »

there is an auto-crop function that you could use after you rendered the active viewport, see attached screenshot. Is that what you mean?


Support Forum / Re: combine ovito python script with lammps
« on: January 11, 2019, 12:19:00 PM »
Dear Shijun,

since it's possible to call python from within lammps it should in principle be possible to use ovitos, but it seems like you have already tried that and I doubt it would be very efficient.

I don't think there is an easy way to calculate defects "on the fly" with ovitos. However something similar seems to already exist in lammps. Have a look at the lammps documentation of the
compute voronoi/atom command, more specifically the keyword "occupation".
Maybe this way you can avoid post-processing after all.

Hope that helps,

Support Forum / Re: Moving atoms to the center of the simulation cell
« on: January 11, 2019, 11:54:16 AM »

I recommend you to use the Transformation matrix instead of the Transform to target box.
Note that you need to edit the Transformation matrix - Translation field, which I highlighted for you in the screenshot. In that example here I shifted all atoms upwards by 10 units.


Support Forum / Re: Moving atoms to the center of the simulation cell
« on: January 11, 2019, 10:59:21 AM »
Maybe it's best if you send me a screenshot of the modifier you apply, then I can tell you what's the problem.

Support Forum / Re: Moving atoms to the center of the simulation cell
« on: January 11, 2019, 10:09:13 AM »

what did you have trouble with? It's only a translation that you apply on the particles. Don't forget to unselect the simulation cell.


Support Forum / Re: Generate trajectory lines of a dynamic group
« on: January 11, 2019, 10:04:19 AM »
Hi prash,

unfortunately that's not possible yet but it may be implemented in the future.


Support Forum / Re: Working with Partial RDFs
« on: January 11, 2019, 09:26:42 AM »
Dear Sahar,

it's easiest if you export the partial RDFs you calculated as textfiles and then plot them with the plotting program of your choice. Then you'll have the most control over the visual representation.


Hi Reza,

yes, you can just import the second file using the Import File button and then click "add to scene".
To make particles transparent, you can use the Compute property modifier and generate a particle property "Transparency".


Support Forum / Re: Moving atoms to the center of the simulation cell
« on: January 11, 2019, 09:16:23 AM »

yes, you can easily do that with the Affine Transformation modifier. Here's the corresponding manual page


Support Forum / Re: Calculating RDF for molecules, not atoms
« on: January 11, 2019, 09:14:26 AM »
Dear Sahar,

your molecule ID's don't need to be continuous but you'll have to make them unambiguous to use the above script. Reassigning molecule IDs should be easy though.


Support Forum / Re: remove atom from spherical system
« on: January 10, 2019, 09:58:54 AM »

this will select the atoms inside a sphere of radius 72 centered at [74.516, 74.516, 74.516]:

Code: [Select]
(Position.X - 74.516)^2 + (Position.Y - 74.516)^2 + (Position.Z - 74.516)^2 <= 72^2

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