code: def get_strain(cryst, refcell=None):
      '''Calculate strain tensor in the Voight notation
  
      Computes the strain tensor in the Voight notation as a conventional
      6-vector. The calculation is done with respect to the crystal
      geometry passed in refcell parameter.
  
      :param cryst: deformed structure
      :param refcell: reference, undeformed structure
  
      :returns: 6-vector of strain tensor in the Voight notation
      '''
      if refcell is None:
          refcell = cryst
      du = cryst.get_cell()-refcell.get_cell()
      m = refcell.get_cell()
      m = inv(m)
      u = dot(m, du)
      u = (u+u.T)/2
      return array([u[0, 0], u[1, 1], u[2, 2], u[2, 1], u[2, 0], u[1, 0]]f get_strain(cryst, refcell=None):
      '''Calculate strain tensor in the Voight notation
  
      Computes the strain tensor in the Voight notation as a conventional
      6-vector. The calculation is done with respect to the crystal
      geometry passed in refcell parameter.
  
      :param cryst: deformed structure
      :param refcell: reference, undeformed structure
  
      :returns: 6-vector of strain tensor in the Voight notation
      '''
      if refcell is None:
          refcell = cryst
      du = cryst.get_cell()-refcell.get_cell()
      m = refcell.get_cell()
      m = inv(m)
      u = dot(m, du)
      u = (u+u.T)/2
      return array([u[0, 0], u[1, 1], u[2, 2], u[2, 1], u[2, 0], u[1, 0]])
docs: Calculate strain tensor in the Voight notation
  
      Computes the strain tensor in the Voight notation as a conventional
      6-vector. The calculation is done with respect to the crystal
      geometry passed in refcell parameter.
  
      :param cryst: deformed structure
      :param refcell: reference, undeformed structure
  
      :returns: 6-vector of strain tensor in the Voight notation