I’m just starting out with ASE, and wanted to write a program to calculate the Poisson’s ratio for a material, by applying strains to a unit cell. I have written the following code:
import numpy as np
import matplotlib.pyplot as plt
from ase.build import bulk
import Morse
from ase.units import GPa
# Create the copper crystal
cu = bulk("Cu", "fcc", a=2.2614, cubic=True)
calc = Morse.MorsePotential()
cu.set_calculator(calc)
# Define a range of normal strains
normal_strains = np.linspace(-0.02, 0.02, 10) # 10 normal strains from -2% to +2%
# Initialize lists to store results
axial_strains = []
transverse_strains = []
# Apply normal strain and calculate the resulting transverse strains
for normal_strain in normal_strains:
strained_cu = cu.copy()
cell = strained_cu.get_cell()
original_cell = cell.copy() # Save the original cell for reference
cell[0, 0] *= (1 + normal_strain) # Apply normal strain in the X direction
strained_cu.set_cell(cell, scale_atoms=True)
strained_cu.set_calculator(calc)
# Calculate the resulting strains in the Y and Z directions
new_cell = strained_cu.get_cell()
print(f"new cell: {new_cell}")
print(original_cell)
transverse_strain_y = (new_cell[1, 1] - original_cell[1, 1]) / original_cell[1, 1]
transverse_strain_z = (new_cell[2, 2] - original_cell[2, 2]) / original_cell[2, 2]
however, this code applies strain in the x direction, but the Y and Z directions remain unchanged. How could I apply a strain to X to get a strain in the Y and Z directions, to be able to calculate Poisson’s Ratio?
As reference, here’s a debug print of old and new unit cells:
new cell: Cell([2.2161720000000003, 2.2614, 2.2614])
original cell: Cell([2.2614, 2.2614, 2.2614])
new cell: Cell([2.2262226666666667, 2.2614, 2.2614])
original cell: Cell([2.2614, 2.2614, 2.2614])
new cell: Cell([2.2362733333333336, 2.2614, 2.2614])
original cell: Cell([2.2614, 2.2614, 2.2614])
new cell: Cell([2.246324, 2.2614, 2.2614])
original cell: Cell([2.2614, 2.2614, 2.2614])
new cell: Cell([2.256374666666667, 2.2614, 2.2614])
original cell: Cell([2.2614, 2.2614, 2.2614])
new cell: Cell([2.2664253333333333, 2.2614, 2.2614])
original cell: Cell([2.2614, 2.2614, 2.2614])
new cell: Cell([2.2764759999999997, 2.2614, 2.2614])
original cell: Cell([2.2614, 2.2614, 2.2614])
new cell: Cell([2.2865266666666666, 2.2614, 2.2614])
original cell: Cell([2.2614, 2.2614, 2.2614])
new cell: Cell([2.2965773333333335, 2.2614, 2.2614])
original cell: Cell([2.2614, 2.2614, 2.2614])
new cell: Cell([2.306628, 2.2614, 2.2614])
original cell: Cell([2.2614, 2.2614, 2.2614])
Thanks!