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

2
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

3
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

4
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

5
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
 

6
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


7
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

8
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

9
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

10
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

11
Hello,

there is no issue with the way you're performing the analysis, it's rather that for your system it's not that clear to me how you should define a BO3 and BO4 units.
I had a look at your structure and it looks almost amorphous to me, is that the case? The issue is that there is not really a clear criterion that would let you distinguish between 3-fold and 4-fold coordinated B-O units here since there is a wide range of bond lengths of B-O neighbor bonds.
If we simply compare coordination numbers for different cutoffs, you'll find that there is always a broad distribution of coordination numbers (often ranging from 2 to 10) and not only 3-fold and 4-fold ones.
This is also visible in the partial rdfs.
At the moment, I don't have any better suggestions how to tackle this.

-Constanze

12
Support Forum / Re: Distribution of coordination number
« on: February 04, 2019, 02:23:48 PM »
Dear Mahsa,

alright, I had a look at your data. You were asking how to calculate the number of O-atoms (which have a particle type id = 1 as shown in the screenshot) around the Li-atoms (in your case named "Li+" and having a particle type id = 4).

In the python script you posted here you're obviously counting C atoms around O-atoms, because you iterate over particles having a particle type 1 and count how many neighbors of type 2 they have. Bottom line is, you should never just copy and paste a custom python modifier
function without understanding every bit of it.
I know it's quite a steep learning curve in the beginning, so here's the corrected version (for the latest OVITO developer version) as a head start for you:

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

def modify(frame, data):
    # Prefetch the property array containing the particle type information:
    ptypes = data.particles['Particle Type']
    #Create a new particle property that stores the number of neighbors with particle type 2 and initialize with zeros
    values = np.zeros(data.particles.count, dtype=int)
    new_property = data.particles_.create_property('Li-O Coordination', data=values)
    # Initialize neighbor finder object:
    cutoff = 2.
    finder = CutoffNeighborFinder(cutoff, data)
   
    # Loop over all particles:
    for index in range(data.particles.count):
        #Only iterate over particles of type Li
        Li_type_id = ptypes.type_by_name('Li+').id
        if(ptypes[index] == Li_type_id):
           # Get a list of particle types of all neighbors of the current particle:
            neighbor_types = np.array([ptypes[neigh.index] for neigh in finder.find(index)])
            #Count the number of  O neighbor types and store them in the newly created particle property
            O_type_id = ptypes.type_by_name('O').id
            with new_property:
                new_property[index] = np.count_nonzero(neighbor_types == O_type_id)

In case you are unsure about what particle type id corresponds to what particle type name  the function type_by_name().id is very useful.
https://ovito.org/manual_testing/python/modules/ovito_data.html#ovito.data.Property

Furthermore, you asked if you could distinguish between two different groups of O-atoms. Yes, in your case that's possible because they have a distinguishable feature which is the Molecule Type.
So you have O atoms which have a Particle Type 1 and a Molecule Type 1 ("LIG") and another group of O-atoms which have a Particle Type 1 and a Molecule Type 3 ("tf2") and you
can select the atoms that fulfill both conditions, e.g. just

add a line at the top where you get the molecule types
Code: [Select]
mtypes = data.particles['Molecule Type']
and then e.g. replace the if condition by:

Code: [Select]
if(ptypes[index] == Li_type_id):
           # Get a list of particle types of all neighbors of the current particle:
            neighbor_types = [ ( ptypes[neigh.index], mtypes[neigh.index]) for neigh in finder.find(index)]
            #Count the number of  O neighbor types and store them in the newly created particle property
            print(neighbor_types)
            O_type_id = ptypes.type_by_name('O').id
            tf2_type_id = mtypes.type_by_name('tf2').id
            print(tf2_type_id)
            with new_property:
                new_property[index] = neighbor_types.count( (O_type_id, tf2_type_id))

where you use both the Particle Type and the Molecule Type as criterion in the count function.

Let me know if you have questions,

-Constanze

13
Support Forum / Re: Distribution of coordination number
« on: February 04, 2019, 12:03:29 PM »
Dear Mahsa,

you don't need to upload the whole trajectory, a single shapshot would be enough for me as an example. But yes you can share a download link here or sent a private message to us via the mail support.
The script doesn't seem to be the problem, are you sure the cutoff used for the CutoffNeighborFinder function is appropriate? I'm happy to look into it further once I have access to the data.

-Constanze

14
Support Forum / Re: homogeneous cell deformation IN OVITO 3.0.0
« on: February 04, 2019, 11:58:22 AM »
Dear Bahman,

in OVITO 3.0.0 this feature has been upgraded and renamed to Affine mapping of the simulation cell, see e.g.,
http://ovito.org/manual_testing/particles.modifiers.displacement_vectors.html
and
http://ovito.org/manual_testing/particles.modifiers.atomic_strain.html

-Constanze

15
Hello,

it is difficult for me to diagnose why you obtain certain results without having insight into your data. If you like you can upload an example file here, then I can try to help.
Also, did you opt for the Python script modifier or the Compute property modifier?

Concerning the partial radial distribution functions, yes you can do it using a custom python script modifier, as explained here
http://forum.ovito.org/index.php?topic=131.0,
but it's easiest to just update to the latest developer version of OVITO, where the Coordination analysis modifier in the GUI has a checkbox  "Compute partial RDFs".

-Constanze

16
Support Forum / Re: Distribution of coordination number
« on: February 01, 2019, 10:13:26 AM »
Dear Mahsa,

could you upload an example of your structure here and also paste the python script, then I can help you more easily.

-Constanze

17
Support Forum / Re: Python script slice modifier
« on: January 31, 2019, 11:27:57 AM »
Dear Haomin,

just to confirm, your rendering images programmatically and you're asking about the Slice modifier in the Python API, right?
Note that the Slice modifier takes an argument "normal", which is the normal vector of the slicing plane and by default is set to (1,0,0). You can adapt that to your needs, e.g.

Code: [Select]
from ovito modifiers import SliceModifier
pipeline.modifiers.append( SliceModifier( normal = ( 1, 1, 2)) )
https://ovito.org/manual_testing/python/modules/ovito_modifiers.html#ovito.modifiers.SliceModifier

Edit:   You can then set up the viewport’s virtual camera and e.g. control the viewing direction vector like this:

Code: [Select]
from ovito.vis import Viewport
vp = Viewport(type = Viewport.Type.Ortho, camera_dir = (1, 1, 2))
vp.zoom_all()
https://ovito.org/manual_testing/python/modules/ovito_vis.html,


-Constanze

18
Support Forum / Re: color coding
« on: January 30, 2019, 05:47:09 PM »
Dear Bahman,
in that case I think it’s easier to use the Expression selection modifier in conjunction with the Assign color modifier. So first select all atoms with the desired atomic property value (or value range) and then give this selection a color of your choice.
Does that work for you?
-Constanze

19
Support Forum / Re: The mutable problem in Function
« on: January 30, 2019, 02:05:23 PM »
Hello,

in the latest version you don't need to use two separate "input" and "output" data objects. Now the DataCollection data initially holds the input data objects of the modifier, which were produced by the upstream part of the data pipeline. Your user-defined modifier function is then free to modify the data collection and the data objects stored in it, so simply do it like this:

Code: [Select]
def modify(frame, data):
    data.cell_.pbc = (True, True, False)

-Constanze

20
Support Forum / Re: color coding
« on: January 30, 2019, 01:54:14 PM »
Dear Bahma,

the start and end values in the Color coding modifier
http://www.ovito.org/manual/particles.modifiers.color_coding.html
control the value range for the linear mapping of input values to the [0,1] interval. More detailed, the values of the selected input property are first mapped and clamped to the unit interval [0,1] according to the Start value and End value parameters of the modifier. The normalized values are then mapped to a color using the selected color gradient map and finally assigned to the particles or bonds.

-Constanze

21
Hello Tina,

thanks for uploading the structure. Yes, that the surface atoms will be identified as "Others" is completely expected. Interestingly, inside the cluster there is a mixture of atoms that are identified both as fcc and hcp and the center atom is sitting in a perfect icosahedral environment. Note, that a twin boundary in the fcc structure would be a {111}-hcp plane and I can't really identify that in your cluster, but I think you maybe mean something else by twin boundaries?

Regardless, you can see that there is some sort of symmetry in the arrangement of the of the atoms colored by different structure types. I attached a little video for you that shows your cluster, one time viewed from a "corner atom" and one time the viewing direction is perpendicular to a facet. You can use the Slice modifier
http://ovito.org/manual_testing/particles.modifiers.slice.html
 to slice through your structures like in the animation. I used the functions "Pick three atoms" and "Align plane normal to view direction" to find the correct slicing planes and animated the slice using the auto-key mode.
http://ovito.org/manual_testing/usage.animation.html

-Constanze

22
Hello Tina,

thank you for the picture, but could you upload the coordinates so I can load them into OVITO myself?

Also note that what is shown in the picture from the manual are dislocations in a FCC crystal. All (green) FCC atoms have been deleted so that only (red)
atoms in a HCP environment are visible -  indicators for planar defects like stacking faults and coherent twin boundaries in FCC.

-Constanze

23
Hello,

concerning your first two questions, yes, that should be possible. I would suggest to use a bond-based criterion, to identify the structural units - more specifically the Create bonds modifier.
http://ovito.org/manual_testing/particles.modifiers.create_bonds.html
Let's say that whenever an O atom is found in the neighborhood of an A atom within a cutoff of 2 Å , or whatever your distance unit is, you consider them bound.
Thus, you could choose the option "Pair-wise cutoffs" and edit only the cutoff value for A-O pairs to 2.
In a next step, you could use a Python script modifier function,
https://ovito.org/manual_testing/particles.modifiers.python_script.html
that loops over all A-atoms and counts the number of A-O bonds connected to each A atom, which should either be three or four in your case, right?
If you need help with the scripting part let me know.

Alternatively, if you don't want to calculate bond vectors and/or are not comfortable with python scripting you could also just use the Compute property modifier
https://ovito.org/manual_testing/particles.modifiers.compute_property.html
to generate a particle property "Number-of-O-neighbors". Let's assume your particle types A, B and O are associated with particle type id's 1, 2 and 3.
Then you would need to enter 0 in the "Expression field" and "ParticleType == 3? 1:0" in the "Neighbor expression field".
In short, this is a sum over all neighbor atoms where +1 for every neighbor atom of type 3 is added, otherwise the contribution is 0.
(Please double check that the type id of the O atoms is really 3, it depends on your input.) Here you will also need to specify an appropriate cutoff for your problem,
that controls within what distance range an atom is considered as a neighbor.

Now, you have calculated that property for every atom, but your questions is how many A atoms are coordinated by 3 or by 4  O-atoms. This can be calculated using
the Expression selection modifier
https://ovito.org/manual_testing/particles.modifiers.expression_select.html.
In case the particle type id of the A atoms is 1, the boolean expression would be "ParticleType == 1 &&  Number-of-O-neighbors == 3" to count the AO3 structural units e.g.

Concerning the last question, you can use OVITO to calculate the (partial) radial distribution functions, have a look at the Coordination analysis modifier.
http://ovito.org/manual_testing/particles.modifiers.coordination_analysis.html

Hope that's a good starting point for you. Let me know if you have questions.

-Constanze

24
Dear Tina,

could you please explain what crystal structure your cluster has and also how you define twin boundaries? From the screenshot I cannot get a good idea of the structure yet.
Note that for using the Dislocation analysis tool you need to specify the lattice type of the input crystal and currently, only the following crystal structures  are supported: FCC, HCP, BCC, and diamond.
So if your cluster does not have one of these crystal structures the DXA is probably not the right tool for your setup.

But I can of course try to look into the problem further if you upload your structure here.

-Constanze

25
Support Forum / Re: add axis labels and ticks
« on: January 29, 2019, 11:26:08 AM »
Dear Dori,

sorry my comment about exporting the trajectories might have been misleading - currently it cannot be done through the File-Export function. However, you can simply use np.savetxt() in a python script modifier
to export the trajectories, e.g. like this:

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

def modify(frame, data):
    pos = data.trajectories_.positions_
    id = data.trajectories_.particle_ids_
    np.savetxt("trajectories.txt", np.column_stack((id, pos)), fmt = "%i %f %f %f")

The above modifier will create a file "trajectories.txt" that contains the trajectories of all atoms. Say you have 3 atoms and 5 frames, then the first 5 lines are the positions of atom 1, the next 5 the positions of atom 2 etc.
This is just a suggestions, of course you can alter the script to make it match your desired output format.

https://ovito.org/manual_testing/python/modules/ovito_data.html#ovito.data.TrajectoryLines

Hope that helps,

-Constanze

26
Support Forum / Re: Accuracy of "create bonds" command
« on: January 29, 2019, 11:08:57 AM »
Dear Dori,

I'm still having trouble understanding the issue, but note that the Create bonds modifier calculates bond vectors based on a distance criterion, i.e. for the specified cutoff "no more" than a bond-vector will be generated for each found neighbor atom within that cutoff.
http://www.ovito.org/manual_testing/particles.modifiers.create_bonds.html

So in a way you as a user control (via the cutoff value) when two atoms are supposed to be connected through a "bond". Does that answer your question?

-Constanze

27
Support Forum / Re: add axis labels and ticks
« on: January 28, 2019, 10:24:46 AM »
Dear Dori,

currently there is no easy way to include tics and axes labels on the simulation cell. Reproducing the appearance of your example figure would require quite some coding on your
part using the "Python-Overlay" function, here's the corresponding manual entry in case you didn't know.
http://ovito.org/manual/viewport_overlays.python_script.html

I think it's faster to just export the trajectories as txt files and then plot them with your usual plotting tool. That way you can easily include the axes and have more control.
That being said, if you're absolutely determined to do it in OVITO, I can help you if you run into trouble with the scripting part.

-Constanze

28
Support Forum / Re: Accuracy of "create bonds" command
« on: January 28, 2019, 09:44:21 AM »
Hello Dori,

can you elaborate that question? What do you mean by "accurate bond"?

-Constanze

29
Support Forum / Re: Vornoi Analysis
« on: January 25, 2019, 05:16:06 PM »
Hi Aditya,

yes the output will be slightly different because
Code: [Select]
np.where( unique_atom_IDs == particle_index)[0] is empty if unique_atom_IDs is a list, which then leads to the central particle not being removed from the neighbor list .
The np.delete(...) is then obsolete. You'll see that when you add print(len(unique_atom_IDs)) and print(len(neighbor_indices)) to your script.

-Constanze

30
Hi,

it will look for the files in the current folder, but you can of course specify the path to that file when you call import_file().
Moreover, this script is written in OVITO 3 syntax.
Also note, that you can call ovitos.exe by its absolute path, e.g., if you have installed it in C:\Program Files:

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.

Concerning your last question. No, so far the code-snippet will not output anything, you'll need to add that. The good news is that you can basically copy the
Wigner Seitz analysis example script from the scripting reference:
http://ovito.org/manual_testing/python/modules/ovito_modifiers.html#ovito.modifiers.WignerSeitzAnalysisModifier

-Constanze


Pages: [1] 2 3 ... 7