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]
1
Support Forum / Re: Order of neighbors from NearestNeighborFinder
« on: July 10, 2018, 04:06:39 PM »
Indeed, the NearestNeighborFinder sorts the neighbors by the length of the distance vector to the central particle.
In order to print the indices of the neighbors of each particle sorted like you asked could try something along these lines:

Code: [Select]
from ovito.io import import_file
from ovito.data import NearestNeighborFinder
import numpy as np

pipeline = import_file("simulation.dump")
data = pipeline.compute()
N = 3
finder = NearestNeighborFinder(N, data)

for index in range(data.particles.count):
    neighbors = [ (neigh.index, neigh.delta) for neigh in finder.find(index) ]
    #print neighbor indices                                                                                                                                                                                                                       
    print( [n[0] for n in neighbors] )

    resorted_neighbors = sorted( neighbors , key=lambda k: [k[1][0], k[1][1], k[1][2]], reverse=True )
    #print rearranged neighbor indices                                                                                                                                                                                                           
    print( [n[0] for n in resorted_neighbors] )

2
Support Forum / Re: Averaging the values of a property
« on: July 10, 2018, 02:16:48 PM »
Dear Sam,

not quite sure what you mean, you can access the particle property 'Stress Tensor' like any other particle property. Did you have trouble slicing a specific column? That works like this:

Code: [Select]
stress_xx = input.particles['Stress Tensor'][:,0]
stress_yy = input.particles['Stress Tensor'][:,1]
stress_zz = input.particles['Stress Tensor'][:,2]

Constanze

3
You're mixing up two different things here, the particle identifier and the particle indices.
Particle identifiers are usually assigned by LAMMPS, can have any order and are positive numbers, i.e. they start at 1. They are explicitly defined as an independent particle property.
The NearestNeighborFinder, however, works only with particle indices, which are implicitly defined by the order of the atoms in your input data. They start at 0.

If you want to know the particle identifier of a neighbor atom you can simply look it up, e.g.
Code: [Select]
data.particles['Particle Identifier'][neigh.index]

4
Support Forum / Re: Averaging the values of a property
« on: July 09, 2018, 04:43:55 PM »
Also note that the order of the modifiers in the pipeline is important. If you first added your Selection modifier and then the Atomic strain modifier and therein activated the option Select invalid particles you might have overwritten your previous selection of atoms with a selection that contains no (invalid) atoms. This will lead to the result you got.

5
Support Forum / Re: Averaging the values of a property
« on: July 09, 2018, 04:29:44 PM »
Are you using OVITO3.0? Also, can you show me your selection modifier please.

6
Thanks for your feedback! Could you please upload a screen shot for me so I can look into that?

-Constanze

7
Support Forum / Re: Averaging the values of a property
« on: July 09, 2018, 11:59:47 AM »
Dear Sam,

in the graphical user interface of OVITO you would first add the Atomic Strain modifier to your pipeline,
then a Selection modifier of your choice and finally the Python script modifier. You don't need to implement the calculation of the von Mises shear strain in your user defined function. Similar to the selection modifier, which creates a particle property "Selection", the Atomic Strain modifier will create a particle property "Shear Strain" which is available to you as input.particles["Shear Strain"]. You already described that correctly in your previous post.
Note, however, that indentation matters in python, so you need to adapt your script accordingly (see code below).

If you also want to know the average atomic displacement of your selected atoms, simply add the Displacement vectors modifier to your pipeline (below the Python Script modifier). This modifier also calculates the length of the displacement vectors which are stored as particle property "Displacement Magnitude".

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

def modify(frame, input, output):
    my_property = input.particles["Shear Strain"]
    selection = input.particles["Selection"]
    displ = input.particles["Displacement Magnitude"]

    output.attributes["Mean Shear Strain"] = np.mean( my_property[np.nonzero(selection)] )
    print(output.attributes["Mean Shear Strain"])

    output.attributes["Mean Displacement"] = np.mean( displ[np.nonzero(selection)] )
    print(output.attributes["Mean Displacement"])


Let me know if that worked for you.

Constanze

8
Support Forum / Re: Averaging the values of a property
« on: July 04, 2018, 10:29:56 AM »
Dear Sam,

one way to do this in the graphical user interface would be to first use one of the Selection modifiers, e.g., Expression selection, Select type or Manual selection to select the atoms of interest.
Then, add the Python script modifier at the top of the modification pipeline and write your own modifier function, e.g.

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

def modify(frame, input, output):
    my_property = input.particles[“My Property”]
    selection = input.particles[“Selection”]
    output.attributes["Mean"] = np.mean( my_property[np.nonzero(selection)] )

This function outputs the result as a global attribute which will appear on the Attributes page in the Data Inspector (only available in OVITO3.0).
Data Inspector
In OVITO2.9 you could make use of the Export function instead.
File Export
Alternatively you can of course simply add a print statement to your modifier function.

Constanze

9
Hi Shuai,

the CNA will only identify those atoms as bcc which have 8 nearest neighbors and 6 second nearest neighbors and only if all these 14 neighbors are sitting on regular bcc sites. But note that these neighbor atoms themselves may not be labeled as bcc by the CNA if they do not fulfill these criteria just mentioned.

One way of selecting these atoms which are neighbors of bcc atoms but which have not been labeled as bcc themselves is to use the Expand selection modifier. First you select the bcc atoms using the Select type modifier as usual. Then, the Expand selection modifier allows you to also select atoms in the immediate neighborhood of the already selected bcc atoms. In your case you should expand the selection among the N nearest neighbors (second option) and set the value to 14.

Code: [Select]
from ovito.modifiers import CommonNeighborAnalysisModifier, SelectTypeModifier, ExpandSelectionModifier

node.modifiers.append(CommonNeighborAnalysisModifier(
    mode = CommonNeighborAnalysisModifier.Mode.AdaptiveCutoff
))
node.modifiers.append(SelectTypeModifier(
    property = "Structure Type",
    types = { CommonNeighborAnalysisModifier.Type.BCC }
))
node.modifiers.append(ExpandSelectionModifier(
    mode = ExpandSelectionModifier.ExpansionMode.Nearest,
    num_neighbors = 14
))


Constanze

10
Hi Shuai,

do you want to do that with python code? And do you want to specifically select non-fcc atoms that are neighbors to at least one fcc atom?

Constanze

11
Hi Shuai,

yes indeed. Let me bring up the example of the nanoporous particle again, which was set up as single crystalline fcc. The common neighbor analysis will not identify the surface atoms as fcc (here colored in green) since they don't have 12 nearest neighbors anymore.
The CNA actually takes into account 1) the number of common neighbors of each atom and its neighbors, 2) the number of bonds between these common neighbors and 3) the number of bonds in the longest continuous chain of bonds between the common neighbors. This triplet of values would be (4 2 1) for an fcc atom.

For more details, I would like to refer you to the references given in the manual,
 
https://ovito.org/manual/particles.modifiers.common_neighbor_analysis.html

or this book chapter:

https://link.springer.com/chapter/10.1007/978-3-319-33480-6_10

Let me know if you have further questions,
-Constanze

12
Hi Shuai,

regarding your first question, please explain what you mean by structure identification. I'm guessing you're asking about the difference between the common neighbor analysis modifier and one of the other structure identification methods implemented in OVITO (to which the common neighbor analysis also belongs). Or is your question aiming at if you can identify defects?

As for the cluster analysis, this modifier decomposes a particle system into disconnected sets of particles (clusters) based on a local neighboring criterion, i.e. the cutoff you specified. So if no neighbors are found within the cutoff of a single atom, this atom will appear as a single atom cluster with its own cluster ID. Look at the example picture I attached. Here the cluster analysis was used to find the "free floating" atoms so to say, that do not belong to the nanoporous particle.

-Constanze

13
In case this needed further clarification, please have a look at the attached examples.
-Constanze

14
Dear Bahman,

defining your own color map could help you out here. The color coding modifier allows you to import a custom color map (e.g. in png or jpeg format)  which you can just draw yourself.

-Constanze

Pages: [1]