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 ... 27
In principle, you can draw anything you like using the painting functions of the QPainter class from the Qt framework. The rudimentary scale "bar" was okay for my purposes when I wrote that demo code, but anything beyond that requires that you write additional Python code yourself.

Your code only calls the fillRect() function. I think, additionally, you need to call drawRect() to draw a border on top. The thickness and color of the border will be determined by the pen that was previously set on the QPainter object. So probably another call to setPen() is in order as well to first specify the border color.


I assume you are working with the latest development version of OVITO 3.0. Here, the programming interface has changed in a way that is not backward compatible with previous versions.

It is longer possible to access the loaded input data using the expression 'pipeline.source.particle_properties', because the data source is no longer a data container itself. You need to evaluate the data source and request the data collection instead using its compute() method:

atypes = pipeline.source.compute().particles['Particle Type'].types

See the 'data access' section of the FileSource class documentation. Note that I have further adapted the code line to the new programming interface.


Support Forum / Re: Non-affine mean displacements calculations
« on: June 17, 2018, 01:44:24 PM »
... And thank you for the positive feedback on OVITO. I really appreciate it and I'm glad you find the program useful.

Support Forum / Re: Non-affine mean displacements calculations
« on: June 17, 2018, 01:43:16 PM »
Dear Pablo,

I'm not sure whether (and why) the system-average D^2 value and the MSD value should really match as you claim, but I can imagine that under certain circumstances the two quantities should correlate and show a similar magnitude.

One detail that may not become clear from the documentation of the Atomic Strain modifier is that the D^2 value computed by OVITO does not get normalised by the number of neighbors of an atom. The D^2 value of one atom is simply the sum over the squared non-affine relative displacements of all its neighbors.  If you increase the cutoff radius parameter, more neighbors will contribute and the resulting D^2 value will naturally rise.

I think this might provide an explanation why the D^2 values you observe are so much higher than the per-atom MSD values. To correct them, you need to divide the D^2 values by the number of neighbors within the cutoff range, basically to avoid double counting displacements. the number of neighbors in the reference configuration can be determined using the Coordination Analysis modifier and a Freeze Property modifier.


Support Forum / Re: Problem with export_file
« on: June 15, 2018, 12:24:18 PM »

I noticed the following in your script:

You first import an entire file sequence, but then you import each individual file again in the for-loop, it seems:

Code: [Select]
node1 = import_file("/home/leila/Leila_sndhard/codes/gb_mobility_test/gb_mob/results_dE0.01/gb_ts100_T800/f.010/zdump/zdump.*.out", multiple_frames = True)
for i in range(n_f):
    node = import_file (filenames[i+1])

OVITO 2.9.0 contains a software bug, which leads to an I/O error when you call import_file() too often from a script (typically a few hundred times). This may be why you got the error message. The problem is fixed in the newer development versions.

But importing the file sequence just once should be enough in your case. Simply remove the import_file() call from the loop and use the existing pipeline node1 instead for processing each frame.

In fact, you don't even need the for-loop in the present case. The following lines should be enough (and will generate one big output file with all displacements for all frames, which you asked for):

Code: [Select]
node1 = import_file("/home/leila/Leila_sndhard/codes/gb_mobility_test/gb_mob/results_dE0.01/gb_ts100_T800/f.010/zdump/zdump.*.out", multiple_frames = True)
dmod = CalculateDisplacementsModifier()
export_file(node1, "msd_data.txt",format = "xyz", columns = [ "Particle Identifier", "Particle Type", 'Displacement Magnitude'], multiple_frames = True)

Support Forum / Re: Problem with export_file
« on: June 14, 2018, 05:10:15 PM »
Dear Leila,

Please say something about the "MSD" array. How is it generated? And does it represent per-particle information or something else?

It seems that the "MSD" field currently is a global attribute and not a particle property. That is because the "txt" file export format only allows to export global attributes but not per-particle data. If you would like to export particle/=-based information, then you have make sure that "MSD" is a particle property first, and then use the "xyz" export format.


The bug was reported earlier here:

Dear Zhen,

I think the problem you describe is a bug that was present only in that particular development build of OVITO (3.0.0-dev185). It should be gone in more recent dev builds, which you can download from the website.


Support Forum / Re: Is there a way to make bonds transparent?
« on: June 13, 2018, 11:51:39 AM »
Dan, Jérôme,

Please excuse my long silence in this matter.

The answer is negative: Support for semi-transparent bonds is lacking in OVITO. It hasn't been implemented yet, mostly because it would require a more complex OpenGL rendering pipeline and the resulting visual quality would not be as expected, because bond cylinders typically intersect with the particle spheres.

I have now created an official feature request for this. Maybe I can find time in the future to add support for semi-transparent bonds:

I cannot really think of a good workaround. Perhaps, in some cases, it is possible to render the particle/bond system fully opaque using OVITO and then superimpose the image on a background using a photo-editing software and make it semi-transparent. Not really a great solution, I know...


Support Forum / Re: Question about Voronoi calculation
« on: June 08, 2018, 11:52:13 PM »
Dear Shuai,

I suspect you are trying to run this script using Ovito 3.0.0-dev. Is that right? The example code you took from the website is for the stable release 2.9.0. The current development release 3.0.0-dev is not 100% backward-compatible, because the Python programming interface did slightly change.

An updated version of the Voronoi analysis script for Ovito 3.0.0-dev is included with the new documentation that gets installed along with the program and which can also be found online:


Support Forum / Re: The ImportError: cannot import name 'DataObject'
« on: June 08, 2018, 07:10:13 AM »
Hi Shuai,

This error is quite unusual and could be the result of a broken installation.
Which program version of Ovito did you install? Note that, for Windows, there also exists a zip archive with the program, which can be downloaded form the website. This archive can be extracted in any location on your computer without installation. Maybe you want to try this one again.


P.S.: It's not guaranteed that Ovito will work when you install it over an older installation in the same directory. It's currently recommend to remove the old version first before installing the new one.

Support Forum / Re: rotation single frame
« on: June 06, 2018, 07:39:04 PM »
1) The animated object will always rotate around its origin, i.e. (0,0,0) in the simulation coordinate system. But note that you can make use of the Affine Transformation modifier to shift all particles and the simulation cell by an arbitrary translation vector. With that, you can adjust the (apparent) center of rotation.

2) I'm not sure what you mean with that. My instructions were based on the assumption that you have loaded exactly one static simulation frame and that you have used the animation settings dialog to set the length of the animation to N animation frames (N>1). So what kind of frame do you mean when you ask how to make a movie using one "frame"? And yes: The idea is to set the rotation angle of the object to 0 degrees at animation frame 0, and to 360 degrees at the last animation frame. The program should interpolate between the two values.

If you think you did something wrong, and don't know what it is, please save the scene to an .ovito file and uploaded it here. I will take a look.

Support Forum / Re: Regarding atomic strain modification
« on: June 06, 2018, 11:20:35 AM »
With "strain tensors" you mean the 6 individual components of the atomic strain tensor (in 3d), right?

OVITO should have computed those tensor components given that you did not disable the Atomic Strain modifier, the "Output strain tensors" option of the modifier has been activated, and there is no error message being displayed by the modifier. Note that the Stress Tensor particle property may not be visible in selection box of the Color Coding panel while the Atomic Strain modifier is still computing its results.

Also note that, by default, the Atomic Strain modifier outputs only the Shear Strain property for each atom. You need to activate the "Output strain tensors" option in order to get all 6 strain components (3 of which will be zero in case of a 2d system).

Support Forum / Re: Regarding atomic strain modification
« on: June 05, 2018, 05:14:17 PM »
Thanks. I tested it myself and it worked as expected. Here is what I did:

1. Load the file dumpf.dat in OVITO.
2. In the "XYZ" panel, activate the option "File contains time series"
3. Go to the 'Simulation cell' panel and activate the 2D mode.
4. Insert Atomic Strain modifier, set "cutoff radius" parameter to a value of 3.0
5. Scroll down to "Reference: External file" panel and use the "Pick new file" tool button to load the reference configuration (dump_initial positions.dat).

Pages: [1] 2 3 ... 27