aiida_lammps.parsers.utils
#
Utility functions for the handling of the input files
Module Contents#
Functions#
|
Transform the cell to an orientation, compatible with LAMMPS |
|
Creation of the structure file content. |
|
Generate the header for the blocks. |
|
Flattens a list of list into a flat list. |
|
convert True/False to yes/no and all values to strings |
|
|
|
join a dict of {keyword: value, ...} into a string 'keyword value ...' |
- aiida_lammps.parsers.utils._transform_cell(cell) numpy.array | numpy.array [source]#
Transform the cell to an orientation, compatible with LAMMPS
LAMMPS requires the simulation cell to be in the format of a lower triangular matrix (right-handed basis). Therefore the cell and positions may require rotation and inversion. See https://lammps.sandia.gov/doc/Howto_triclinic.html
- Parameters:
cell – crystal cell of the original structure
- Returns:
LAMMPS compatible cell, transformation between original and final cell
- Return type:
Union[np.array, np.array]
- aiida_lammps.parsers.utils.generate_lammps_structure(structure: aiida.orm.StructureData, atom_style: str = 'atomic', charge_dict: dict[str, float] | None = None, round_dp: float | None = None, docstring: str = 'generated by aiida_lammps') str | numpy.array [source]#
Creation of the structure file content.
As allowing the users to create their lattices using LAMMPS’ would be too complex, one must ensure that the aiida StructureData is written to file in a format that is compatible to LAMMPS.
In the case of non-orthogonal structures, this will take care of generating a triclinic cell compatible with what LAMMPS expects.
- Parameters:
structure (orm.StructureData) – the structure to use in the simulation
atom_style (str, optional) – treatment of the particles according to lammps, defaults to ‘atomic’
charge_dict (dict, optional) – dictionary with the charge for the particles, defaults to None
round_dp (float, optional) – precision to which to round the positions, defaults to None
docstring (str, optional) – header for the structure file, defaults to ‘generated by aiida_lammps’
- Raises:
ValueError – if the atom_style does not belong to either ‘atomic’ or ‘charge’
- Returns:
the structure file content, the transformation matrix applied to the structure cell and coordinates
- Return type:
Union[str, np.array]
- aiida_lammps.parsers.utils.generate_header(value: str) str [source]#
Generate the header for the blocks.
- aiida_lammps.parsers.utils.flatten(full_list: list) list [source]#
Flattens a list of list into a flat list.