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

92
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

93
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

94
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

95
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

96
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

97
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

98
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

99
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

100
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

101
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

102
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

103
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

104
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

105
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

106
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

107
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

108
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

109
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

110
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


111
Support Forum / Re: Counting specific particle types inside a cluster
« on: January 25, 2019, 11:44:17 AM »
Hi,
a possible way to do this could be to apply the cluster analysis modifier,
https://ovito.org/manual/particles.modifiers.cluster_analysis.html
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.

-Constanze

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

-Constanze

113
Hi,

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 script.py (see also Manual of scripting usage).


Code: [Select]
from ovito.io import *
from ovito.data 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)
pipeline.modifiers.append(ws)

#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,

-Constanze

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

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
http://www.ovito.org/manual_testing/python/modules/ovito_data.html#ovito.data.Bonds
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 ovito.data 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.

-Constanze

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

-Constanze

116
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']
    #print(disl_count.as_table())
    data.attributes["1/6<112> Shockley Count"] = disl_count.y[2]
   

See also http://www.ovito.org/manual_testing/python/modules/ovito_data.html#ovito.data.DataSeries

-Constanze

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

-Constanze

118
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:
http://ovito.org/manual_testing/particles.modifiers.unwrap_trajectories.html


-Constanze

119
Hello,

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, neigh.delta + positions[index]) for neigh in finder.find(index) ]
    print("Neighbor Atom \t Position")
    for neigh in neighbors:
        print( "{} \t {}".format(neigh[0],neigh[1]))

-Constanze

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

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

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:
http://www.ovito.org/manual_testing/python/modules/ovito_data.html#ovito.data.CutoffNeighborFinder.

-Constanze

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