class matlantis_features.filters.ExpCellASEFilter(mask: Optional[List[bool]] = None, cell_factor: Optional[float] = None, hydrostatic_strain: bool = False, constant_volume: bool = False, scalar_pressure: float = 0.0)#

Bases: MatlantisASEFilter

The filter that uses the ASE ExpCellASEFilter implemmentation.

__init__(mask: Optional[List[bool]] = None, cell_factor: Optional[float] = None, hydrostatic_strain: bool = False, constant_volume: bool = False, scalar_pressure: float = 0.0)#

Initialize an instance.

Parameters
  • mask (list[bool] or None, optional) – A list of booleans indicating which of the six independent components of the
    strain are relaxed. If None, all components are relaxed. Defaults to None.

  • cell_factor (float or None, optional) – Factor by which deformation gradient is multiplied to put it on the same scale as
    the positions when assembling the combined position/cell vector. The stress
    contribution to the forces is scaled down by the same factor. If None, a default
    value which is equal to the number of atoms will be used. Defaults to None.

  • hydrostatic_strain (bool, optional) – Constrain the cell by only allowing hydrostatic deformation. Defaults to False.

  • constant_volume (bool, optional) – Relax cell while keep the cell volume.
    Note: this only approximately conserves the volume and breaks energy/force
    consistency so can only be used with optimizers that do require do a line
    minimisation (e.g. FIRE). Defaults to False.

  • scalar_pressure (float, optional) – Applied pressure in atomic units (eV/Angstrom^3). As above, this breaks
    energy/force consistency. Defaults to 0.0.

to_dict() Dict[str, Any]#

Dictionary representation of the ExpCellASEFilter.

Returns

A dict containing a serialized ExpCellASEFilter.

Return type

dict[str, Any]

class matlantis_features.filters.IsotropicASEFilter#

Bases: MatlantisASEFilter

The filter that uses the IsotropicFilter implemmentation.

__init__() None#

Initialize an instance.

to_dict() Dict[str, Any]#

Dictionary representation of the IsotropicASEFilter.

Returns

A dict containing a serialized IsotropicASEFilter.

Return type

dict[str, Any]

class matlantis_features.filters.IsotropicFilter(atoms: Atoms)#

Bases: Filter

The filter to keep the ratio of cell lengths during MD or optimization.

__init__(atoms: Atoms) None#

Initialize an instance.

Parameters

atoms (ASEAtoms) – Filter atoms.

get_global_number_of_atoms() int#

Returns the global number of atoms in a distributed-atoms parallel simulation.

Returns

The global number of atoms.

Return type

int

get_kinetic_energy() float#

Get the kinetic energy.

Returns

The kinetic energy.

Return type

float

get_stress(**kwargs: Any) ndarray#

Calculate stress tensor.

Returns

Stress tensor after applying filter.

Return type

np.ndarray

get_temperature() float#

Get the temperature in Kelvin.

Returns

The temperature.

Return type

float

get_total_energy() float#

Get the total energy.

Returns

The total energy.

Return type

float

set_cell(cell: ndarray, scale_atoms: bool = False, apply_constraint: bool = True) None#

Set unit cell vectors.

Parameters
  • cell (np.ndarray) – Unit cell.

  • scale_atoms (bool, optional) – Whether to fix atomic positions or move atoms with the unit cell. Defaults to
    False.

  • apply_constraint (bool, optional) – Whether to apply constraints to the given cell. Defaults to True.

class matlantis_features.filters.MatlantisASEFilter(get_filter: Callable[[Union[Atoms, MatlantisAtoms]], Filter])#

Bases: MatlantisFilter

MatlantisFilter class will be used in the optimization feature.

__call__(atoms: Union[Atoms, MatlantisAtoms]) Filter#

Call function.

Parameters

atoms (ASEAtoms or MatlantisAtoms) – The system to be optimized. The ASEAtoms and MatlantisAtoms are also supported.

Returns

The filter to be used in the optimization.

Return type

Filter

__init__(get_filter: Callable[[Union[Atoms, MatlantisAtoms]], Filter])#

Initialize an instance.

Parameters

get_filter (ASEAtoms or MatlantisAtoms -> Filter) – A function to get a filter.

class matlantis_features.filters.MatlantisFilter#

Bases: object

Template base class for Matlantis Filter.

__call__(atoms: Union[Atoms, MatlantisAtoms]) Any#

Call function.

Parameters

atoms (ASEAtoms or MatlantisAtoms) – The system to add filter to.

Returns

The system with filter which to be used in the optimization.

Return type

Any

classmethod from_dict(res: Dict[str, Any]) MatlantisFilter#

Construct a MatlantisFilter object from serialized dict.

Parameters

res (dict[str, Any]) – A dict containing a serialized MatlantisFilter from to_dict().

Returns

The deserialized object from provided dict.

Return type

MatlantisFilter

to_dict() Dict[str, Any]#

Dictionary representation of the MatlantisFilter.

Returns

A dict containing a serialized MatlantisFilter.

Return type

dict[str, Any]

class matlantis_features.filters.StrainASEFilter(mask: Optional[List[bool]] = None, include_ideal_gas: bool = False)#

Bases: MatlantisASEFilter

The filter that uses the ASE StrainASEFilter implemmentation.

__init__(mask: Optional[List[bool]] = None, include_ideal_gas: bool = False)#

Initialize an instance.

Parameters
  • mask (list[bool] or None, optional) – A list of booleans indicating which of the six independent components of the
    strain are relaxed. If None, all components are relaxed. Defaults to None.

  • include_ideal_gas (bool, optional) – The ideal gas contribution to the stresses is added. Defaults to False.

to_dict() Dict[str, Any]#

Dictionary representation of the StrainASEFilter.

Returns

A dict containing a serialized StrainASEFilter.

Return type

dict[str, Any]

class matlantis_features.filters.UnitCellASEFilter(mask: Optional[List[bool]] = None, cell_factor: Optional[float] = None, hydrostatic_strain: bool = False, constant_volume: bool = False, scalar_pressure: float = 0.0)#

Bases: MatlantisASEFilter

The filter that uses the ASE UnitCellFilter implemmentation.

__init__(mask: Optional[List[bool]] = None, cell_factor: Optional[float] = None, hydrostatic_strain: bool = False, constant_volume: bool = False, scalar_pressure: float = 0.0)#

Initialize an instance.

Parameters
  • mask (list[bool] or None, optional) – A list of booleans indicating which of the six independent components of the
    strain are relaxed. Defaults to None.

  • cell_factor (float or None, optional) – Factor by which deformation gradient is multiplied to put it on the same scale as
    the positions when assembling the combined position/cell vector. The stress
    contribution to the forces is scaled down by the same factor. If None, a default
    value which is equal to the number of atoms will be used. Defaults to None.

  • hydrostatic_strain (bool, optional) – Constrain the cell by only allowing hydrostatic deformation. Defaults to False.

  • constant_volume (bool, optional) – Relax cell while keep the cell volume.
    Note: this only approximately conserves the volume and breaks energy/force
    consistency so can only be used with optimizers that do require do a line
    minimisation (e.g. FIRE). Defaults to False.

  • scalar_pressure (float, optional) – Applied pressure in atomic units (eV/Angstrom^3). As above, this breaks
    energy/force consistency. Defaults to 0.0.

to_dict() Dict[str, Any]#

Dictionary representation of the UnitCellASEFilter.

Returns

A dict containing a serialized UnitCellASEFilter.

Return type

dict[str, Any]