Forum Navigation
You need to log in to create posts and topics.

Problems when using Polyhedral Template Matching (PTM) modifier

Dear Ovito developers,

I am simulating an interphase boundary between HCP (red, down) and BCC crystals (blue, upper) (Fig. 1). Two crystals are slightly strained (<1%) to ensure the periodic boundary condition. When I use CNA to identify the crystal structures, no defects identified in lammps initial file or dump file at timestep 0, as shown in Fig.2 and Fig.3. However, when I use PTM to identify the crystal structures, many defects are observed in BCC crystals and the results of lammps initial file and dump file at timestep 0 are different (Fig. 4 and Fig. 5).  I am not sure if there is some problem with PTM or I have made some mistakes.

sincerely yours,


Uploaded files:
  • Fig.1_Simulation_system.png
  • Fig.2_Initial_CNA.png
  • Fig.3_Dump_at_time_0_CNA.png
  • Fig.4_Initial_PTM.png
  • Fig.5_Dump_at_time_0_PTM.png


Would you mind sharing your simulation files with us, at least one of them? I need to take a direkt look at this structure before I can comment on the origin of the differences between CNA and PTM that you observe. Thanks.



Attached is the simulation file (lammps dump file). Because of the file size limit, I select another simulation file with fewer atoms and hcp atoms are deleted. Still, I observed many defects in the bcc crystal (attached figure).

With best regards,


Uploaded files:

Thank you. I can confirm that your structure represents a very pathological case to the PTM algorithm. We are investigating this behavior now, which I haven't seen before in this form.

One observation I've made is that the identification problem can be eliminated to a large extent by applying small random perturbations to the atomic coordinates prior to running the PTM analysis. In OVITO Pro you can do this by inserting a simple Python modifier function into your pipeline:

import numpy
def modify(frame, data):
    rnd_displacements = 0.001 * numpy.random.random(data.particles.positions.shape)
    data.particles_.positions_[...] += rnd_displacements


Thank you. That modifier works and I also found that PTM seems to work well for the system during the MD simulation.

I also tried to use PTM in Ovito 2.9.0 to identify the BCC and I'm surprised to find that the result is quite different (attached figure). There are much fewer atoms identified as "other" type. I tried different initial configurations and all results show that Ovito 2.9.0 works much better. Maybe there are some problems with PTM to identify BCC structure in Ovito 3.3.1 pro.

More info for the structure I gave to you:

A small deformation is added to BCC to ensure periodic boundary condition in x,y direction. The z direction is not deformed. In this case,  the deformation matrix is (expressed in the orthogonal coordinate system defined by the x,y,z directions of the simulation box):

[0.999939 0.003119 0.000000
-0.000798 0.999097 0.000000
-0.000568 0.003740 1.000000]

Before deformation, x direction is approximately parallel to [0.46 -0.63 0.63]BCC and z direction is approximately parallel to [0.51 -0.39 -0.76]BCC, both of which are irrational directions.

Uploaded files:
  • BCC_only_PTM_ovito_2.9.0.png

Peter Mahler Larsen has now made some adjustments to the current PTM algorithm implementation in OVITO, which solve the sporadic false-negative classification of atoms exactly positioned on BCC lattice sites. The updated algorithm is part of OVITO Basic/Pro version 3.3.3, which was released on our website today.


I have downloaded the new version of Ovito and I have used PTM for every initial configuration I have constructed. For most cases, it works well, however, there are two exceptions. I have upload the structures and here is some related info:


the deformation matrix:

[0.999967 -0.005413 0.000000
0.001064 1.000304 0.000000
-0.000691 0.002589 1.000000]

x direction parallel to [0.70 0.13 0.70] and z direction parallel to [0.64 -0.54 -0.54]

Uploaded files:


the deformation matrix is:

[0.999983 0.008009 0.000000
0.001251 0.998697 0.000000
0.000200 -0.008783 1.000000]

x direction parallel to [-0.68 -0.17 0.71]BCC and x direction parallel to [0.70 0.13 0.70]BCC

Moreover, in Ovito 2.9.0, PTM works better for my structures, although there are several atoms in BCC identified as "other" type.

Uploaded files:

Thank you for letting us know that the problem still persisted in certain cases. Peter Mahler Larsen has further tweaked the PTM algorithm to correct this issue. I've released another program update containing Peter's fix (OVITO 3.3.4). Please give it a try. Thanks.


I'm glad to say that the problem seems to be fixed in Ovito 3.3.4. Thanks for all your efforts! 🙂