Hello everyone! I try to get reduced values of system(a 3D block) below.
This block will move along x direction. And the block’s length in x direction(the x coordinate in left and right is 14 and 70.5, respectively) is less than simulation box’s length in x direction(the x coordinate in left and right is 0 and 84.85, respectively).
I used the python code below to get the reduced strain of the block.
from ovito.io import import_file,export_file
from ovito.modifiers import *
from ovito.data import *
pipeline = import_file("./dump.ContactLayer")
print(pipeline.source)
print(pipeline.compute().particles)
data = pipeline.compute()
pipeline.modifiers.append(AtomicStrainModifier(output_strain_tensors=True))
pipeline.modifiers.append(ComputePropertyModifier(expressions=['StrainTensor.XZ'],output_property='StrainTensor.XZ'))
pipeline.modifiers.append(SpatialBinningModifier(direction=SpatialBinningModifier.Direction.X, bin_count=10, property='StrainTensor.XZ', only_selected=True, reduction_operation=SpatialBinningModifier.Operation.Mean))
export_file(pipeline,'./property.txt','txt/table',key='binning',multiple_frames=False)
export_file(pipeline, "./dump.lateraloutput", "lammps/dump",multiple_frames=True,
columns = ["Position.X", "Position.Y", "Position.Z","StrainTensor.XZ"])
Actually this program runs well and I can get the reduced value of strain tensor in x direction. But the result can not fully meet my requirement. Since the block moves along x direction, I want to output the reduced value of specified division of atom groups. In other words, I want to divide the atoms into N parts and get every part’s reduced value. But the SpatialBinningModifier can only divide the simulation box in N parts along x direction.
I try to modify the simulation box’s length in x direction with below code (I want to make simulation box and the block have the same length in x direction):
print(data.cell[...]) # Use [...] to cast SimulationCell object to a NumPy array
data.cell_[:,0] = (14, 70.5, 0)
print(data.cell[...])
But after that all strain tensor is zero.
So is there a way to access reduced values of specified atom groups instead of fixed space grids?