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 ... 6
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

Support Forum / Re: Calculating RDF for molecules, not atoms
« on: January 09, 2019, 04:02:57 PM »
Dear Sahar,

here's an idea how you could perform the calculation: So each atom also has a particle property "Molecule Identifier" such that you know to which molecule it belongs. In order to compute RDFs for your molecules you first need to calculate the center of mass of each molecule. This could be done by a using a python script modifier in the graphical user interface:

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

def modify(frame, data):

    num_particles = data.particles.count
    pos = data.particles_["Position"]
    #Part 1
    #Create new particle property that contains the atomic masses
    # Edit the following list
    my_masses = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
    mass_property = data.particles_.create_property('Mass')
    p_types = data.particles["Particle Type"]
    for atom_index in range(data.particles.count):
        with mass_property:
            mass_property[atom_index] = my_masses[ (p_types[atom_index] - 1) ]
    #Part 2
    #Calculate center of mass for every molecule and save as new particle property
    mol_IDs = data.particles_['Molecule Identifier']
    mol_com_property = data.particles_.create_property('Molecule COM', dtype = float, components = 3)
    #Loop over all Molecule Identifiers
    for current_molecule in set(mol_IDs):
        #Find all the atoms that belong to that molecule and average their positions
        with mol_com_property:
            mol_com_property[(mol_IDs == current_molecule)] = np.average( pos[((mol_IDs == current_molecule))], weights = mass_property[((mol_IDs == current_molecule))], axis = 0)

This custom modifier has several parts. In part 1 you will create a particle property "Mass" and add the corresponding atomic masses since they are (currently) not automatically read in when importing a dump file. In this example I used a look up list called "my_masses" that contains the masses of all 11 particle types (they're all 1 in this test case), which you should edit.
This information is necessary to compute the center of mass vector for each molecule, which is calculated and stored in a new particle property 'Molecule COM' in Part 2 (see result in the attached screenshot).

From there you can go on and compute RDF's by either writing your own script or maybe a simpler procedure would be to export the molecule center of masses together with the molecule types (to the lammps dump or xyz format e.g.) as if they were atoms. In that way you can re-import that file and simply apply the coordination analysis modifier in the graphical user interface.

Please note, however, that the above script does not take care of periodic boundaries yet, so you'll need to add that part where you average the positions in case you have applied periodic boundary conditions in you simulation. Also, can you explain how you defined the molecule identifier? I noticed that in some cases the atoms that share the same  molecule identifier, e.g. molecule 1, are very far apart. See screenshot 2 for an example. Was that done deliberately?

Hope that helps,


Support Forum / Re: Calculating RDF for molecules, not atoms
« on: January 09, 2019, 12:42:45 PM »
Dear Sahar,

what you're asking for should be achievable by using a Python script modifier, however, that will require some python coding on your part. Can you give me an example of how your input data format looks like? Then I can give some help with the script.


Support Forum / Re: WS Analysis for Occupancy Plot
« on: January 07, 2019, 01:38:50 PM »
Dear Vivek,

what do you mean by
...however, such movement occurs only at some particular time-steps, which made me think if there is any issue arising out of the WS analysis used...?
Just take your original data and compare the coordinates of the atoms in the different snapshots, the observed displacement has nothing to do with any of the analyses you applied.

In this previous topic you mentioned and also in a current thread here:
it is discussed how to deal with the reference structure shifting as whole. In that case you could calculate the drift vector and map the damaged structure back to the reference structure so to say.
However, I'm afraid this won't help you since these artifacts only occur in specific regions.


Dear wufc,

as you already noticed there have been some changes in the python API. This is documented here:

In older versions, you cannot use the "with" statement to get write permission to particle properties, but the following should work:
Code: [Select]
new_pos = output.copy_if_needed(output.particle_properties["Position"])
new_pos.marray[...] -= offset


Support Forum / Re: WS Analysis for Occupancy Plot
« on: January 07, 2019, 12:15:59 PM »
Dear Vivek,

this seems to be an issue of your simulation setup. Have you noticed that in some of your snapshots, the atoms in the corners clearly drift into one direction?
In the attached snapshot you can see that they have non-negligible displacements with respect to the lattice constant. Since the WS-analysis simply looks for the current number of atoms present in the
WS-cells defined by every atom in the reference structure, it makes sense that the WS analysis will detect a lot of defects in this region.


Support Forum / Re: Lammps data file bond property coloring
« on: January 07, 2019, 10:50:22 AM »
Dear Botond,

as I said, it's the latest developer version available here:

Note that there have been some changes in the python API, which are documented here:

In your case it's important to understand that OVITO 3.x no longer works with a half-bond representation, which will make it easier for you to handle the information of your custom bond property. More specifically, in OVITO 2.9 syntax you would have had to create the new bond property like this:
Code: [Select]
output.create_user_bond_property('coeff', data_type = "float", data = bond_coeffs)
where bond_coeffs, however, would have needed 22 entries instead of 11, since there are 22 half bonds e.g. [0 1], [1 0], [0 3], [3 0] ... etc. So if you insist on using OVITO 2.9 you'll need to take that into account when creating the additional files containing the bond property.
Another issue is that in OVITO 2.9 the file source is not an attribute of the DataCollection interface but was stored in FileSource.loaded_file which is however not accessible from within the python script modifier. So you will need to use a different way to load the correct bond_prop_*.dat file. If the numbering of your files follows the timestep, then you could for example calculate the current timestep from the current frame number input.attributes['SourceFrame'].


Support Forum / Re: WS Analysis for Occupancy Plot
« on: January 07, 2019, 10:15:45 AM »
Dear Vivek,

if you upload the simulation data here I could investigate this further.


Support Forum / Re: Lammps data file bond property coloring
« on: January 04, 2019, 02:19:25 PM »
Hi Botond,
here is how you would do this with a python script modifier in the GUI of the latest developer version of OVITO. For each frame, this custom modifier will look for the corresponding text file called "bond_prop_<TIMESTEP>.dat" that has the information of the additional bond properties. So for the file "lammps_495000.dat" you uploaded it would have to be called "bond_prop_495000.dat" and would contain the following information according to your example case, right?

1 0.1
2 0.2
3 0.3
4 0.4
5 0.5
6 0.1
7 0.1
8 0.1
9 0.1
10 0.1
11 0.1

Here, the first column is the bond index and the second column the bond coefficient you specified.
After importing the additional information, you then only have to create a custom bond property which is then accessible to all modifiers that follow.

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

def modify(frame, data):
    #import bond_coeff file corresponding to the current frame
    myfile = "bond_prop_{}".format(data.attributes["SourceFile"].split("_")[1])
    bond_index, bond_coeffs = np.loadtxt(myfile, unpack = True)
    #create new bond property called 'coeff' and assign imported values
    data.bonds_.create_property('coeff', data = bond_coeffs)

Hope that helps,


Support Forum / Re: Averaging over the frames
« on: January 04, 2019, 02:04:08 PM »
Since you also asked about scatter plots and histograms, maybe there is an easier solution for you. If you're using the latest developer version of OVITO, you could export the time series of scatter plots or histograms you computed as text files (as shown in the attached screenshot).
In a second step, then write a simple python script (you won't need ovitos for this) that reads in all these textfiles files and calculates the average. Let's say you have files that are named according to the following pattern: histo_1.txt, histo_2.txt ...etc.

Then the following python script should do the job:
Code: [Select]
import numpy as np
import glob
Y = []
for file in glob.glob('histo_*.txt'):
    x, y = np.loadtxt(file, unpack = True)
np.savetxt( "average_histo.txt", np.column_stack( (x, np.mean(Y, axis = 0))))


Pages: [1] 2 3 ... 6