Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Alexander Stukowski

Pages: [1]
1
OVITO's Coordination Analysis modifier can calculate the radial distribution function (RDF) of a system of particles. The RDF g(r) measures the probability of finding an atom at distance r given that there is an atom at position 0; it is essentially a normalized histogram of interatomic distances -and is calculated as such.

However, the Coordination Analysis modifier only calculates the global RDF ignoring the types of particles. For systems with more than one species,  the so-called partial radial distribution functions gαβ(r) may be of interest. To obtain them, a different route is currently needed (until the Coordination Analysis modifier will be extended in a future program version):

  • Insert the Create Bonds modifier. Let it create bonds only between those types of particles for which the partial RDF should be calculated. The cutoff parameter defines the range over which the RDF will be computed.
  • Insert the Compute bond lengths modifier.
  • Insert a Python script modifier and copy/paste the following script function, which computes the RDF from the bond lengths:

Code: [Select]
import numpy as np

num_bins = 100

def modify(frame, input, output):
hist, bin_edges = np.histogram(input.bond_properties.length.array, bins=num_bins)

rho = input.number_of_particles / input.cell.volume
factor = 4./3. * np.pi * rho * input.number_of_particles

radii = bin_edges[:-1]
radii_right = bin_edges[1:]
rdf = hist / (factor * (radii_right**3 - radii**3))

print(np.column_stack((radii,rdf)))

Note that the partial RDF calculated by this script is normalized such that all partial RDFs, when computed for all possible pairs of atom types, sum up to the global RDF.

2
Let's suppose you would like to determine the global maximum of a particle property for every frame of a simulation and export this information to a text file. This can be done by inserting a Python Script modifier into the data pipeline. The following modifier script computes the maximum of the Potential Energy particle property and injects the value as a new global attribute into the data pipeline:

Code: [Select]
def modify(frame, input, output):
    max_energy = input.particle_properties['Potential Energy'].array.max()
    output.attributes['Maximum Energy'] = float(max_energy)

You can now use OVITO's standard file export function to generate a table of the Maximum Energy attribute and write it to a text file. Select Calculation Results Text File as output file format.

3
Only certain particle properties such as Force, Displacement and Dipole Orientation are rendered as arrows by OVITO. To visualize a custom vector property, map it to one of these standard properties.
  • This can either happen directly during import of the data file. Some file readers like the LAMMPS dump and XYZ reader allow you to define a custom mapping of file columns to particle properties. Use the Edit Column Mapping button to assign your vector data to the Force property, for example.
  • Alternatively, use a Compute Property modifier to set the values of the Force property to the values of your vector property.

Pages: [1]