matscipy.fracture_mechanics.idealbrittlesolid

Functions

extend_strip(atoms, a, N, M, vacuum)

find_crack_tip(atoms[, dt, store, results])

Return atom at the crack tip and its x-coordinate

find_triangles_2d(atoms, cutoff[, minangle, ...])

Return a list of all triangles of a triangular lattice sitting in the x-y plane.

set_constraints(c, a)

set_initial_velocities(c)

Initialise a dynamical state by kicking some atoms behind tip

triangular_lattice_slab(a, n, m)

Classes

IdealBrittleSolid(*args, **kwargs)

Implementation of force field for an ideal brittle solid

matscipy.fracture_mechanics.idealbrittlesolid.triangular_lattice_slab(a, n, m)
matscipy.fracture_mechanics.idealbrittlesolid.find_triangles_2d(atoms, cutoff, minangle=0.5235987755982988, maxangle=2.0943951023931953, xdim=0, ydim=1)

Return a list of all triangles of a triangular lattice sitting in the x-y plane.

class matscipy.fracture_mechanics.idealbrittlesolid.IdealBrittleSolid(*args, **kwargs)

Bases: Calculator

Implementation of force field for an ideal brittle solid

Described in Marder, Int. J. Fract. 130, 517-555 (2004)

Attributes:
directory
label
name

Methods

band_structure()

Create band-structure object for plotting.

calculate(atoms, properties, system_changes)

Do the calculation.

calculate_numerical_forces(atoms[, d])

Calculate numerical forces using finite difference.

calculate_numerical_stress(atoms[, d, voigt])

Calculate numerical stress using finite difference.

calculate_properties(atoms, properties)

This method is experimental; currently for internal use.

check_state(atoms[, tol])

Check for any system changes since last calculation.

get_elastic_moduli()

Return Lam'e constants lambda and mu

get_magnetic_moments([atoms])

Calculate magnetic moments projected onto atoms.

get_property(name[, atoms, allow_calculation])

Get the named property.

get_stresses([atoms])

the calculator should return intensive stresses, i.e., such that stresses.sum(axis=0) == stress

get_wave_speeds(atoms)

Return longitudinal, shear and Rayleigh wave speeds

read(label)

Read atoms, parameters and calculated properties from output file.

reset()

Clear all information from old calculation.

set(**kwargs)

Set parameters like set(key1=value1, key2=value2, ...).

set_label(label)

Set label and convert label to directory and prefix.

calculation_required

export_properties

get_atoms

get_charges

get_default_parameters

get_dipole_moment

get_forces

get_magnetic_moment

get_poisson_ratio

get_potential_energies

get_potential_energy

get_stress

get_youngs_modulus

read_atoms

set_reference_crystal

todict

implemented_properties: List[str] = ['energy', 'free_energy', 'energies', 'stress', 'forces']

Properties calculator can handle (energy, forces, …)

default_parameters: Dict[str, Any] = {'a': 1.0, 'b': 0.01, 'beta': 0.01, 'k': 1.0, 'linear': False, 'rc': 1.01}

Default parameters

__init__(*args, **kwargs)

Basic calculator implementation.

restart: str

Prefix for restart file. May contain a directory. Default is None: don’t restart.

ignore_bad_restart_file: bool

Deprecated, please do not use. Passing more than one positional argument to Calculator() is deprecated and will stop working in the future. Ignore broken or missing restart file. By default, it is an error if the restart file is missing or broken.

directory: str or PurePath

Working directory in which to read and write files and perform calculations.

label: str

Name used for all files. Not supported by all calculators. May contain a directory, but please use the directory parameter for that instead.

atoms: Atoms object

Optional Atoms object to which the calculator will be attached. When restarting, atoms will get its positions and unit-cell updated from file.

set_reference_crystal(crystal)
calculate(atoms, properties, system_changes)

Do the calculation.

properties: list of str

List of what needs to be calculated. Can be any combination of ‘energy’, ‘forces’, ‘stress’, ‘dipole’, ‘charges’, ‘magmom’ and ‘magmoms’.

system_changes: list of str

List of what has changed since last calculation. Can be any combination of these six: ‘positions’, ‘numbers’, ‘cell’, ‘pbc’, ‘initial_charges’ and ‘initial_magmoms’.

Subclasses need to implement this, but can ignore properties and system_changes if they want. Calculated properties should be inserted into results dictionary like shown in this dummy example:

self.results = {'energy': 0.0,
                'forces': np.zeros((len(atoms), 3)),
                'stress': np.zeros(6),
                'dipole': np.zeros(3),
                'charges': np.zeros(len(atoms)),
                'magmom': 0.0,
                'magmoms': np.zeros(len(atoms))}

The subclass implementation should first call this implementation to set the atoms attribute and create any missing directories.

get_wave_speeds(atoms)

Return longitudinal, shear and Rayleigh wave speeds

get_elastic_moduli()

Return Lam’e constants lambda and mu

get_youngs_modulus()
get_poisson_ratio()
band_structure()

Create band-structure object for plotting.

calculate_numerical_forces(atoms, d=0.001)

Calculate numerical forces using finite difference.

All atoms will be displaced by +d and -d in all directions.

calculate_numerical_stress(atoms, d=1e-06, voigt=True)

Calculate numerical stress using finite difference.

calculate_properties(atoms, properties)

This method is experimental; currently for internal use.

calculation_required(atoms, properties)
check_state(atoms, tol=1e-15)

Check for any system changes since last calculation.

property directory: str
discard_results_on_any_change = False

Whether we purge the results following any change in the set() method.

export_properties()
get_atoms()
get_charges(atoms=None)
get_default_parameters()
get_dipole_moment(atoms=None)
get_forces(atoms=None)
get_magnetic_moment(atoms=None)
get_magnetic_moments(atoms=None)

Calculate magnetic moments projected onto atoms.

get_potential_energies(atoms=None)
get_potential_energy(atoms=None, force_consistent=False)
get_property(name, atoms=None, allow_calculation=True)

Get the named property.

get_stress(atoms=None)
get_stresses(atoms=None)

the calculator should return intensive stresses, i.e., such that stresses.sum(axis=0) == stress

ignored_changes: Set[str] = {}

Properties of Atoms which we ignore for the purposes of cache

property label
property name: str
read(label)

Read atoms, parameters and calculated properties from output file.

Read result from self.label file. Raise ReadError if the file is not there. If the file is corrupted or contains an error message from the calculation, a ReadError should also be raised. In case of succes, these attributes must set:

atoms: Atoms object

The state of the atoms from last calculation.

parameters: Parameters object

The parameter dictionary.

results: dict

Calculated properties like energy and forces.

The FileIOCalculator.read() method will typically read atoms and parameters and get the results dict by calling the read_results() method.

classmethod read_atoms(restart, **kwargs)
reset()

Clear all information from old calculation.

set(**kwargs)

Set parameters like set(key1=value1, key2=value2, …).

A dictionary containing the parameters that have been changed is returned.

Subclasses must implement a set() method that will look at the chaneged parameters and decide if a call to reset() is needed. If the changed parameters are harmless, like a change in verbosity, then there is no need to call reset().

The special keyword ‘parameters’ can be used to read parameters from a file.

set_label(label)

Set label and convert label to directory and prefix.

Examples:

  • label=’abc’: (directory=’.’, prefix=’abc’)

  • label=’dir1/abc’: (directory=’dir1’, prefix=’abc’)

  • label=None: (directory=’.’, prefix=None)

todict(skip_default=True)
matscipy.fracture_mechanics.idealbrittlesolid.find_crack_tip(atoms, dt=None, store=True, results=None)

Return atom at the crack tip and its x-coordinate

Crack tip is defined to be location of rightmost atom whose nearest neighbour is at distance > 2.5*a

matscipy.fracture_mechanics.idealbrittlesolid.set_initial_velocities(c)

Initialise a dynamical state by kicking some atoms behind tip

matscipy.fracture_mechanics.idealbrittlesolid.set_constraints(c, a)
matscipy.fracture_mechanics.idealbrittlesolid.extend_strip(atoms, a, N, M, vacuum)