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 5 ... 10
61
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.

-Constanze

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

-Constanze

63
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
https://ovito.org/manual_testing/particles.modifiers.compute_property.html
or a Python script modifier
http://ovito.org/manual_testing/particles.modifiers.python_script.html

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 ovito.data 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)
    print(array_2d.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.

-Constanze

64
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
https://www.ovito.org/manual_testing/python/introduction/version_changes.html
for a detailed overview.

Here you can find the updated version of the scale-bar example script:
https://www.ovito.org/manual_testing/python/introduction/examples.html#example-scale-bar-overlay

-Constanze

65
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,
https://ovito.org/manual_testing/particles.modifiers.bin_and_reduce.html
It creates so-called Voxel grids
http://ovito.org/manual_testing/python/modules/ovito_data.html#ovito.data.VoxelGrid
which can be used by the Create Isosurface modifier
http://ovito.org/manual_testing/python/modules/ovito_modifiers.html#ovito.modifiers.CreateIsosurfaceModifier
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.

-Constanze

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

-Constanze

67
Hello,

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

-Constanze

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

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.

-Constanze

69
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
http://www.ovito.org/manual_testing/python/
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.

-Constanze

70
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]

-Constanze

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

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?

-Constanze

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

-Constanze


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

you could select the clusters in question and use the Surface mesh modifier on this selection.
http://ovito.org/manual/particles.modifiers.construct_surface_mesh.html

-Constanze

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

-Constanze

75
Support Forum / Re: Problem about using export_file
« on: March 12, 2019, 11:46:34 AM »
Dear Kai,

what's the operating system that you're using? Also could you please copy and paste the exact error message here.

-Constanze

76
Support Forum / Re: Partial radial distribution function (RDF)
« on: March 12, 2019, 11:30:50 AM »
Hello Safy,

yes that's what I find too, see attached partial rdf's. But I don't see any discrepancy between your data and the analysis result. The carbon atoms are just sitting on bcc octahedral lattice sites, right?

-Constanze

77
Support Forum / Re: Partial radial distribution function (RDF)
« on: March 12, 2019, 10:10:12 AM »
Hi Safy,

yes, in principle it works the same way with 3 particle types, just adapt the Neighbor Expression to count the particle type of your choice.

-Constanze

78
Support Forum / Re: Creating histograms of bond lengths
« on: March 12, 2019, 09:51:49 AM »
Hello Sean,

I can see that when you use the Compute property modifier to compute and store the new bond property called "Length" you assign values of 0 to every bond.
What you need to do is to edit the "Expression Field" and replace 0 by BondLength (which should also be visible in the list of available input parameters below the Expression Field).

-Constanze

79
Support Forum / Re: Creating histograms of bond lengths
« on: March 11, 2019, 05:27:57 PM »
Hello,

it's difficult to judge what goes wrong without seeing a screenshot but maybe  your uniform cutoff parameter in the Create Bonds modifiers is too small so no bonds are generated in the first place. Alternatively it could be a syntax mistake in your Compute property modifier. Feel free to upload a screenshot of the modifiers here, then I can help you.

-Constanze

80
Support Forum / Re: Wigner seitz analysis in ovito python script
« on: March 11, 2019, 05:22:25 PM »
Dear ludo,

could you please post the error message you're receiving.

-Constanze

81
Support Forum / Re: Polyhedral Template Matching Reclassification
« on: February 08, 2019, 05:38:20 PM »
Hi Ryan,

for each input particle, the PTM tries to determine a mapping of the local neighborhood to each active candidate structure. If such a mapping exists, a RMSD value is calculated, which is a measure of the spatial deviation from the ideal structure template (the quality of the match). The structural type with the lowest RMSD value is finally assigned to the particle.
You as a user can set a global RMSD cutoff, which limits the assignment of structural types to a range of RMSD values. Particles whose RMSD exceeds the threshold are assigned the "Other" structure type.
So I think what happens in your case is that if you deactivate the HCP structure type, the calculated RMSD values for a another structure type are still below the global cutoff, then they will be marked as such.

https://www.ovito.org/manual_testing/particles.modifiers.polyhedral_template_matching.html

Does that answer your question?

-Constanze

82
Support Forum / Re: Express select
« on: February 08, 2019, 01:22:55 PM »
Dear Ashik,

replace the commas with points, the correct syntax is Position.Z not Position,Z. Also note that the length unit here is Å not nm.

-Constanze

83
Support Forum / Re: Express select
« on: February 08, 2019, 12:25:54 PM »
Dear Ashik,

the Expression select modifier requires you to enter a boolean expression. The syntax supported by the modifier is very similar to the one used by the C programming language, see Manual:
http://ovito.org/manual/particles.modifiers.expression_select.html

If your nanowire is aligned with the z-axis and centered at (0,0,0) try for example:
Code: [Select]
Position.X * Position.X + Position.Y * Position.Y > 190^2 to select all atoms with r > 19 nm.

By the way, in the latest developer version, the Construct surface mesh modifier, also has an option Select particles on the surface, which might be of interest to you.
https://ovito.org/manual_testing/particles.modifiers.construct_surface_mesh.html

-Constanze

84
Hi Zhi-Gang,

in this topic it was discussed how to average different histograms,
http://forum.ovito.org/index.php?topic=450.0,
you can follow a similar approach.

If you want to do it without the GUI, here is an example script for a batch script that calculates time-averaged RDF's:
http://ovito.org/manual_testing/python/modules/ovito_modifiers.html#ovito.modifiers.CoordinationAnalysisModifier

The structure factor is the Fourier transform of the radial distribution function, right? So you could write a python script (you don't even need ovitos for that)
 that post-processes your radial distribution function.

-Constanze

85
Support Forum / Re: Counting specific particle types inside a cluster
« on: February 07, 2019, 08:44:28 PM »
Hi,

if you're using the latest developer version of OVITO the Unwrap trajectories modifier could be of interest to you.
http://www.ovito.org/manual_testing/particles.modifiers.unwrap_trajectories.html

In other cases I've also worked with a combination of the Replicate, Affine Transformation (apply a translation to only the particles not the simulation cell) and Wrap at periodic boundaries modifiers.

It depends on if the molecules are already split at a boundary in the initial frame or not.
Does that work for you?

-Constanze
 

86
Support Forum / Re: Python script slice modifier
« on: February 07, 2019, 12:16:47 PM »
Dear Haomin,

from the code snippet you sent I cannot find any reason why you would get an attribute error
AttributeError: 'ovito.plugins.PyScript.Viewport' object attribute 'camera_dir' is read-only,
so I guess you already resolved that yourself. Let me know if that's not the case.

Concerning the camera position, you chose a parallel projection viewport of type "Ortho".
In this case, the camera position has no influence on the size of the object your viewing.
What you could do is either adapt the field of view (fov) parameter,
Code: [Select]
vp.fov or change to a different viewport of type "Perspective".

One more note, I think you don't need the last line image.save(), you can pass the filename
directly to the the render_image() function instead.

Code: [Select]

vp.render_image( size = (480, 480), \
              background = (0,0,0), \
              renderer = OpenGLRenderer(),\
              filename = "/Users/h ...image{}r.png".format(i) )

-Constanze


87
Support Forum / Re: Render camera_dir problem
« on: February 05, 2019, 09:37:38 PM »
Dear Haomin,

please post the code that's causing you this error.

-Constanze

88
Support Forum / Re: Loop over the frames calculation
« on: February 05, 2019, 09:34:16 PM »
Hi Ali,

to answer your first question, if you simply want to calculate an average of a particle property for each frame you can do it using a custom python script modifier function in the GUI as often discussed in this Forum and explained in the FAQ. The following script (OVITO 3) will calculate the average atomic shear strain, print and save that information as a global attribute for each frame. Global attributes can conveniently be exported to a text file using OVITO's file export function, see Manual https://ovito.org/manual_testing/data_inspector.attributes.html
Code: [Select]
from ovito.data import *
import numpy as np

def modify(frame, data):
    avg_shear_strain = np.mean(data.particles["Shear Strain"])
    print(avg_shear_strain)
    output.attributes["Average shear strain"] = avg_shear_strain

As for your second question, the previous example is a batch script. It's meant to be executed with ovitos (OVITO's script interpreter) from the command line. See the Scripting Manual for more details.
https://ovito.org/manual_testing/python/introduction/running.html
In short, if you have installed OVITO in C:\ProgramFiles, you execute it like this:
Code: [Select]
"C:\Program Files\Ovito\ovitos.exe"or 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.
Also don't forget to import the numpy and the ovito.io modules.

-Constanze

89
Support Forum / Re: Loop over the frames calculation
« on: February 05, 2019, 05:18:44 PM »
Hi Ali,

that's not possible at the moment, since the python script modifier in the GUI is part of the pipeline which is evaluated for each frame.
It can't manipulate the pipeline itself that it is part of (e.g. adding/removing modifiers) or otherwise change the global program state.
For more details, I'll refer you to the documentation on custom modifiers:
https://ovito.org/manual_testing/python/introduction/custom_modifiers.html

-Constanze

90
Support Forum / Re: Loop over the frames calculation
« on: February 05, 2019, 10:19:10 AM »
Dear Ali,

you can do it using a small batch script that you need to execute with ovitos.  Say you're calculating a system average of a particle property "My Property" and then also want to average that over different frames. This can be done like this for example:
Code: [Select]
pipeline = import_file("simulation*.dump")
sum = 0.0
for frame in range(pipeline.source.num_frames):
    data = pipeline.compute(frame)
    sum += numpy.average( data.particles["My Property"] )
print( sum/pipeline.source.num_frames )
also see here
http://www.ovito.org/manual_testing/python/introduction/file_io.html

Does that solve your question?

-Constanze

Pages: 1 2 [3] 4 5 ... 10