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 ... 9
31
Support Forum / Re: Error involving particles xyz positions at 0/
« on: April 15, 2019, 04:59:12 PM »
Hello benjy,

the basic XYZ format does not contain simulation cell information. OVITO takes the axis-aligned bounding box of particles as the simulation box instead. In your case of only 3 particles that might not always work properly
and then the Affine Transformation modifier cannot be applied onto a non-exisiting cell. In order to avoid this, I would recommend to use the extended http://libatoms.github.io/QUIP/io.html#module-ase.io.extxyz xyz format instead, which includes an extra line in the header that contains information on the simulation cell.

Please also have a look at the introduction on running scripts first:
http://www.ovito.org/manual_testing/python/introduction/running.html
Running a stand alone batch script (like the one you attached) using the ovitos script interpreter and defining a custom modifier function with the Python script modifier in the GUI are two different things.

In short, in order to fix your problem you should not use the Affine Transformation modifier. Instead, please use a Python script modifier, edit the script and insert the function set_cell() from your attached batch script. However, you need to make sure that when you do that in the GUI, the function has to be named modify(), that's why OVITO is complaining.

Code: [Select]
def modify(frame, data):
    with data.cell_:
        data.cell_[:,0] = [10., 0., 0.]
        data.cell_[:,1] = [0., 10., 0.]
        data.cell_[:,2] = [0., 0., 10.]
        #cell origin
        data.cell_[:,3] = [-5.,   -5.  ,  -5.]
        #set periodic boundary conditions
        data.cell_.pbc = (True, True, True)

The second error is possibly due to the fact that you somehow ran the script from within the GUI?  Let me know if that's not the case.
That's how it's supposed to be executed from the terminal:
Code: [Select]
ovitos neutest_T001_v4.py
-Constanze

32
Support Forum / Re: About the FreezePropertyModifier
« on: April 12, 2019, 11:21:31 AM »
Hi,

that is quite possibly a bug. Could you please try this:
Code: [Select]
from ovito import dataset
[...]
dataset.anim.current_frame = 12
modifier.take_snapshot()

Alternatively, I would recommend you to upgrade to the latest developer version ovito-3.0.0-dev and use:
Code: [Select]
modifier = FreezePropertyModifier(source_property = 'Selection',
                                  destination_property = 'Selection',
                                  freeze_at = 12)
node.modifiers.append(modifier)

http://ovito.org/manual_testing/python/modules/ovito_modifiers.html#ovito.modifiers.FreezePropertyModifier

-Constanze

33
Support Forum / Re: Including axes in a video snapshot
« on: April 10, 2019, 10:37:51 AM »
Hi,
if you mean the coordinate tripod, you can go to the Viewport overlay tab
https://www.ovito.org/manual/viewport_overlays.html
and click on "Add overlay" --> Coordinate tripod.

-Constanze

34
Support Forum / Re: error in "NeighborMode.Bonded" in cluster analysis
« on: April 09, 2019, 12:26:33 PM »
Dear x.he,

thank you for letting me know, it's actually a typo in the documentation. If you have imported or generated bonds (e.g. with the CreateBondsModifier or the VoronoiAnalysisModifier)
you can set the neighbor mode of the Cluster Analysis modifier like this:

Code: [Select]
cluster.neighbor_mode = ClusterAnalysisModifier.NeighborMode.Bonding
Does that solve your problem?
-Constanze

35
Support Forum / Re: twinning
« on: April 08, 2019, 01:38:08 PM »
Hello Leo,

just to clarify, the CNA and Atomic Strain analyses are two independent analysis methods. With the help of the CNA you already revealed that there is HCP ordering in your FCC structure, which are indicators for either a stacking fault (the red double layers) or potential twinning planes. But in order to be sure that twinning occurred, you should also compare these results to the strain field you obtain from the Atomic Strain modifier. As cutoff it is recommended that you use a value between the first and second neighbor shell. To exclude the stacking faults from the strain field color coding, you can create a selection based on the structure type and then apply the Color coding modifier only on FCC like atoms.

-Constanze

36
Support Forum / Re: call modifiers before import
« on: April 08, 2019, 12:00:20 PM »
Dear Movaffaq,

I checked your script and it seems fine to me. Whenever you import a new dump file you set up a new pipeline and thus also have to append the modifiers, so everything you did is correct. One thing I noticed though, is that you calculate a histogram of the potential energy which is not used or exported in the following, so you could remove these two lines if you don't need them.

Is your goal to calculate partial RDFS? Note that the latest developer version ovito.3.0.0-dev has a built-in modifier function for that.
http://ovito.org/manual_testing/particles.modifiers.coordination_analysis.html
https://ovito.org/manual/python/modules/ovito_modifiers.html?highlight=rdf#ovito.modifiers.CoordinationNumberModifier.rdf
so you can skip all these extra steps where you first create bonds and then create a histogram etc, which will probably bring quite some speed up.

Let me know if you have questions.

-Constanze


37
Support Forum / Re: VGL Error
« on: April 04, 2019, 07:52:38 PM »
Hi Icosta,

no unfortunately that doesn't work.
Maybe you know this already, but OVITO also has the option to import remote files.
http://www.ovito.org/manual/usage.import.html
So if the issue is that you cannot copy the files, that might be a solution for you.

-Constanze

38
Support Forum / Re: about CNA
« on: April 03, 2019, 10:55:42 AM »
Dear nfer,

no you don't need to install python. As a first step open the windows command line prompt. Then go into the folder that contains your script and data using
Code: [Select]
cd "<type your path here>"
If you have installed OVITO in C:\ProgramFiles, you execute ovitos like this:
Code: [Select]
"C:\Program Files\Ovito\ovitos.exe" CNA.pyor 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.

-Constanze

39
Support Forum / Re: loading parallel output dumpfile
« on: April 01, 2019, 08:34:03 PM »
Hi Pavel,

the current issue is that OVITO can only auto-detect a file sequence if there is only one * wildcard character in the filename and you have two in your filepattern (for the timestep and processor).
But it is possible to import your dump files with a little workaround:  In the GUI you can merge the different dump-partitions belonging to the same timestep by using the CombineDataset modifier, see
https://www.ovito.org/manual_testing/particles.modifiers.combine_particle_sets.html.
If e.g. you have used 8 processors, you would have to import the first file sequence "dump.step_*.proc_0.lammpstrj" and then add 7 of those modifiers to your pipeline and make sure you correctly edit the "File sequence" for each new modifier to "dump.step_*.proc_1.lammpstrj", "dump.step_*.proc_2.lammpstrj" etc.
I just tried and it works.

Since that's not really practical, here is a small python script for you that you can save in the same folder where your dump files are. Then simply run it from the GUI (choose File --> Run python script).
Code: [Select]
from ovito.data import *
from ovito.io import import_file
from ovito.modifiers import *
import glob

filepattern = "dump.step_*.proc_"
format = ".lammpstrj"
N_proc = int(sorted(glob.glob("dump.step_*.proc_*"))[-1].split(".proc_")[1].split(".lammpstrj")[0]) + 1

pipeline = import_file(filepattern + "0" + format)
for i in range(1, N_proc):
        modifier = CombineDatasetsModifier()
        modifier.source.load(filepattern + str(i) + format)
        pipeline.modifiers.append(modifier)
pipeline.add_to_scene()

It should import and combine everything automatically into the GUI version of the latest developer version OVITO 3-dev.
Let me know if that works for you.

-Constanze



40
Support Forum / Re: Calculating overall RDF via Python Script
« on: April 01, 2019, 10:57:26 AM »
Hi benjy,

you can define a custom modifier function that takes care of that. Just make sure to add this to your code before the Coordination analysis modifier is added to the pipeline, because the order of the modifiers matters (like in the GUI).

Code: [Select]
def set_cell(frame, data):
    with data.cell_:
        data.cell_[:,0] = [10., 0., 0.]
        data.cell_[:,1] = [0., 10., 0.]
        data.cell_[:,2] = [0., 0., 10]
        #cell origin
        data.cell_[:,3] = [-5.,   -5.  ,  -5.]
        #set periodic boundary conditions
        data.cell_.pbc = (True, True, True)
node.modifiers.append(set_cell)

or in short:

Code: [Select]
def set_cell(frame, data):
    with data.cell_:
        data.cell_[...] = [[10., 0., 0., -5.], [0., 10., 0., -5.], [0., 0., 10., -5.]]
        data.cell_.pbc = (True, True, True)
node.modifiers.append(set_cell)

-Constanze

41
Support Forum / Re: Calculating overall RDF via Python Script
« on: March 29, 2019, 05:23:12 PM »
Hi benjy,

how to calculate a time-averaged RDF is explained in the scripting manual of the latest developer version:
http://www.ovito.org/manual_testing/python/modules/ovito_modifiers.html?highlight=coordination%20analysis#ovito.modifiers.CoordinationAnalysisModifier
You can simply copy the code example and adapt the cutoff and number of bins in the coordination analysis modifier to your needs.
Let me know if you have questions.

If you're not comfortable with the python scripting interface (yet) you could also achieve this with the help of the graphical user interface of OVITO as discussed here:
http://forum.ovito.org/index.php?topic=450.msg1695#msg1695

-Constanze

42
Support Forum / Re: Extracting surface atoms
« on: March 29, 2019, 11:03:39 AM »
Hello xodiyo,

it wasn't clear to me what you're trying to do.
In the reference you mentioned it seems like they also chose a criterion based on the number of neighbor atoms, i.e. they applied the Coordination analysis modifier to calculate the number of neighbors. Then they created a selection based on the number of neighbors and exported the coordinates of that selection.
In short, you can invert your selection, delete the bulk atoms and then make use of the export file-function to export the coordinates of the surface atoms.

-Constanze


43
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

44
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

45
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

46
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

47
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

48
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

49
Hello,

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

-Constanze

50
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

51
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

52
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

53
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

54
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


55
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

56
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

57
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

58
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

59
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

60
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

Pages: 1 [2] 3 4 ... 9