FixStrain

class FixStrain(x=False, y=False, z=False)

When used as input argument for a stress calculation the stress is set to zero for the indicated components of the stress tensor.

When used as input argument for an optimization the strain is kept fixed along the indicated directions.

Parameters:
  • x (bool) – Indicating constraint along the x-axis.
    Default: False
  • y (bool) – Indicating constraint along the y-ayis.
    Default: False
  • z (bool) – Indicating constraint along the z-azis.
    Default: False
frozenDegreesOfFreedom(local_atoms=None)
Parameters:local_atoms (list of int | None) – The group of atoms from which the frozen degrees of freedom should be calculated, e.g. a thermalized group of atoms.
Default: All atoms.
Returns:The number of degrees of freedom that are frozen by this constraint object.
Return type:int
toList()
Returns:The constraints as a list of Booleans
Return type:list of type bool

Usage Examples

Optimize a bulk system by constraining along the x- and z-axis:

# Set up lattice
lattice = SimpleCubic(3.731*Angstrom)

# Define elements
elements = [Silver, Cerium]

# Define coordinates
cartesian_coordinates = [[ 0.    ,  0.    ,  0.    ],
                         [ 1.8655,  1.8655,  1.8655]]*Angstrom

# Set up configuration
bulk_configuration = BulkConfiguration(
    bravais_lattice=lattice,
    elements=elements,
    cartesian_coordinates=cartesian_coordinates
    )

bulk_configuration.setCalculator(LCAOCalculator())

# Run the optimization
constraints = [FixStrain(x=True, y=False, z=True)]
bulk_configuration = OptimizeGeometry(
        bulk_configuration,
        constraints=constraints,
        )

fixstrain.py