File: elastic_strain_calculation_modifier.py

package info (click to toggle)
ovito 2.8.1%2Bdfsg2-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 79,608 kB
  • ctags: 28,850
  • sloc: cpp: 118,610; xml: 82,684; ansic: 14,436; python: 2,874; makefile: 461; perl: 232; sh: 19
file content (35 lines) | stat: -rw-r--r-- 1,407 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import sys
if "ovito.modifiers.crystalanalysis" not in sys.modules: sys.exit()

from ovito import *
from ovito.io import *
from ovito.data import *
from ovito.modifiers import *

import numpy

node = import_file("../../files/CFG/fcc_coherent_twin.0.cfg")
modifier = ElasticStrainModifier()

print("Parameter defaults:")
print("  calculate_deformation_gradients: {}".format(modifier.calculate_deformation_gradients))
print("  calculate_strain_tensors: {}".format(modifier.calculate_strain_tensors))
print("  push_strain_tensors_forward: {}".format(modifier.push_strain_tensors_forward))
print("  lattice_constant: {}".format(modifier.lattice_constant))
print("  axial_ratio: {}".format(modifier.axial_ratio))
print("  input_crystal_structure: {}".format(modifier.input_crystal_structure))
node.modifiers.append(modifier)

modifier.input_crystal_structure = ElasticStrainModifier.Lattice.FCC
modifier.lattice_constant = 0.99
modifier.calculate_deformation_gradients = True

node.compute()
print("Computed structure types:")
print(node.output.particle_properties.structure_type.array)
print("Computed strain tensors:")
print(node.output.particle_properties['Elastic Strain'].array)
print("Computed deformation gradient tensors:")
print(node.output.particle_properties['Elastic Deformation Gradient'].array)
print("Computed volumetric strain:")
print(node.output.particle_properties['Volumetric Strain'].array)