# ovito.modifiers¶

This module contains all modifiers available in OVITO. See this introduction page to learn more about modifiers and the data pipeline system of OVITO.

The abstract base class of all modifier types is Modifier. Typically, you create a modifier instance, configure its parameters and insert it into a data Pipeline as follows:

mod = AssignColorModifier()
mod.color = (0.2, 1.0, 0.9)
pipeline.modifiers.append(mod)


The following modifier types are available. Please consult the OVITO user manual for a more in-depth description of what these modifiers do.

Python class name

User interface name

AcklandJonesModifier

Ackland-Jones analysis

AffineTransformationModifier

Affine transformation

AmbientOcclusionModifier

Ambient occlusion

AssignColorModifier

Assign color

AtomicStrainModifier

Atomic strain

CalculateDisplacementsModifier

Displacement vectors

CentroSymmetryModifier

Centrosymmetry parameter

ChillPlusModifier

Chill+

ClearSelectionModifier

Clear selection

ClusterAnalysisModifier

Cluster analysis

ColorCodingModifier

Color coding

CombineDatasetsModifier

Combine datasets

CommonNeighborAnalysisModifier

Common neighbor analysis

ComputePropertyModifier

Compute property

ConstructSurfaceModifier

Construct surface mesh

CoordinationAnalysisModifier

Coordination analysis

CoordinationPolyhedraModifier

Coordination polyhedra

CreateBondsModifier

Create bonds

CreateIsosurfaceModifier

Create isosurface

DeleteSelectedModifier

Delete selected

DislocationAnalysisModifier

Dislocation analysis (DXA)

ElasticStrainModifier

Elastic strain calculation

ExpandSelectionModifier

Expand selection

ExpressionSelectionModifier

Expression selection

FreezePropertyModifier

Freeze property

GenerateTrajectoryLinesModifier

Generate trajectory lines

HistogramModifier

Histogram

IdentifyDiamondModifier

Identify diamond structure

InterpolateTrajectoryModifier

Interpolate trajectory

InvertSelectionModifier

Invert selection

LoadTrajectoryModifier

ManualSelectionModifier

Manual selection

PolyhedralTemplateMatchingModifier

Polyhedral template matching

PythonScriptModifier

Python script

ReplicateModifier

Replicate

ScatterPlotModifier

Scatter plot

SelectTypeModifier

Select type

SliceModifier

Slice

SpatialBinningModifier

Spatial binning

SpatialCorrelationFunctionModifier

Spatial correlation function

VoronoiAnalysisModifier

Voronoi analysis

VoroTopModifier

VoroTop analysis

WignerSeitzAnalysisModifier

Wigner-Seitz defect analysis

WrapPeriodicImagesModifier

Wrap at periodic boundaries

Note that some analysis modifiers of the graphical version of OVITO are missing in the list above and are not accessible from Python. That is because they perform computations that can be achieved equally well using the Numpy module in a more straightforward manner.

class ovito.modifiers.PythonScriptModifier
Base class

ovito.pipeline.Modifier

A modifier that allows to plug a custom Python script function into a data pipeline.

This class makes it possible to implement new modifier types in the Python language which can participate in OVITO’s data pipeline system and which may be used like OVITO’s built-in modifiers. You can learn more about the usage of this class in the User-defined modifiers section.

Example:

from ovito.io import import_file

pipeline = import_file("input/simulation.dump")

# Define our custom modifier function, which assigns a uniform color
# to all particles, similar to the built-in AssignColorModifier.
def assign_color(frame, data):
color_property = data.particles_.create_property('Color')
color_property[:] = (0.2, 0.5, 1.0)

# Insert the user-defined modifier function into the data pipeline.
pipeline.modifiers.append(assign_color)
# Note that appending the Python function to the pipeline is equivalent to
# creating a PythonScriptModifier instance and appending it:
#
#   pipeline.modifiers.append(PythonScriptModifier(function = assign_color))

# Evaluate data pipeline. This will make the system invoke assign_color().
data = pipeline.compute()
print(data.particles.colors[...])

property function

The Python function to be called each time the data pipeline is evaluated by the system.

The function must have a signature as shown in the example above. The frame parameter specifies the current animation frame number at which the data pipeline is being evaluated. The DataCollection data initially holds the input data objects of the modifier, which were produced by the upstream part of the data pipeline. The user-defined modifier function is free modify the data collection and the data objects stored in it.

Default

None

class ovito.modifiers.SliceModifier
Base class

ovito.pipeline.Modifier

Deletes or selects data elements located within a semi-infinite region bounded by a plane or in a slab bounded by a pair of parallel planes. See also the corresponding user manual page for this modifier. The modifier can operate on several classes of data elements:

The modifier will act on all these elements types simultaneously by default. Restricting the slice operation to a particlular type of element is possible by setting the operate_on field. Furthermore, you can restrict the operation to only selected particles, by setting the only_selected option.

The select option lets the modifier selected all elements on one side of the plane instead of deleting them. Currently, this selection mode only works for particles, which are selected by setting their Selection particle property to 1.

property distance

The distance of the slicing plane from the origin (along its normal vector).

Default

0.0

property inverse

Reverses the sense of the slicing plane.

Default

False

property normal

The normal vector of the slicing plane. Does not have to be a unit vector.

Default

(1,0,0)

property only_selected

Controls whether the modifier should act only on currently selected data elements (e.g. selected particles).

Default

False

property operate_on

A set of strings specifying the kinds of data elements this modifier should operate on. By default the set contains all data element types supported by the modifier.

Default

{'particles', 'surfaces', 'dislocations'}

property plane_vis

A TriMeshVis object controlling the visual appearance of the cutting plane in rendered images. It is only used when render_plane has been set to True.

property render_plane

Controls whether the modifier should produce renderable geometry to visualize the cutting plane. The visual appearance of the plane can be adjusted through the plane_vis element.

Default

False

property select

If True, the modifier selects data elements instead of deleting them.

Default

False

property slab_width

The thicknes of the slab to cut. If zero, the modifier cuts away everything on one side of the cutting plane.

Default

0.0

class ovito.modifiers.AffineTransformationModifier
Base class

ovito.pipeline.Modifier

This modifier applies an affine transformation to data elements in order to move, rotate, shear or scale them. See also the corresponding user manual page for this modifier. The transformation modifier can operate on several types of elements:

The modifier will act on all of them simultaneously by default. Restricting the modifier to a subset is possible by setting the operate_on field. Example:

xy_shear = 0.05
mod = AffineTransformationModifier(
operate_on = {'particles'},  # Transform particles but not simulation box
transformation = [[1,xy_shear,0,0],
[0,       1,0,0],
[0,       0,1,0]])

property only_selected

Controls whether the modifier should affect only on currently selected elements (e.g. selected particles).

Default

False

property operate_on

A set of strings specifying the kinds of data elements this modifier should operate on. By default the set contains all data element types supported by the modifier.

Default

{'particles', 'vector_properties', 'cell', 'surfaces', 'dislocations'}

property relative_mode

Selects the operation mode of the modifier.

If relative_mode==True, the modifier transforms elements by applying the matrix given by the transformation parameter.

If relative_mode==False, the modifier transforms elements such that the old simulation cell will have the shape given by the the target_cell parameter after the transformation.

Default

True

property target_cell

This 3x4 matrix specifies the target cell shape. It is used when relative_mode == False.

The first three columns of the matrix specify the three edge vectors of the target cell. The fourth column defines the origin vector of the target cell.

property transformation

The 3x4 transformation matrix being applied to input elements. The first three matrix columns define the linear part of the transformation, while the fourth column specifies the translation vector.

This matrix describes a relative transformation and is used only if relative_mode == True.

Default

[[ 1.  0.  0.  0.] [ 0.  1.  0.  0.] [ 0.  0.  1.  0.]]

class ovito.modifiers.ClearSelectionModifier
Base class

ovito.pipeline.Modifier

This modifier clears the current selection. It can operate on several kinds of data elements:

The modifier will act on particles only by default. This can be changed by setting the operate_on field. See also the corresponding user manual page for this modifier.

property operate_on

Selects the kind of data elements this modifier should operate on. Supported values are: 'particles', 'bonds', 'voxels'.

Default

'particles'

class ovito.modifiers.InvertSelectionModifier
Base class

ovito.pipeline.Modifier

This modifier inverts the current selection. It can operate on several kinds of data elements:

The modifier will act on particles only by default. This can be changed by setting the operate_on field. See also the corresponding user manual page for this modifier.

property operate_on

Selects the kind of data elements this modifier should operate on. Supported values are: 'particles', 'bonds', 'voxels'.

Default

'particles'

class ovito.modifiers.ColorCodingModifier
Base class

ovito.pipeline.Modifier

Assigns colors to data elements based on one of their input properties to visualize the values. See also the corresponding user manual page for this modifier. The modifier can operate on several kinds of data elements:

• Particles (setting the 'Color' particle property)

• Particle vectors (setting the 'Vector Color' particle property)

• Bonds (setting the 'Color' bond property)

• Voxel grids (setting the 'Color' voxel property)

The modifier will act on particles by default. You can change this by setting the modifier’s operate_on field.

Usage example:

pipeline.modifiers.append(ColorCodingModifier(
property = 'Potential Energy',
))


If the start_value and end_value parameters are not explicitly specified during modifier construction, then the modifier will automatically adjust them to the minimum and maximum values of the input property at the time it is inserted into a data pipeline.

The ColorLegendOverlay may be used in conjunction with a ColorCodingModifier to insert a color legend into rendered images.

Modifier outputs:

• Color (ParticleProperty): The computed particle colors if operate_on is set to 'particles'.

• Vector Color (ParticleProperty): The computed arrow colors if operate_on is set to 'vectors'.

• Color (BondProperty): The compute bond colors if operate_on is set to 'bonds'.

property end_value

This parameter defines, together with the start_value parameter, the normalization range for mapping the input property values to colors.

property gradient

The color gradient used to map normalized property values to colors. Available gradient types are:

• ColorCodingModifier.BlueWhiteRed()

• ColorCodingModifier.Grayscale()

• ColorCodingModifier.Hot()

• ColorCodingModifier.Jet()

• ColorCodingModifier.Magma()

• ColorCodingModifier.Rainbow() [default]

• ColorCodingModifier.Viridis()

• ColorCodingModifier.Gradient(Nx3 array)

• ColorCodingModifier.Image("<image file path>")

The Gradient constructor lets you define your own coloring scheme and expects an array of dimensions N x 3 containing a table of colors (RGB values in the range [0-1]). The color coding modifier will linearly interpolate between the N colors of the table. The Image constructor expects the path to an image file on disk, which will be used to create a custom color gradient from the first row of pixels in the image.

Code example:

color_table = [
(1.0, 0.0, 0.0),  # red
(1.0, 1.0, 0.0),  # yellow
(1.0, 1.0, 1.0)   # white
]
modifier = ColorCodingModifier(
property = 'Position.X',
)

property only_selected

If True, only selected elements will be affected by the modifier and the existing colors of unselected elements will be preserved; if False, all elements will be colored.

Default

False

property operate_on

Selects the kind of data elements this modifier should operate on. Supported values are: 'particles', 'bonds', 'vectors', 'voxels'.

Default

'particles'

property property

The name of the input property that should be used to color elements.

If operate_on is set to 'particles' or 'vectors', this can be one of the standard particle properties or a name of a user-defined ParticleProperty. If operate_on is set to 'bonds', this can be one of the standard bond properties or a name of a user-defined BondProperty.

When the input property has multiple components, then a component name must be appended to the property base name, e.g. "Velocity.X".

property start_value

This parameter defines, together with the end_value parameter, the normalization range for mapping the input property values to colors.

class ovito.modifiers.AssignColorModifier
Base class

ovito.pipeline.Modifier

Assigns a uniform color to all selected elements. See also the corresponding user manual page for this modifier. The modifier can operate on several kinds of data elements:

The modifier will act on particles by default. You can change this by setting the modifier’s operate_on field.

The modifier uses the 'Selection' property as input to decide which elements are being assigned the color. If the 'Selection' property does not exist in the modifier’s input, the color will be assigned to all elements.

property color

The uniform RGB color that will be assigned to elements by the modifier.

Default

(0.3, 0.3, 1.0)

property operate_on

Selects the kind of data elements this modifier should operate on. Supported values are: 'particles', 'bonds', 'vectors'.

Default

'particles'

class ovito.modifiers.DeleteSelectedModifier
Base class

ovito.pipeline.Modifier

This modifier deletes the currently selected elements of the following kinds:

• Particles (deleting particles whose 'Selection' property is non-zero)

• Bonds (deleting bonds whose 'Selection' property is non-zero)

The modifier will act on all of them simultaneously by default. Restricting the delete operation to a subset is possible by setting the operate_on field. See also the corresponding user manual page for this modifier.

property operate_on

A set of strings specifying the kinds of data elements this modifier should operate on. By default the set contains all data element types supported by the modifier.

Default

{'particles', 'bonds'}

class ovito.modifiers.SelectTypeModifier
Base class

ovito.pipeline.Modifier

Selects all elements of a certain type (e.g. atoms of a chemical type). See also the corresponding user manual page for this modifier. The modifier can operate on different kinds of data elements:

• Particles

• Bonds

The modifier will act on particles by default. You can change this by setting the modifier’s operate_on field.

Usage example:

from ovito.io import import_file
from ovito.modifiers import SelectTypeModifier, CommonNeighborAnalysisModifier

pipeline = import_file("input/simulation.dump")

# Insert a CNA modifier to determine the structural type of each atom:
pipeline.modifiers.append(CommonNeighborAnalysisModifier())

# Apply the SelectTypeModifier to select all atoms of FCC and HCP type:
pipeline.modifiers.append(SelectTypeModifier(
operate_on = "particles",
property = "Structure Type",
types = { CommonNeighborAnalysisModifier.Type.FCC,
CommonNeighborAnalysisModifier.Type.HCP }
))

# The SelectTypeModifier reports the number of selected elements as an attribute:
data = pipeline.compute()
print("Number of FCC/HCP atoms: %i" % data.attributes['SelectType.num_selected'])


Modifier outputs:

• Selection (ParticleProperty or BondProperty): The output property will be set to 1 for particles/bonds whose type is contained in types and 0 for others.

• SelectType.num_selected (attribute): The number of elements that were selected by the modifier.

property operate_on

Selects the kind of data elements this modifier should select. Supported values are: 'particles', 'bonds'.

Default

'particles'

property property

The name of the property to use as input; must be an integer property.

For selecting particles, possible input properties are 'Particle Type' and 'Structure Type', for example. For selecting bonds, 'Bond Type' is a typical input property.

Default

'Particle Type'

property types

The set of types to select. You can add numeric type IDs or type names to this set. Type names will automatically be translated into corresponding numeric type IDs by the modifier. Thus, it is not necessary for you to look up the numeric type ID for a type name using ParticleProperty.type_by_name(). For example, to select all atoms belonging to the type named ‘Cu’:

modifier = SelectTypeModifier(property = 'Particle Type', types = {'Cu'})


When using the SelectTypeModifier to select structural types, you can directly use the predefined numeric constants for the structures, e.g.:

# Let the CNA modifier identify the structural type of each particle:
pipeline.modifiers.append(CommonNeighborAnalysisModifier())
# Select all FCC and HCP particles:
modifier = SelectTypeModifier(property = 'Structure Type')
modifier.types = { CommonNeighborAnalysisModifier.Type.FCC,
CommonNeighborAnalysisModifier.Type.HCP }
pipeline.modifiers.append(modifier)

Default

set([])

class ovito.modifiers.HistogramModifier
Base class

ovito.pipeline.Modifier

Generates a histogram from the values of a property. See also the corresponding user manual page for this modifier. The modifier can operate on properties of different kinds of elements:

The modifier will act on particles by default. You can change this by setting the modifier’s operate_on field.

The value range of the histogram is determined automatically from the minimum and maximum values of the selected property unless fix_xrange is set to True. In this case the range of the histogram is controlled by the xrange_start and xrange_end parameters.

Usage example:

from ovito.modifiers import HistogramModifier
from ovito.io import import_file, export_file

pipeline = import_file("input/simulation.dump")

modifier = HistogramModifier(bin_count=100, property='peatom')
pipeline.modifiers.append(modifier)

export_file(pipeline, "output/histogram.txt", "txt/series", key="histogram[peatom]")

property bin_count

The number of histogram bins.

Default

200

property fix_xrange

Controls how the value range of the histogram is determined. If false, the range is chosen automatically by the modifier to include all input values. If true, the range is specified manually using the xrange_start and xrange_end attributes.

Default

False

property only_selected

If True, the histogram is computed only on the basis of currently selected particles or bonds. You can use this to restrict histogram calculation to a subset of particles/bonds.

Default

False

property operate_on

Selects the kind of data elements this modifier should operate on. Supported values are: 'particles', 'bonds', 'voxels'.

Default

'particles'

property property

The name of the input property for which to compute the histogram. For vector properties a component name must be appended in the string, e.g. "Velocity.X".

Default

''

property xrange_end

If fix_xrange is true, then this specifies the upper end of the value range covered by the histogram.

Default

0.0

property xrange_start

If fix_xrange is true, then this specifies the lower end of the value range covered by the histogram.

Default

0.0

class ovito.modifiers.ReplicateModifier
Base class

ovito.pipeline.Modifier

This modifier replicates all particles and bonds to generate periodic images. See also the corresponding user manual page for this modifier. The modifier can operate on several classes of data elements:

The modifier will act on all element classes simultaneously by default. Restricting the replicate operation to a subset of classes is possible by setting the operate_on field.

property adjust_box

Controls whether the simulation cell is resized. If True, the simulation cell is accordingly extended to fit the replicated data. If False, the original simulation cell size (containing only the primary image of the system) is maintained.

Default

True

property num_x

A positive integer specifying the number of copies to generate in the x direction (including the existing primary image).

Default

1

property num_y

A positive integer specifying the number of copies to generate in the y direction (including the existing primary image).

Default

1

property num_z

A positive integer specifying the number of copies to generate in the z direction (including the existing primary image).

Default

1

property operate_on

A set of strings specifying the kinds of data elements this modifier should operate on. By default the set contains all data element types supported by the modifier.

Default

{'particles', 'voxels', 'surfaces', 'dislocations'}

property unique_ids

If True, the modifier automatically generates new unique IDs for each copy of particles. Otherwise, the replica will keep the same IDs as the original particles, which is typically not what you want.

Note: This option has no effect if the input particles do not already have numeric IDs (i.e. the 'Particle Identifier' property does not exist).

Default

True

class ovito.modifiers.ExpressionSelectionModifier
Base class

ovito.pipeline.Modifier

Selects elements based on a user-defined Boolean expression. See also the corresponding user manual page for this modifier. The modifier can operate on different classes of elements:

The modifier will act on particles by default. You can change this by setting the modifier’s operate_on field.

Modifier outputs:

• Selection (Property): This property is set to 1 for selected elements and 0 for others.

• SelectExpression.num_selected (attribute): The number of particles selected by the modifier.

Example:

# Select all atoms with potential energy above -3.6 eV:
pipeline.modifiers.append(ExpressionSelectionModifier(expression = 'PotentialEnergy > -3.6'))
data = pipeline.compute()
# Demonstrating two ways to get the number of selected atoms:
print(data.attributes['SelectExpression.num_selected'])
print(numpy.count_nonzero(data.particles.selection))

property expression

A string containing the Boolean expression to be evaluated for every element. The expression syntax is documented in OVITO’s user manual.

property operate_on

Selects the kind of data elements this modifier should operate on. Supported values are: 'particles', 'bonds'.

Default

'particles'

class ovito.modifiers.FreezePropertyModifier
Base class

ovito.pipeline.Modifier

This modifier obtains the value of a property by evaluating the data pipeline at a fixed animation time (frame 0 by default), and injects it back into the pipeline, optionally under a different name than the original property. Thus, the FreezePropertyModifier allows you to freeze a dynamically changing property and overwrite its values with those from a fixed point in time. See also the corresponding user manual page for this modifier.

The modifier can operate on properties of different kinds of elements:

• Particles (ParticleProperty)

• Bonds (BondProperty)

• Voxel grids (VoxelProperty)

The modifier will operate on particle properties by default. You can change this by setting the modifier’s operate_on field.

Example:

from ovito.io import import_file, export_file
from ovito.modifiers import (CoordinationAnalysisModifier, FreezePropertyModifier,
ExpressionSelectionModifier)

# Load a input simulation sequence.
pl = import_file("input/simulation.*.dump")

# Add modifier for computing the coordination numbers of particles.
pl.modifiers.append(CoordinationAnalysisModifier(cutoff = 2.9))

# Save the initial coordination numbers from frame 0 under a new name.
modifier = FreezePropertyModifier(source_property = 'Coordination',
destination_property = 'Coord0',
freeze_at = 0)
pl.modifiers.append(modifier)

# Select all particles whose coordination number has changed since frame 0
# by comapring the dynamically computed coordination numbers with the frozen ones.
pl.modifiers.append(ExpressionSelectionModifier(expression='Coordination != Coord0'))

# Write out number of particles exhibiting a change in coordination number.
export_file(pl, 'output/changes.txt', 'txt',
columns = ['Timestep', 'SelectExpression.num_selected'],
multiple_frames = True)

property destination_property

The name of the output property that should be created by the modifier. It may be the same as source_property. If the destination property already exists in the modifier’s input, the values are overwritten.

property freeze_at

The animation frame number at which to freeze the input property’s values.

Default

0

property operate_on

Selects the kind of properties this modifier should operate on. Supported values are: 'particles', 'bonds', 'voxels'.

Default

'particles'

property source_property

The name of the input property that should be evaluated by the modifier on the animation frame specified by freeze_at.

class ovito.modifiers.ComputePropertyModifier
Base class

ovito.pipeline.Modifier

Evaluates a user-defined math expression for every particle or bond and assigns the computed values to the selected output property. See also the corresponding user manual page for this modifier.

The modifier can compute properties of different kinds of elements:

• Particles (ParticleProperty)

• Bonds (BondProperty)

• Voxel grids (Voxelgrid)

The modifier will operate on particles by default. You can change this by setting the modifier’s operate_on field.

Usage example:

pipeline.modifiers.append(ComputePropertyModifier(
output_property = 'Color',
expressions = ['Position.X / CellSize.X', '0.0', '0.5']
))


Note that, as an alternative to this modifier, a PythonScriptModifier with a user-defined modifier function may be the better choice to set properties, in particular when it comes to problems that involve complex element indexing or conditional computations.

property cutoff_radius

The cutoff radius up to which neighboring particles are visited to compute neighbor_expressions. This parameter is only used if operate_on is set to 'particles' and the neighbor_expressions field has been set.

Default

3.0

property expressions

A list of strings containing the math expressions to compute, one for each vector component of the selected output property. If the output property is scalar, the list must comprise one expression string.

See the corresponding user manual page for a description of the expression syntax.

Default

["0"]

property neighbor_expressions

The list of strings containing the math expressions for the per-neighbor terms, one for each vector component of the output particle property. If the output property is scalar, the list must comprise one string only.

The neighbor expressions are only evaluated for each neighbor particle and the value is added to the output property of the central particle. Neighbor expressions are only evaluated if operate_on is set to 'particles'.

Default

[""]

property only_selected

If True, the property is only computed for currently selected elements. In this case, the property values of unselected elements will be preserved if the output property already exists.

Default

False

property operate_on

Selects the kind of data elements this modifier should operate on. Supported values are: 'particles', 'bonds', 'voxels'.

Default

'particles'

property output_property

The output property that will receive the computed values. This can be one of the standard property names defined by OVITO or a user-defined property name.

If operate_on is set to 'particles', this can be one of the standard particle properties or a name of a new user-defined ParticleProperty. If operate_on is set to 'bonds', this can be one of the standard bond properties or a name of a new user-defined BondProperty.

Default

"My property"

class ovito.modifiers.CombineDatasetsModifier
Base class

ovito.pipeline.Modifier

This modifier loads a set of particles from a separate simulation file and merges them into the current dataset. See also the corresponding user manual page for this modifier.

Example:

from ovito.io import import_file, export_file
from ovito.modifiers import CombineDatasetsModifier

# Load a first set of particles.
pipeline = import_file('input/first_file.dump')

# Insert the particles from a second file into the dataset.
modifier = CombineDatasetsModifier()
pipeline.modifiers.append(modifier)

# Export combined dataset to a new file.
export_file(pipeline, 'output/combined.dump', 'lammps/dump',
columns = ['Position.X', 'Position.Y', 'Position.Z'])

property source

A FileSource that provides the set of particles to be merged. You can call its load() function to load a data file as shown in the code example above.

class ovito.modifiers.CreateIsosurfaceModifier
Base class

ovito.pipeline.Modifier

Generates an isosurface from a field defined on a structured data grid (voxel data). See also the corresponding user manual page for this modifier.

Modifier outputs:

property isolevel

The value at which to create the isosurface.

Default

0.0

property operate_on

Specifies the voxel grid this modifier should operate on.

Default

'voxels:'

property property

The name of the voxel property from which the isosurface should be constructed.

property vis

The SurfaceMeshVis controlling the visual representation of the generated isosurface.

class ovito.modifiers.SpatialBinningModifier
Base class

ovito.pipeline.Modifier

This modifier applies a reduction operation to a property of all the particles located within a spatial bin. The output of the modifier is a one-, two- or three-dimensional grid of bin values. See also the corresponding user manual page for this modifier.

property bin_count_x

This attribute sets the number of bins to generate along the first binning axis.

Default

200

property bin_count_y

This attribute sets the number of bins to generate along the second binning axis (only used when generating a two- or three-dimensional grid).

Default

200

property bin_count_z

This attribute sets the number of bins to generate along the third binning axis (only used when generting a three-dimensional grid).

Default

200

property direction

Selects the alignment of the bins. Possible values:

• SpatialBinningModifier.Direction.X

• SpatialBinningModifier.Direction.Y

• SpatialBinningModifier.Direction.Z

• SpatialBinningModifier.Direction.XY

• SpatialBinningModifier.Direction.XZ

• SpatialBinningModifier.Direction.YZ

• SpatialBinningModifier.Direction.XYZ

In the first three cases the modifier generates a one-dimensional grid with bins aligned perpendicular to the selected simulation cell vector. In the last three cases the modifier generates a two-dimensional grid with bins aligned perpendicular to both selected simulation cell vectors (i.e. parallel to the third vector).

Default

SpatialBinningModifier.Direction.X

property first_derivative

If true, the modifier numerically computes the first derivative of the binned data using a finite differences approximation. This works only for one-dimensional bin grids.

Default

False

property only_selected

If True, the computation takes into account only the currently selected particles. You can use this to restrict the calculation to a subset of particles.

Default

False

property property

The name of the input particle property to which the reduction operation should be applied. This can be one of the standard particle properties or a custom particle property. For vector properties the selected component must be appended to the name, e.g. "Velocity.X".

property reduction_operation

Selects the reduction operation to be carried out. Possible values are:

• SpatialBinningModifier.Operation.Mean

• SpatialBinningModifier.Operation.Sum

• SpatialBinningModifier.Operation.SumVol

• SpatialBinningModifier.Operation.Min

• SpatialBinningModifier.Operation.Max

The operation SumVol first computes the sum and then divides the result by the volume of the respective bin. It is intended to compute pressure (or stress) within each bin from the per-atom virial.

Default

SpatialBinningModifier.Operation.Mean

class ovito.modifiers.AmbientOcclusionModifier
Base class

ovito.pipeline.Modifier

Performs a quick lighting calculation to shade particles according to the degree of occlusion by other particles. See also the corresponding user manual page for this modifier.

property buffer_resolution

A positive integer controlling the resolution of the internal render buffer, which is used to compute how much light each particle receives. For large datasets, where the size of a particle is small compared to the simulation dimensions, a highezr buffer resolution should be used.

Valid range

[1, 4]

Default

3

property intensity

Controls the strength of the shading effect.

Valid range

[0.0, 1.0]

Default

0.7

property sample_count

The number of light exposure samples to compute. More samples give a more even light distribution but take longer to compute.

Default

40

class ovito.modifiers.WrapPeriodicImagesModifier
Base class

ovito.pipeline.Modifier

This modifier maps particles located outside of the simulation cell back into the cell by “wrapping” their coordinates around at the periodic boundaries of the SimulationCell. This modifier has no parameters.

class ovito.modifiers.ExpandSelectionModifier
Base class

ovito.pipeline.Modifier

Expands the current particle selection by selecting particles that are neighbors of already selected particles. See also the corresponding user manual page for this modifier.

property cutoff

The maximum distance up to which particles are selected around already selected particles. This parameter is only used if mode is set to ExpansionMode.Cutoff.

Default

3.2

property iterations

Controls how many iterations of the modifier are executed. This can be used to select neighbors of neighbors up to a certain recursive depth.

Default

1

property mode

Selects the mode of operation, i.e., how the modifier extends the selection around already selected particles. Valid values are:

• ExpandSelectionModifier.ExpansionMode.Cutoff

• ExpandSelectionModifier.ExpansionMode.Nearest

• ExpandSelectionModifier.ExpansionMode.Bonded

Default

ExpandSelectionModifier.ExpansionMode.Cutoff

property num_neighbors

The number of nearest neighbors to select around each already selected particle. This parameter is only used if mode is set to ExpansionMode.Nearest.

Default

1

class ovito.modifiers.CommonNeighborAnalysisModifier
Base class

ovito.pipeline.Modifier

Performs the common neighbor analysis (CNA) to classify the structure of the local neighborhood of each particle. See also the corresponding user manual page for this modifier.

The modifier stores its results as integer values in the "Structure Type" particle property. The following constants are defined:

• CommonNeighborAnalysisModifier.Type.OTHER (0)

• CommonNeighborAnalysisModifier.Type.FCC (1)

• CommonNeighborAnalysisModifier.Type.HCP (2)

• CommonNeighborAnalysisModifier.Type.BCC (3)

• CommonNeighborAnalysisModifier.Type.ICO (4)

Modifier outputs:

• CommonNeighborAnalysis.counts.OTHER (attribute): The number of particles not matching any of the known structure types.

• CommonNeighborAnalysis.counts.FCC (attribute): The number of FCC particles found.

• CommonNeighborAnalysis.counts.HCP (attribute): The number of HCP particles found.

• CommonNeighborAnalysis.counts.BCC (attribute): The number of BCC particles found.

• CommonNeighborAnalysis.counts.ICO (attribute): The number of icosahedral particles found.

• Structure Type (ParticleProperty): This output particle property contains the per-particle structure types assigned by the modifier.

• Color (ParticleProperty): The modifier assigns a color to each particle according to its identified structure type.

property color_by_type

Controls whether the modifier assigns a color to each particle based on the identified structure type.

Default

True

property cutoff

The cutoff radius used for the conventional common neighbor analysis. This parameter is only used if mode == CommonNeighborAnalysisModifier.Mode.FixedCutoff.

Default

3.2

property mode

Selects the mode of operation. Valid values are:

• CommonNeighborAnalysisModifier.Mode.FixedCutoff

• CommonNeighborAnalysisModifier.Mode.AdaptiveCutoff

• CommonNeighborAnalysisModifier.Mode.BondBased

Default

CommonNeighborAnalysisModifier.Mode.AdaptiveCutoff

property only_selected

Lets the modifier perform the analysis only for selected particles. Particles that are not selected will be treated as if they did not exist.

Default

False

property structures

A list of ParticleType instances managed by this modifier, one for each supported structure type. The display color of a structure type can be changed as follows:

modifier = CommonNeighborAnalysisModifier()
# Give all FCC atoms a blue color:
modifier.structures[CommonNeighborAnalysisModifier.Type.FCC].color = (0, 0, 1)


.

class ovito.modifiers.AcklandJonesModifier
Base class

ovito.pipeline.Modifier

Performs the bond-angle analysis described by Ackland & Jones to identify the local crystal structure around each particle. See also the corresponding user manual page for this modifier.

The modifier stores the results as integer values in the "Structure Type" particle property. The following structure type constants are defined:

• AcklandJonesModifier.Type.OTHER (0)

• AcklandJonesModifier.Type.FCC (1)

• AcklandJonesModifier.Type.HCP (2)

• AcklandJonesModifier.Type.BCC (3)

• AcklandJonesModifier.Type.ICO (4)

Modifier outputs:

• AcklandJones.counts.OTHER (attribute): The number of particles not matching any of the known structure types.

• AcklandJones.counts.FCC (attribute): The number of FCC particles found.

• AcklandJones.counts.HCP (attribute): The number of HCP particles found.

• AcklandJones.counts.BCC (attribute): The number of BCC particles found.

• AcklandJones.counts.ICO (attribute): The number of icosahedral found.

• Structure Type (ParticleProperty): This particle property will contain the per-particle structure type assigned by the modifier.

• Color (ParticleProperty): The modifier assigns a color to each particle according to its identified structure type.

property color_by_type

Controls whether the modifier assigns a color to each particle based on the identified structure type.

Default

True

property structures

A list of ParticleType instances managed by this modifier, one for each supported structure type. The display color of a structure type can be changed as follows:

modifier = AcklandJonesModifier()
# Give all FCC atoms a blue color:
modifier.structures[AcklandJonesModifier.Type.FCC].color = (0, 0, 1)


.

class ovito.modifiers.CreateBondsModifier
Base class

ovito.pipeline.Modifier

Creates bonds between particles. See also the corresponding user manual page for this modifier.

Modifier outputs:

• CreateBonds.num_bonds (attribute): The number of full bonds created by the modifier.

• Topology (BondProperty): The connectivity information of each created bond.

• Periodic Image (BondProperty): The shift vector at periodic boundaries of each created bond.

property bond_type

The BondType that will be assigned to the newly created bonds. This lets you control the display color of the new bonds.

property cutoff

The upper cutoff distance for the creation of bonds between particles. This parameter is only used if mode is set to Uniform.

Default

3.2

get_pairwise_cutoff(type_a, type_b) → float

Returns the pair-wise cutoff distance that was previously set for a specific pair of particle types using the set_pairwise_cutoff() method.

Parameters
Returns

The cutoff distance set for the type pair. Returns zero if no cutoff has been set for the pair.

property intra_molecule_only

If this option is set to true, the modifier will create bonds only between atoms that belong to the same molecule (i.e. which have the same molecule ID assigned to them).

Default

False

property lower_cutoff

The minimum bond length. No bonds will be created between particles whose distance is below this threshold.

Default

0.0

property mode

Selects the mode of operation. Valid modes are:

• CreateBondsModifier.Mode.Uniform

• CreateBondsModifier.Mode.Pairwise

In Uniform mode one global cutoff is used irrespective of the particle types. In Pairwise mode a separate cutoff distance must be specified for all pairs of particle types between which bonds are to be created.

Default

CreateBondsModifier.Mode.Uniform

set_pairwise_cutoff(type_a, type_b, cutoff)

Sets the cutoff range for creating bonds between a specific pair of particle types. This information is only used if mode is set to Pairwise.

Parameters

If you want no bonds to be created between a pair of types, set the corresponding cutoff radius to zero (which is the default).

property vis

The BondsVis object controlling the visual appearance of the bonds created by this modifier.

class ovito.modifiers.CentroSymmetryModifier
Base class

ovito.pipeline.Modifier

Computes the centro-symmetry parameter (CSP) of each particle. See also the corresponding user manual page for this modifier.

The modifier outputs the computed values in the "Centrosymmetry" particle property.

property num_neighbors

The number of neighbors to take into account (12 for FCC crystals, 8 for BCC crystals).

Default

12

class ovito.modifiers.ClusterAnalysisModifier
Base class

ovito.pipeline.Modifier

This modifier groups particles into clusters on the basis of a neighboring criterion. See also the corresponding user manual page for this modifier.

Modifier outputs:

• Cluster (ParticleProperty): This output particle property stores the IDs of the clusters the particles have been assigned to.

• ClusterAnalysis.cluster_count (attribute): The total number of clusters produced by the modifier. Cluster IDs range from 1 to this number.

• ClusterAnalysis.largest_size (attribute): The number of particles belonging to the largest cluster (cluster ID 1). This attribute is only computed by the modifier when sort_by_size is set.

Example:

The following script demonstrates the usage of the numpy.bincount() function for the determining the size (=number of particles) of each cluster. This function counts how often each cluster ID occurs in the Cluster particle property generated by the ClusterAnalysisModifier.

from ovito.io import import_file
from ovito.modifiers import ClusterAnalysisModifier
import numpy

pipeline = import_file("input/simulation.dump")
pipeline.modifiers.append(ClusterAnalysisModifier(cutoff = 2.8, sort_by_size = True))
data = pipeline.compute()

cluster_sizes = numpy.bincount(data.particles['Cluster'])
numpy.savetxt("output/cluster_sizes.txt", cluster_sizes)

property cutoff

The cutoff distance used by the algorithm to form clusters of connected particles. This parameter is only used when neighbor_mode is set to CutoffRange; otherwise it is ignored.

Default

3.2

property neighbor_mode

Selects the neighboring criterion for the clustering algorithm. Valid values are:

• ClusterAnalysisModifier.NeighborMode.CutoffRange

• ClusterAnalysisModifier.NeighborMode.Bonding

In the first mode (CutoffRange), the clustering algorithm treats pairs of particles as neighbors which are within a certain range of each other given by the parameter cutoff.

In the second mode (Bonding), particles which are connected by bonds are combined into clusters. Bonds between particles can either be loaded from the input simulation file or dynamically created using for example the CreateBondsModifier or the VoronoiAnalysisModifier.

Default

ClusterAnalysisModifier.NeighborMode.CutoffRange

property only_selected

Lets the modifier perform the analysis only for selected particles. In this case, particles which are not selected are treated as if they did not exist and will be assigned cluster ID 0.

Default

False

property sort_by_size

Enables the sorting of clusters by size (in descending order). Cluster 1 will be the largest cluster, cluster 2 the second largest, and so on.

Default

False

class ovito.modifiers.CoordinationAnalysisModifier
Base class

ovito.pipeline.Modifier

Computes coordination numbers of individual particles and the radial distribution function (RDF) for the entire system. See also the corresponding user manual page for this modifier.

The modifier stores the computed per-particle coordination numbers in the "Coordination" output particle property. The data points of the radial pair distribution histogram computed by the modifier can be accessed through its rdf attribute after the pipeline evalution is complete.

Examples:

The following batch script demonstrates how to load a particle configuration, compute the RDF using the modifier and export the data to a text file:

from ovito.io import import_file
from ovito.modifiers import CoordinationAnalysisModifier
import numpy

# Load a particle dataset, apply the modifier, and evaluate pipeline.
pipeline = import_file("input/simulation.dump")
modifier = CoordinationAnalysisModifier(cutoff = 5.0, number_of_bins = 200)
pipeline.modifiers.append(modifier)
data = pipeline.compute()

# Export the computed RDF data to a text file.
numpy.savetxt("output/rdf.txt", data.series['coordination-rdf'].as_table())


The next script demonstrates how to compute the RDF for every frame of a simulation sequence and build a time-averaged RDF histogram from the data:

from ovito.io import import_file
from ovito.modifiers import CoordinationAnalysisModifier
import numpy

# Load a simulation trajectory consisting of several frames:
pipeline = import_file("input/simulation.dump")

# Insert the modifier into the pipeline:
modifier = CoordinationAnalysisModifier(cutoff = 5.0, number_of_bins = 200)
pipeline.modifiers.append(modifier)

# Initialize array for accumulated RDF histogram to zero:
total_rdf = numpy.zeros((modifier.number_of_bins, 2))

# Iterate over all frames of the sequence.
for frame in range(pipeline.source.num_frames):
# Evaluate pipeline to let the modifier compute the RDF of the current frame:
data = pipeline.compute(frame)
# Accumulate RDF histograms:
total_rdf += data.series['coordination-rdf'].as_table()

# Averaging:
total_rdf /= pipeline.source.num_frames

# Export the average RDF to a text file:
numpy.savetxt("output/rdf.txt", total_rdf)

property cutoff

Specifies the cutoff distance for the coordination number calculation and also the range up to which the modifier calculates the RDF.

Default

3.2

property number_of_bins

The number of histogram bins to use when computing the RDF.

Default

200

property partial

Setting this flag to true requests calculation of element-specific (partial) RDFs.

Default

False

class ovito.modifiers.CalculateDisplacementsModifier
Base class

ovito.pipeline.ReferenceConfigurationModifier

Computes the displacement vectors of particles with respect to a reference configuration. See also the corresponding user manual page for this modifier.

This modifier class inherits from ReferenceConfigurationModifier, which provides various properties that control how the reference configuration is specified and also how displacement vectors are calculated. By default, frame 0 of the current simulation sequence is used as reference configuration.

Modifier outputs:

• Displacement (ParticleProperty): The computed displacement vectors

• Displacement Magnitude (ParticleProperty): The length of the computed displacement vectors

property vis

A VectorVis element controlling the visual representation of the computed displacement vectors. Note that the computed displacement vectors are hidden by default. You can enable the visualization of arrows as follows:

modifier = CalculateDisplacementsModifier()
modifier.vis.enabled = True
modifier.vis.color = (0.8, 0.0, 0.5)

class ovito.modifiers.AtomicStrainModifier
Base class

ovito.pipeline.ReferenceConfigurationModifier

Computes the atomic-level deformation with respect to a reference configuration. See also the corresponding user manual page for this modifier.

This modifier class inherits from ReferenceConfigurationModifier, which provides various properties that control how the reference configuration is specified and also how particle displacements are calculated. By default, frame 0 of the current simulation sequence is used as reference configuration.

Modifier outputs:

• Shear Strain (ParticleProperty): The von Mises shear strain invariant of the atomic Green-Lagrangian strain tensor.

• Volumetric Strain (ParticleProperty): One third of the trace of the atomic Green-Lagrangian strain tensor.

• Strain Tensor (ParticleProperty): The six components of the symmetric Green-Lagrangian strain tensor. Output of this property must be explicitly enabled with the output_strain_tensors flag.

• Deformation Gradient (ParticleProperty): The nine components of the atomic deformation gradient tensor. Output of this property must be explicitly enabled with the output_deformation_gradients flag.

• Stretch Tensor (ParticleProperty): The six components of the symmetric right stretch tensor U in the polar decomposition F=RU. Output of this property must be explicitly enabled with the output_stretch_tensors flag.

• Rotation (ParticleProperty): The atomic microrotation obtained from the polar decomposition F=RU as a quaternion. Output of this property must be explicitly enabled with the output_rotations flag.

• Nonaffine Squared Displacement (ParticleProperty): The D2min measure of Falk & Langer, which describes the non-affine part of the local deformation. Output of this property must be explicitly enabled with the output_nonaffine_squared_displacements flag.

• Selection (ParticleProperty): The modifier can select those particles for which a local deformation could not be computed because there were not enough neighbors within the cutoff range. Those particles with invalid deformation values can subsequently be removed using the DeleteSelectedModifier, for example. Selection of invalid particles is controlled by the select_invalid_particles flag.

• AtomicStrain.invalid_particle_count (attribute): The number of particles for which the local strain calculation failed because they had not enough neighbors within the cutoff range.

property cutoff

Sets the distance up to which neighbor atoms are taken into account in the local strain calculation.

Default

3.0

property output_deformation_gradients

Controls the output of the per-particle deformation gradient tensors. If False, the computed tensors are not output as a particle property to save memory.

Default

False

property output_nonaffine_squared_displacements

Enables the computation of the squared magnitude of the non-affine part of the atomic displacements. The computed values are output in the "Nonaffine Squared Displacement" particle property.

Default

False

property output_rotations

Flag that controls the calculation of the per-particle rotations.

Default

False

property output_strain_tensors

Controls the output of the per-particle strain tensors. If False, the computed strain tensors are not output as a particle property to save memory.

Default

False

property output_stretch_tensors

Flag that controls the calculation of the per-particle stretch tensors.

Default

False

property select_invalid_particles

If True, the modifier selects the particle for which the local strain tensor could not be computed (because of an insufficient number of neighbors within the cutoff).

Default

True

class ovito.modifiers.WignerSeitzAnalysisModifier
Base class

ovito.pipeline.ReferenceConfigurationModifier

Performs the Wigner-Seitz cell analysis to identify point defects in crystals. See also the corresponding user manual page for this modifier.

Defects are identified with respect to a perfect reference crystal configuration. By default, frame 0 of the current simulation sequence is used as reference configuration. The modifier inherits from the ReferenceConfigurationModifier class, which provides further settings that control the definition of the reference configuration.

Modifier outputs:

• Occupancy (ParticleProperty): The computed site occupation numbers, one for each particle in the reference configuration.

• WignerSeitz.vacancy_count (attribute): The total number of vacant sites (having Occupancy == 0).

• WignerSeitz.interstitial_count (attribute): The total number of of interstitial atoms. This is equal to the sum of occupancy numbers of all non-empty sites minus the number of non-empty sites.

Usage example:

The Occupancy particle property generated by the Wigner-Seitz algorithm allows to select specific types of point defects, e.g. antisites, using OVITO’s selection tools. One option is to use the ExpressionSelectionModifier to pick sites having a certain occupancy. The following script exemplarily demonstrates the use of a custom PythonScriptModifier to select and count A-sites occupied by B-atoms in a binary system with two atom types (A=1 and B=2).

from ovito.io import *
from ovito.data import *
from ovito.modifiers import *
from ovito.pipeline import *
import numpy as np

pipeline = import_file("input/simulation.*.dump")

# Perform Wigner-Seitz analysis:
ws = WignerSeitzAnalysisModifier(
per_type_occupancies = True,
affine_mapping = ReferenceConfigurationModifier.AffineMapping.ToReference)
pipeline.modifiers.append(ws)

# Define a modifier function that selects sites of type A=1 which
# are occupied by exactly one atom of type B=2.
def modify(frame, data):

# Retrieve the two-dimensional array with the site occupancy numbers.
# Use [...] to cast it to a Numpy array.
occupancies = data.particles['Occupancy']

# Get the site types as additional input:
site_type = data.particles['Particle Type']

# Calculate total occupancy of every site:
total_occupancy = np.sum(occupancies, axis=1)

# Set up a particle selection by creating the Selection property:
selection = data.particles_.create_property('Selection')

# Select A-sites occupied by exactly one B-atom (the second entry of the Occupancy
# array must be 1, and all others 0). Note that the Occupancy array uses 0-based
# indexing, while atom type IDs are typically 1-based.
selection[...] = (site_type == 1) & (occupancies[:,1] == 1) & (total_occupancy == 1)

# Additionally output the total number of antisites as a global attribute:
data.attributes['Antisite_count'] = np.count_nonzero(selection)

# Insert Python modifier into the data pipeline.
pipeline.modifiers.append(modify)

# Let OVITO do the computation and export the number of identified
# antisites as a function of simulation time to a text file:
export_file(pipeline, "output/antisites.txt", "txt/attr",
columns = ['Timestep', 'Antisite_count'],
multiple_frames = True)

# Export the XYZ coordinates of just the antisites by removing all other atoms.
pipeline.modifiers.append(InvertSelectionModifier())
pipeline.modifiers.append(DeleteSelectedModifier())
export_file(pipeline, "output/antisites.xyz", "xyz",
columns = ['Position.X', 'Position.Y', 'Position.Z'],
multiple_frames = True)

property output_displaced

Specifies whether the modifier should output the atoms of the current configuration or replace them with the sites from the reference configuration.

By default, the modifier throws away all atoms of the current configuration and outputs the atomic sites from the reference configuration instead. Thus, in this default mode, you will obtain information about how many atoms occupy each site from the reference configuration. If, however, you are more insterested in visualizing the physical atoms that are currently occupying the sites (instead of the sites being occupied), then you should activate this modifier option. If set to true, the modifier will maintain the input atoms from the current configuration. The Occupancy property generated by the modifier will now pertain to the atoms instead of the sites, with the following new meaning: The occupancy number now counts how many atoms in total are occupying the same site as the atom the property refers to does. Furthermore, the modifier will in this mode output another property named Site Type, which reports for each atom the type of the reference site it was assigned to by the W-S algorithm.

Default

False

property per_type_occupancies

A flag controlling whether the modifier should compute occupancy numbers on a per-particle-type basis.

If false, only the total occupancy number is computed for each reference site, which counts the number of particles that occupy the site irrespective of their types. If true, then the Occupancy property computed by the modifier becomes a vector property with N components, where N is the number of particle types defined in the system. Each component of the Occupancy property counts the number of particles of the corresponding type that occupy the site. For example, the property component Occupancy.1 contains the number of particles of type 1 that occupy a site.

Default

False

class ovito.modifiers.VoronoiAnalysisModifier
Base class

ovito.pipeline.Modifier

Computes the atomic volumes and coordination numbers using a Voronoi tessellation of the particle system. See also the corresponding user manual page for this modifier.

Modifier outputs:

• Atomic Volume (ParticleProperty): Stores the computed Voronoi cell volume of each particle.

• Coordination (ParticleProperty): Stores the number of faces of each particle’s Voronoi cell.

• Voronoi Index (ParticleProperty): Stores the Voronoi indices computed from each particle’s Voronoi cell. This property is only generated when compute_indices is set.

• Max Face Order (ParticleProperty): Particle property with the maximum number of edges in any face of a particle’s Voronoi cell. Only when compute_indices is set.

• Topology (BondProperty): Contains the connectivity information of bonds. The modifier creates one bond for each Voronoi face (only if generate_bonds is set)

• Voronoi.max_face_order (attribute): This output attribute reports the maximum number of edges of any face in the computed Voronoi tessellation (ignoring edges and faces that are below the area and length thresholds).

property compute_indices

If True, the modifier calculates the Voronoi indices of particles. The modifier stores the computed indices in a vector particle property named Voronoi Index. The i-th component of this property will contain the number of faces of the Voronoi cell that have i edges. Thus, the first two components of the per-particle vector will always be zero, because the minimum number of edges a polygon can have is three.

Default

False

property edge_threshold

Specifies the minimum length an edge must have to be considered in the Voronoi index calculation. Edges that are shorter than this threshold will be ignored when counting the number of edges of a Voronoi face. The threshold parameter is an absolute value in units of length of your input data.

Default

0.0

property face_threshold

Specifies a minimum area for individual Voronoi faces in terms of an absolute area. The algorithm will ignore any face of a Voronoi polyhedron with an area smaller than this threshold when computing the coordination number and the Voronoi index of a particle. The threshold parameter is an absolute area given in units of length squared (in whatever units your input data is given).

Note that this absolute area threshold and the relative_face_threshold are applied simultaneously.

Default

0.0

property generate_bonds

Controls whether the modifier outputs the nearest neighbor bonds. The modifier will generate a bond for every pair of adjacent atoms that share a face of the Voronoi tessellation. No bond will be created if the face’s area is below the face_threshold or if the face has less than three edges that are longer than the edge_threshold.

Default

False

property only_selected

Lets the modifier perform the analysis only for selected particles. Particles that are currently not selected will be treated as if they did not exist.

Default

False

property relative_face_threshold

Specifies a minimum area for Voronoi faces in terms of a fraction of total area of the Voronoi polyhedron surface. The algorithm will ignore any face of a Voronoi polyhedron with an area smaller than this threshold when computing the coordination number and the Voronoi index of particles. The threshold parameter is specified as a fraction of the total surface area of the Voronoi polyhedron the faces belong to. For example, a threshold value of 0.01 would remove those faces from the analysis with an area less than 1% of the total area of the polyhedron surface.

Note that this relative threshold and the absolute face_threshold are applied simultaneously.

Default

0.0

property use_radii

If True, the modifier computes the poly-disperse Voronoi tessellation, which takes into account the radii of particles. Otherwise a mono-disperse Voronoi tessellation is computed, which is independent of the particle sizes.

Default

False

class ovito.modifiers.IdentifyDiamondModifier
Base class

ovito.pipeline.Modifier

This analysis modifier finds atoms that are arranged in a cubic or hexagonal diamond lattice. See also the corresponding user manual page for this modifier.

The modifier stores its results as integer values in the "Structure Type" particle property. The following structure type constants are defined:

• IdentifyDiamondModifier.Type.OTHER (0)

• IdentifyDiamondModifier.Type.CUBIC_DIAMOND (1)

• IdentifyDiamondModifier.Type.CUBIC_DIAMOND_FIRST_NEIGHBOR (2)

• IdentifyDiamondModifier.Type.CUBIC_DIAMOND_SECOND_NEIGHBOR (3)

• IdentifyDiamondModifier.Type.HEX_DIAMOND (4)

• IdentifyDiamondModifier.Type.HEX_DIAMOND_FIRST_NEIGHBOR (5)

• IdentifyDiamondModifier.Type.HEX_DIAMOND_SECOND_NEIGHBOR (6)

Modifier outputs:

• IdentifyDiamond.counts.OTHER (attribute): The number of atoms not matching any of the known structure types.

• IdentifyDiamond.counts.CUBIC_DIAMOND (attribute): The number of cubic diamond atoms found.

• IdentifyDiamond.counts.CUBIC_DIAMOND_FIRST_NEIGHBOR (attribute): The number of atoms found that are first neighbors of a cubic diamond atom.

• IdentifyDiamond.counts.CUBIC_DIAMOND_SECOND_NEIGHBOR (attribute): The number of atoms found that are second neighbors of a cubic diamond atom.

• IdentifyDiamond.counts.HEX_DIAMOND (attribute): The number of hexagonal diamond atoms found.

• IdentifyDiamond.counts.HEX_DIAMOND_FIRST_NEIGHBOR (attribute): The number of atoms found that are first neighbors of a hexagonal diamond atom.

• IdentifyDiamond.counts.HEX_DIAMOND_SECOND_NEIGHBOR (attribute): The number of atoms found that are second neighbors of a hexagonal diamond atom.

• Structure Type (ParticleProperty): This particle property will contain the per-particle structure type assigned by the modifier.

• Color (ParticleProperty): The modifier assigns a color to each atom according to its identified structure type.

property color_by_type

Controls whether the modifier assigns a color to each particle based on the identified structure type.

Default

True

property only_selected

Lets the modifier perform the analysis only for selected particles. Particles that are not selected will be treated as if they did not exist.

Default

False

property structures

A list of ParticleType instances managed by this modifier, one for each supported structure type. The display color of a structure type can be changed as follows:

modifier = AcklandJonesModifier()
# Give all hexagonal diamond atoms a blue color:
modifier.structures[IdentifyDiamondModifier.Type.HEX_DIAMOND].color = (0, 0, 1)


.

class ovito.modifiers.LoadTrajectoryModifier
Base class

ovito.pipeline.Modifier

This modifier loads trajectories of particles from a separate simulation file. See also the corresponding user manual page for this modifier.

A typical usage scenario for this modifier is when the topology of a molecular system (i.e. the definition of atom types, bonds, etc.) is stored separately from the trajectories of atoms. In this case you should load the topology file first using import_file(). Then create and apply the LoadTrajectoryModifier to the topology dataset, which loads the trajectory file. The modifier will replace the static atom positions from the topology dataset with the time-dependent positions from the trajectory file.

Example:

from ovito.io import import_file

# Load static topology data from a LAMMPS data file.
pipeline = import_file('input/input.data', atom_style='bond')

# Load atom trajectories from separate LAMMPS dump file.
print("Number of frames: ", traj_mod.source.num_frames)

# Insert modifier into data pipeline.
pipeline.modifiers.append(traj_mod)

property source

A FileSource that provides the trajectories of particles. You can call its load() function to load a simulation trajectory file as shown in the code example above.

class ovito.modifiers.PolyhedralTemplateMatchingModifier
Base class

ovito.pipeline.Modifier

Uses the Polyhedral Template Matching (PTM) method to classify the local structural neighborhood of each particle. Additionally, the modifier can compute local orientations, elastic lattice strains and identify local chemical ordering. See also the corresponding user manual page for this modifier.

The modifier stores its results as integer values in the "Structure Type" particle property. The following constants are defined:

• PolyhedralTemplateMatchingModifier.Type.OTHER (0)

• PolyhedralTemplateMatchingModifier.Type.FCC (1)

• PolyhedralTemplateMatchingModifier.Type.HCP (2)

• PolyhedralTemplateMatchingModifier.Type.BCC (3)

• PolyhedralTemplateMatchingModifier.Type.ICO (4)

• PolyhedralTemplateMatchingModifier.Type.SC (5)

• PolyhedralTemplateMatchingModifier.Type.CUBIC_DIAMOND (6)

• PolyhedralTemplateMatchingModifier.Type.HEX_DIAMOND (7)

Modifier outputs:

• PolyhedralTemplateMatching.counts.OTHER (attribute): The number of particles not matching any of the known structure types.

• PolyhedralTemplateMatching.counts.FCC (attribute): The number of FCC particles found.

• PolyhedralTemplateMatching.counts.HCP (attribute): The number of HCP particles found.

• PolyhedralTemplateMatching.counts.BCC (attribute): The number of BCC particles found.

• PolyhedralTemplateMatching.counts.ICO (attribute): The number of icosahedral particles found.

• PolyhedralTemplateMatching.counts.SC (attribute): The number of simple cubic particles found.

• PolyhedralTemplateMatching.counts.CUBIC_DIAMOND (attribute): The number of cubic diamond particles found.

• PolyhedralTemplateMatching.counts.HEX_DIAMOND (attribute): The number of hexagonal diamond particles found.

• Structure Type (ParticleProperty): This output particle property will contain the per-particle structure types assigned by the modifier.

• RMSD (ParticleProperty): This particle property will contain the per-particle RMSD values computed by the PTM method. The modifier will output this property only if the output_rmsd flag is set.

• Interatomic Distance (ParticleProperty): This particle property will contain the local interatomic distances computed by the PTM method. The modifier will output this property only if the output_interatomic_distance flag is set.

• Orientation (ParticleProperty): This particle property will contain the local lattice orientations computed by the PTM method encoded as quaternions. The modifier will generate this property only if the output_orientation flag is set.

• Elastic Deformation Gradient (ParticleProperty): This particle property will contain the local elastic deformation gradient tensors computed by the PTM method. The modifier will output this property only if the output_deformation_gradient flag is set.

• Ordering Type (ParticleProperty): This output particle property contains the compound ordering types assigned to particles by the modifier (only if the output_ordering flag is set). The ordering types are encoded as integer values in the "Ordering Type" particle property. The following type constants are defined:

• PolyhedralTemplateMatchingModifier.OrderingType.NONE (0)

• PolyhedralTemplateMatchingModifier.OrderingType.PURE (1)

• PolyhedralTemplateMatchingModifier.OrderingType.L10 (2)

• PolyhedralTemplateMatchingModifier.OrderingType.L12_A (3)

• PolyhedralTemplateMatchingModifier.OrderingType.L12_B (4)

• PolyhedralTemplateMatchingModifier.OrderingType.B2 (5)

• PolyhedralTemplateMatchingModifier.OrderingType.ZINCBLENDE_WURTZITE (6)

• PolyhedralTemplateMatchingModifier.OrderingType.BORON_NITRIDE (7)

• Color (ParticleProperty): The modifier assigns a color to each particle based on its identified structure type. See the structures list for how to change the display color of a structural type.

property color_by_type

Controls whether the modifier assigns a color to each particle based on the identified structure type.

Default

True

property only_selected

Lets the modifier perform the analysis only on the basis of currently selected particles. Unselected particles will be treated as if they did not exist and will all be assigned to the “Other” structure category.

Default

False

property output_deformation_gradient

Boolean flag that controls whether the modifier outputs the computed per-particle elastic deformation gradients as a new particle property named Elastic Deformation Gradient.The elastic deformation gradient describes the local deformation and rigid-body rotation of the crystal with repect to an ideal reference lattice configuration. See the OVITO user manual for details.

Default

False

property output_interatomic_distance

Boolean flag that controls whether the modifier outputs the computed per-particle interatomic distance as a new particle property named Interatomic Distance.

Default

False

property output_ordering

Boolean flag that controls whether the modifier should identify local ordering types and output them as a new particle property named Ordering Type.

Default

False

property output_orientation

Boolean flag that controls whether the modifier outputs the computed per-particle lattice orientations as a new particle property named Orientation. The lattice orientation is specified in terms of a quaternion that describes the rotation of the crystal with repect to a reference lattice orientation. See the OVITO user manual for details.

Default

False

property output_rmsd

Boolean flag that controls whether the modifier outputs the computed per-particle RMSD values as a new particle property named RMSD.

Default

False

property rmsd_cutoff

The maximum allowed root mean square deviation for positive structure matches. If the this threshold value is non-zero, template matches that yield a RMSD value above the cutoff are classified as “Other”. This can be used to filter out spurious template matches (false positives).

Default

0.1

property structures

This list contains one ParticleType instance each for structural type the modifier can identify. You can adjust the display color of a structural type as shown in the code example below and turn the identification of individual types on or off:

modifier = PolyhedralTemplateMatchingModifier()

# Enable the identification of cubic and hexagonal diamond structures:
modifier.structures[PolyhedralTemplateMatchingModifier.Type.CUBIC_DIAMOND].enabled = True
modifier.structures[PolyhedralTemplateMatchingModifier.Type.HEX_DIAMOND].enabled = True

# Give all cubic diamond atoms a blue color and hexagonal atoms a red color:
modifier.structures[PolyhedralTemplateMatchingModifier.Type.CUBIC_DIAMOND].color = (0.0, 0.0, 1.0)
modifier.structures[PolyhedralTemplateMatchingModifier.Type.HEX_DIAMOND].color = (1.0, 0.0, 0.0)

class ovito.modifiers.CoordinationPolyhedraModifier
Base class

ovito.pipeline.Modifier

Constructs coordination polyhedra around currently selected particles. A coordination polyhedron is the convex hull spanned by the bonded neighbors of a particle. See also the corresponding user manual page for this modifier.

property vis

A SurfaceMeshVis element controlling the visual representation of the generated polyhedra.

class ovito.modifiers.InterpolateTrajectoryModifier
Base class

ovito.pipeline.Modifier

This modifier interpolates the particle positions in between successive snapshots of a simulation trajectory. It can be used to create smoothly looking animations from relatively coarse sequences of simulation snapshots. See also the corresponding user manual page for this modifier.

property minimum_image_convention

If this option is activated, the modifier will automatically detect if a particle has crossed a simulation box boundary between two successive simulation frames and compute the unwrapped displacement vector correctly. You should leave this option activated unless the particle positions loaded from the input data file(s) were stored in unwrapped form by the molecular dynamics code.

Default

True

class ovito.modifiers.GenerateTrajectoryLinesModifier
Base class

ovito.pipeline.Modifier

This modifier periodically samples the time-dependent positions of particles to produce a TrajectoryLines object. The modifier is typically used to visualize the trajectories of particles as static lines. See also the corresponding user manual page for this modifier.

The trajectory line generation must be explicitly triggered by a call to generate() as shown in the following example.

from ovito.io import import_file
from ovito.modifiers import GenerateTrajectoryLinesModifier
from ovito.vis import TrajectoryVis

# Load a particle simulation sequence:
pipeline = import_file('input/simulation.*.dump')

# Insert the modifier into the pipeline for creating the trajectory lines.
modifier = GenerateTrajectoryLinesModifier(only_selected = False)
pipeline.modifiers.append(modifier)

# Now let the modifier generate the trajectory lines by sampling the
# particle positions over the entire animation interval.
modifier.generate()

# Configure trajectory line visualization:
modifier.vis.width = 0.4
modifier.vis.color = (1,0,0)

# Insert pipeline into the scene to make the particles and
# the trajectory lines visible in rendered images.

property frame_interval

The animation frame interval over which the particle positions are sampled to generate the trajectory lines. Set this to a tuple of two integers to specify the first and the last animation frame; or use None to generate trajectory lines over the entire animation sequence.

Default

None

generate()

Generates the trajectory lines by sampling the positions of the particles from the upstream pipeline in regular animation time intervals. Make sure you call this method after the modifier has been inserted into the pipeline.

property only_selected

Controls whether trajectory lines should only by generated for currently selected particles.

Default

True

property sampling_frequency

Length of the animation frame intervals at which the particle positions should be sampled.

Default

1

property unwrap_trajectories

Controls whether trajectory lines should be automatically unwrapped at the box boundaries when the particles cross a periodic boundary.

Default

True

property vis

The TrajectoryVis element controlling the visual appearance of the trajectory lines created by this modifier.

class ovito.modifiers.UnwrapTrajectoriesModifier
Base class

ovito.pipeline.Modifier

This modifier determines when particles cross through the periodic boundaries of the simulation cell and unwraps the particle coordinates in order to make the trajectories continuous. As a result of this operation, particle trajectories will no longer fold back into the simulation cell and instead lead outside the cell.

For unwrapping the particle coordinates, the modifier must load all frames of the input simulation trajectory to detect crossings of the periodic cell boundaries. In the current version of OVITO, this initialization step must be explicitly triggered by calling the update() method as shown in the following example.

from ovito.io import import_file
from ovito.modifiers import UnwrapTrajectoriesModifier

pipeline = import_file('input/simulation.*.dump')

# Insert the unwrap modifier into the pipeline.
modifier = UnwrapTrajectoriesModifier()
pipeline.modifiers.append(modifier)
# Let the modifier determine crossings of the periodic cell boundaries.
modifier.update()

# Request last frame of the trajectory with unwrapped particle positions:
data = pipeline.compute(pipeline.source.num_frames - 1)

update()

This method detects crossings of the particles through of the periodic cell boundaries. The list of crossing events will subsequently be used by the modifier to unwrap the particle coordinates and produce continuous particle trajectories. The method loads and steps through all animation frames of the input trajectory, which can take some time. Make sure you call this method right after the modifier has been inserted into the pipeline and before the pipeline is evaluated for the first time.

class ovito.modifiers.ChillPlusModifier
Base class

ovito.pipeline.Modifier

Runs the CHILL+ algorithm to identify various structural arrangements of water molecules. See also the corresponding user manual page for this modifier.

The modifier stores its results as integer values in the "Structure Type" particle property. The following constants are defined:

• ChillPlusModifier.Type.OTHER (0)

• ChillPlusModifier.Type.HEXAGONAL_ICE (1)

• ChillPlusModifier.Type.CUBIC_ICE (2)

• ChillPlusModifier.Type.INTERFACIAL_ICE (3)

• ChillPlusModifier.Type.HYDRATE (4)

• ChillPlusModifier.Type.INTERFACIAL_HYDRATE (5)

property color_by_type

Controls whether the modifier assigns a color to each particle based on the identified structure type.

Default

True

property cutoff

The cutoff range for bonds between water molecules.

Default

3.5

property only_selected

Lets the modifier perform the analysis only on currently selected particles. Particles that are not selected will be treated as if they did not exist.

Default

False

property structures

A list of ParticleType instances managed by this modifier, one for each supported structure type. The display color of a structure type can be changed as follows:

modifier = ChillPlusModifier()
# Give all hexagonal ice particles a blue color:
modifier.structures[ChillPlusModifier.Type.HEXAGONAL_ICE].color = (0.0, 0.0, 1.0)


.

class ovito.modifiers.ConstructSurfaceModifier
Base class

ovito.pipeline.Modifier

Constructs the geometric surface of a solid made of point-like particles. The modifier generates a SurfaceMesh, which is a closed manifold consisting of triangles. It also computes the total surface area and the volume of the region enclosed by the surface mesh. See also the corresponding user manual page for this modifier.

The radius parameter controls how many details of the solid shape are resolved during surface construction. A larger radius leads to a surface with fewer details, reflecting only coarse features of the surface topology. A small radius, on the other hand, will resolve finer surface features and small pores in the interior of a solid, for example.

See [A. Stukowski, JOM 66 (2014), 399-407] for a description of the surface construction algorithm.

Modifier outputs:

Example:

from ovito.io import import_file, export_file
from ovito.data import SurfaceMesh, SimulationCell
from ovito.modifiers import ConstructSurfaceModifier

# Load a particle structure and reconstruct its geometric surface:
pipeline = import_file("input/simulation.dump")
data = pipeline.compute()
mesh = data.surfaces['surface']

# Query computed surface properties:
print("Surface area: %f" % data.attributes['ConstructSurfaceMesh.surface_area'])
print("Solid volume: %f" % data.attributes['ConstructSurfaceMesh.solid_volume'])
fraction = data.attributes['ConstructSurfaceMesh.solid_volume'] / data.cell.volume
print("Solid volume fraction: %f" % fraction)

# Export the surface triangle mesh to a VTK file.
export_file(mesh, "output/surface.vtk", "vtk/trimesh")

property only_selected

If True, the modifier acts only on selected particles and ignores other particles; if False, the modifier constructs the surface around all particles.

Default

False

property radius

The radius of the probe sphere used in the surface construction algorithm.

A rule of thumb is that the radius parameter should be slightly larger than the typical distance between nearest neighbor particles.

Default

4.0

property select_surface_particles

This option activates the selection of particles that form the constructed surface. When set to True, the modifier will generate the Selection output particle property.

Default

False

property smoothing_level

The number of iterations of the smoothing algorithm applied to the computed surface mesh.

Note that the smoothing level does only affect the computed surface area but not the solid volume. That is because the solid volume is computed before smoothing the mesh. (Smoothing is supposed to be volume preserving.)

Default

8

property vis

The SurfaceMeshVis element controlling the visual representation of the computed surface.

class ovito.modifiers.SpatialCorrelationFunctionModifier
Base class

ovito.pipeline.Modifier

This modifier calculates the spatial correlation function between two particle properties. See also the corresponding user manual page for this modifier.

The algorithm uses the FFT to compute the convolution. It then computes a radial average in reciprocal and real space. This gives the correlation function up to half of the cell size. The modifier can additionally compute the short-ranged part of the correlation function from a direct summation over neighbors.

Usage example:

from ovito.modifiers import SpatialCorrelationFunctionModifier
from ovito.io import import_file, export_file

pipeline = import_file("input/simulation.dump")

mod = SpatialCorrelationFunctionModifier(property1='Position.X', property2='peatom')
pipeline.modifiers.append(mod)
data = pipeline.compute()

# Export RDF and correlation functions to text files:
C = data.series['correlation-real-space']
rdf = data.series['correlation-real-space-rdf']
export_file(C, 'output/real_correlation_function.txt', 'txt/series')
export_file(rdf, 'output/rdf.txt', 'txt/series')

# Compute normalized correlation function (by co-variance):
C_norm = C.as_table()
mean1 = data.attributes['CorrelationFunction.mean1']
mean2 = data.attributes['CorrelationFunction.mean2']
covariance = data.attributes['CorrelationFunction.covariance']
C_norm[:,1] = (C_norm[:,1] - mean1*mean2) / (covariance - mean1*mean2)
import numpy
numpy.savetxt('output/normalized_real_correlation_function.txt', C_norm)

property apply_window

This flag controls whether nonperiodic directions have a Hann window applied to them. Applying a window function is necessary to remove spurios oscillations and power-law scaling of the (implicit) rectangular window of the nonperiodic domain.

Default

True

property direct_summation

Flag controlling whether the real-space correlation plot will show the result of a direct calculation of the correlation function, obtained by summing over neighbors.

Default

False

property grid_spacing

Controls the approximate size of the FFT grid cell. The actual size is determined by the distance of the simulation cell faces which must contain an integer number of grid cells.

Default

3.0

property neighbor_bins

This integer value controls the number of bins for the direct calculation of the real-space correlation function.

Default

50

property neighbor_cutoff

This parameter determines the cutoff of the direct calculation of the real-space correlation function.

Default

5.0

property property1

The name of the first input particle property for which to compute the correlation, P1. For vector properties a component name must be appended in the string, e.g. "Velocity.X".

Default

''

property property2

The name of the second particle property for which to compute the correlation, P2. If this is the same as property1, then the modifier will compute the autocorrelation.

Default

''

class ovito.modifiers.DislocationAnalysisModifier
Base class

ovito.pipeline.Modifier

This analysis modifier extracts all dislocations in a crystal and converts them to continuous line segments. The computational method behind this is called Dislocation Extraction Algorithm (DXA) and is described in the paper [MSMSE 20 (2012), 085007]. See also the corresponding user manual page for this modifier.

The extracted dislocation lines are output as a DislocationNetwork object by the modifier and can be accessed through the DataCollection.dislocations field after the modification pipeline has been evaluated. This is demonstrated in the example script below.

Furthermore, you can use the export_file() function to write the dislocation lines to a so-called CA file. The CA file format is described in the documentation section of the OVITO user manual for the Dislocation Analysis modifier.

Modifier outputs:

• DataCollection.dislocations (DislocationNetwork): This property of the output data collection provides access to the dislocation lines found by the modifier. See the example script below.

• DislocationAnalysis.total_line_length (attribute): The total length of all dislocation lines found by the DXA.

• DislocationAnalysis.length.1/n<ijk> (attribute): The modifier outputs a set of attributes that indicate the length of dislocations broken down by Burgers vector type. For example, the attribute DislocationAnalysis.length.1/6<112> specifies the total amount of Shockley partials found by the DXA.

• DislocationAnalysis.length.other (attribute): The length of dislocation lines with an unusual Burgers vector that do not belong to any of the predefined standard dislocation types.

• DislocationAnalysis.cell_volume (attribute): The volume of the simulation cell. This is output for convenience to enable the calculation of dislocation densities from the line length.

• DislocationAnalysis.counts.OTHER (attribute): The number of particles not matching any of the known structure types.

• DislocationAnalysis.counts.FCC (attribute): The number of particles with local FCC structure.

• DislocationAnalysis.counts.HCP (attribute): The number of particles with local HCP structure.

• DislocationAnalysis.counts.BCC (attribute): The number of particles with local BCC structure.

• DislocationAnalysis.counts.CubicDiamond (attribute): The number of particles with local cubic diamond structure.

• DislocationAnalysis.counts.HexagonalDiamond (attribute): The number of particles with local hexagonal diamond structure.

Example:

from ovito.io import import_file, export_file
from ovito.modifiers import DislocationAnalysisModifier
from ovito.data import DislocationNetwork

pipeline = import_file("input/simulation.dump")

# Extract dislocation lines from a crystal with diamond structure:
modifier = DislocationAnalysisModifier()
modifier.input_crystal_structure = DislocationAnalysisModifier.Lattice.CubicDiamond
pipeline.modifiers.append(modifier)
data = pipeline.compute()

total_line_length = data.attributes['DislocationAnalysis.total_line_length']
cell_volume = data.attributes['DislocationAnalysis.cell_volume']
print("Dislocation density: %f" % (total_line_length / cell_volume))

# Print list of dislocation lines:
print("Found %i dislocation segments" % len(data.dislocations.segments))
for segment in data.dislocations.segments:
print("Segment %i: length=%f, Burgers vector=%s" % (segment.id, segment.length, segment.true_burgers_vector))
print(segment.points)

# Export dislocation lines to a CA file:
export_file(pipeline, "output/dislocations.ca", "ca")

# Or export dislocations to a ParaView VTK file:
export_file(pipeline, "output/dislocations.vtk", "vtk/disloc")

property circuit_stretchability

The number of steps by which a Burgers circuit can stretch while it is being advanced along a dislocation line.

Default

9

property color_by_type

Controls whether the modifier assigns a color to each particle based on the identified structure type.

Default

True

property defect_mesh_smoothing_level

Specifies the number of iterations of the surface smoothing algorithm to perform when post-processing the extracted defect mesh.

Default

8

property defect_vis

The SurfaceMeshVis element controlling the visual representation of the generated defect mesh.

property disloc_vis

The DislocationVis element controlling the visual representation of the generated dislocation lines.

property input_crystal_structure

The type of crystal to analyze. Must be one of:

• DislocationAnalysisModifier.Lattice.FCC

• DislocationAnalysisModifier.Lattice.HCP

• DislocationAnalysisModifier.Lattice.BCC

• DislocationAnalysisModifier.Lattice.CubicDiamond

• DislocationAnalysisModifier.Lattice.HexagonalDiamond

Default

DislocationAnalysisModifier.Lattice.FCC

property line_coarsening_enabled

Flag that enables the coarsening of extracted dislocation lines, which reduces the number of sample points along the lines.

Default

True

property line_point_separation

Sets the desired distance between successive sample points along the dislocation lines, measured in multiples of the interatomic spacing. This parameter controls the amount of coarsening performed during post-processing of dislocation lines.

Default

2.5

property line_smoothing_enabled

Flag that enables the smoothing of extracted dislocation lines after they have been coarsened.

Default

True

property line_smoothing_level

The number of iterations of the line smoothing algorithm to perform.

Default

1

property only_perfect_dislocations

This flag controls whether the algorithm should extract only perfect dislocations (and no partial dislocations, which is normally done for FCC/HCP and diamond lattices). Make sure you set the circuit_stretchability parameter to a high value when activating this option, because large Burgers circuits are needed to identify dissociated dislocations with a wide core.

Default

False

property only_selected

Lets the modifier perform the analysis only for selected particles. Particles that are not selected will be treated as if they did not exist.

Default

False

property trial_circuit_length

The maximum length of trial Burgers circuits constructed by the DXA to discover dislocations. The length is specified in terms of the number of atom-to-atom steps.

Default

14

class ovito.modifiers.ElasticStrainModifier
Base class

ovito.pipeline.Modifier

This modifier computes the atomic-level elastic strain and deformation gradient tensors in crystalline systems. See also the corresponding user manual page for this modifier.

The modifier first performs an identification of the local crystal structure and stores the results in the Structure Type particle property. Possible structure type values are listed under the input_crystal_structure property. Atoms that do not form a crystalline structure or which are part of defects are assigned the special type OTHER (=0). For these atoms the local elastic deformation cannot be computed.

If calculate_deformation_gradients is set to true, the modifier outputs a new particle property named Elastic Deformation Gradient, which contains the per-atom elastic deformation gradient tensors. Each tensor has nine components stored in column-major order. Atoms for which the elastic deformation gradient could not be determined (i.e. which are classified as OTHER) will be assigned the null tensor.

If calculate_strain_tensors is set to true, the modifier outputs a new particle property named Elastic Strain, which contains the per-atom elastic strain tensors. Each symmetric strain tensor has six components stored in the order XX, YY, ZZ, XY, XZ, YZ. Atoms for which the elastic strain tensor could not be determined (i.e. which are classified as OTHER) will be assigned the null tensor.

Furthermore, the modifier generates a particle property Volumetric Strain, which stores the trace divided by three of the local elastic strain tensor. Atoms for which the elastic strain tensor could not be determined (i.e. which are classified as OTHER) will be assigned a value of zero.

property axial_ratio

The c/a ratio of the ideal unit cell for crystals with hexagonal symmetry.

Default

sqrt(8/3)

property calculate_deformation_gradients

Flag that enables the output of the calculated elastic deformation gradient tensors. The per-particle tensors will be stored in a new particle property named Elastic Deformation Gradient with nine components (stored in column-major order). Particles for which the local elastic deformation cannot be calculated, are assigned the null tensor.

Default

False

property calculate_strain_tensors

Flag that enables the calculation and out of the elastic strain tensors. The symmetric strain tensors will be stored in a new particle property named Elastic Strain with six components (XX, YY, ZZ, XY, XZ, YZ).

Default

True

property input_crystal_structure

The type of crystal to analyze. Must be one of:

• ElasticStrainModifier.Lattice.FCC

• ElasticStrainModifier.Lattice.HCP

• ElasticStrainModifier.Lattice.BCC

• ElasticStrainModifier.Lattice.CubicDiamond

• ElasticStrainModifier.Lattice.HexagonalDiamond

Default

ElasticStrainModifier.Lattice.FCC

property lattice_constant

Lattice constant (a0) of the ideal unit cell.

Default

1.0

property push_strain_tensors_forward

Selects the frame in which the elastic strain tensors are calculated.

If true, the Eulerian-Almansi finite strain tensor is computed, which measures the elastic strain in the global coordinate system (spatial frame).

If false, the Green-Lagrangian strain tensor is computed, which measures the elastic strain in the local lattice coordinate system (material frame).

Default

True

class ovito.modifiers.VoroTopModifier
Base class

ovito.pipeline.Modifier

This modifier uses the Voronoi cell topology of particles to characterize their local environments [Lazar, Han, Srolovitz, PNAS 112:43 (2015)].

The Voronoi cell of a particle is the region of space closer to it than to any other particle. The topology of the Voronoi cell is the manner in which its faces are connected, and describes the manner in which a particle’s neighbors are arranged. The topology of a Voronoi cell can be completely described in a vector of integers called a Weinberg vector [Weinberg, IEEE Trans. Circuit Theory 13:2 (1966)].

This modifier requires loading a filter, which specifies structure types and associated Weinberg vectors. Filters for several common structures can be obtained from the VoroTop website. The modifier calculates the Voronoi cell topology of each particle, uses the provided filter to determine the structure type, and stores the results in the Structure Type particle property. This allows the user to subsequently select particles of a certain structural type, e.g. by using the SelectTypeModifier.

This method is well-suited for analyzing finite-temperature systems, including those heated to their bulk melting temperatures. This robust behavior relieves the need to quench a sample (such as by energy minimization) prior to analysis. Further information about the Voronoi topology approach for local structure analysis, as well as additional filters, can be found on the VoroTop webpage.

Modifier outputs:

• Structure Type (ParticleProperty): This output particle property contains the integer structure type computed by the modifier for each particle.

• Color (ParticleProperty): The modifier assigns a color to each particle to indicate its identified structure type.

property filter_file

Path to the filter definition file used by the modifier. Filters files are available from the VoroTop website.

Default

''

property only_selected

Lets the modifier take into account only selected particles. Particles that are currently not selected will be treated as if they did not exist.

Default

False

property structures

A list of ParticleType instances managed by this modifier, one for each structural type loaded from the filter_file.

property use_radii

If True, the modifier computes the poly-disperse Voronoi tessellation, which takes into account the radii of particles. Otherwise a mono-disperse Voronoi tessellation is computed, which is independent of the particle sizes.

Default

False