Author Topic: Wigner seitz analysis in ovito python script  (Read 134 times)

ludo

  • Newbie
  • *
  • Posts: 2
Wigner seitz analysis in ovito python script
« on: February 26, 2019, 02:51:15 PM »
Dear all, I am new on this forum, so I hope that my question has not been requested too many time.
 I am a new user of OVITO and I was trying to perform a W.Seitz analysis using Python code.

This is my code

Code: [Select]
import ovito
from ovito.io import *
from ovito.data import *
from ovito.modifiers import *
import numpy

node = import_file(r"C:\Users\lbuongio\Desktop\LAMMPS\Work\Test_Dynamic\first_cascade\test_init_col.dump",multiple_frames = True)
mod = WignerSeitzAnalysisModifier(per_type_occupancies = True,eliminate_cell_deformation = True)
mod.reference.load(r"C:\Users\lbuongio\Desktop\LAMMPS\Work\Configs\SiC10x10.dump")
#select_vacancies_mod = SelectExpressionModifier(expression = 'Occupancy.1==0 && Occupancy.2==0')
select_vacancies_mod = SelectExpressionModifier(expression = 'Occupancy.1 == 0 && Occupancy.2 == 0 && ParticleType == 1')
select_vacancies_mod_2 = SelectExpressionModifier(expression = 'Occupancy.1 == 0 && Occupancy.2 == 0 && ParticleType == 2')
node.modifiers.append(mod)
node.modifiers.append(select_vacancies_mod)


for frame in range(ovito.dataset.anim.last_frame + 1):
output = node.compute(frame)

print("Number of vacant sites: %i" % node.output.attributes['SelectExpression.num_selected'])

node.modifiers.append(select_vacancies_mod_2)

print('Second type')

for frame in range(ovito.dataset.anim.last_frame + 1):
output = node.compute(frame)

print("Number of vacant sites: %i" % node.output.attributes['SelectExpression.num_selected'])

As you can see I was trying to output both of the defects (type 1 and 2 of vacancies), but when I try to export my data on a txt file ovito crashes or python gives me error.
Can I please ask if someone can explain me where the error that I am doing is? PS: my cascade file has timesteps, atom positions in frame
thank you
« Last Edit: February 26, 2019, 03:10:29 PM by Alexander Stukowski »

Constanze Kalcher

  • Administrator
  • Sr. Member
  • *****
  • Posts: 265
Re: Wigner seitz analysis in ovito python script
« Reply #1 on: March 11, 2019, 05:22:25 PM »
Dear ludo,

could you please post the error message you're receiving.

-Constanze