pylammpsmpi.wrapper.ase module

class pylammpsmpi.wrapper.ase.LammpsASELibrary(working_directory: str | None = None, hostname_localhost: bool | None = None, cores: int = 1, comm: object | None = None, logger: object | None = None, log_file: str | None = None, library: Any = None, disable_log_file: bool = True, executor: BaseExecutor | None = None)

Bases: object

A class that provides an interface to interact with LAMMPS using ASE.

Parameters:
  • working_directory (str, optional) – The working directory. Defaults to None.

  • cores (int, optional) – The number of cores to use. Defaults to 1.

  • comm (object, optional) – The MPI communicator. Defaults to None.

  • logger (object, optional) – The logger object. Defaults to None.

  • log_file (str, optional) – The log file path. Defaults to None.

  • library (object, optional) – The LAMMPS library object. Defaults to None.

  • disable_log_file (bool, optional) – Whether to disable the log file. Defaults to True.

  • executor – Executor to use for parallel execution (default: None)

close()
interactive_cells_getter() ndarray

Get the cell vectors from the interactive library.

Returns:

The cell vectors.

Return type:

np.ndarray

interactive_cells_setter(cell: ndarray) None

Set the cell vectors in the interactive library.

Parameters:

cell (np.ndarray) – The cell vectors.

interactive_energy_pot_getter() float

Get the potential energy from the interactive library.

Returns:

The potential energy.

Return type:

float

interactive_energy_tot_getter() float

Get the total energy from the interactive library.

Returns:

The total energy.

Return type:

float

interactive_forces_getter() ndarray

Get the forces on atoms from the interactive library.

Returns:

The forces on atoms.

Return type:

np.ndarray

interactive_indices_getter() ndarray

Get the indices of atoms from the interactive library.

Returns:

The indices of atoms.

Return type:

np.ndarray

interactive_indices_setter(indices, el_eam_lst)
interactive_lib_command(command: str) None

Execute a LAMMPS command using the interactive library.

Parameters:

command (str) – The LAMMPS command to execute.

interactive_positions_getter() ndarray

Get the positions of atoms from the interactive library.

Returns:

The positions of atoms.

Return type:

np.ndarray

interactive_positions_setter(positions: list[list[float]]) None

Set the positions of atoms in the interactive library.

Parameters:

positions (List[List[float]]) – The positions of atoms.

interactive_pressures_getter()
interactive_steps_getter() int

Get the number of steps from the interactive library.

Returns:

The number of steps.

Return type:

int

interactive_stress_getter(enable_stress_computation=True)

This gives back an Nx3x3 array of stress/atom defined in http://lammps.sandia.gov/doc/compute_stress_atom.html Keep in mind that it is stress*volume in eV. Further discussion can be found on the website above.

Returns:

Nx3x3 np array of stress/atom

Return type:

numpy.array

interactive_structure_setter(structure: Atoms, units: str, dimension: int, boundary: str, atom_style: str, el_eam_lst: list[str], calc_md: bool = True) None

Set the structure in the interactive library.

Parameters:
  • structure (ase.Atoms) – The structure.

  • units (str) – The units of the simulation.

  • dimension (int) – The dimension of the simulation.

  • boundary (str) – The boundary conditions.

  • atom_style (str) – The atom style.

  • el_eam_lst (List[str]) – The list of element symbols.

  • calc_md (bool, optional) – Whether to calculate molecular dynamics. Defaults to True.

interactive_temperatures_getter() float

Get the temperature from the interactive library.

Returns:

The temperature.

Return type:

float

interactive_velocities_getter()
interactive_volume_getter() float

Get the volume of the system from the interactive library.

Returns:

The volume of the system.

Return type:

float

set_fix_external_callback(fix_id, callback, caller=None)
pylammpsmpi.wrapper.ase.cell_is_skewed(cell, tolerance=1e-08)

Check whether the simulation box is skewed/sheared. The algorithm compares the box volume and the product of the box length in each direction. If these numbers do not match, the box is considered to be skewed and the function returns True

Parameters:

tolerance (float) – Relative tolerance above which the structure is considered as skewed

Returns:

Whether the box is skewed or not.

Return type:

(bool)

pylammpsmpi.wrapper.ase.get_fixed_atom_boolean_vector(structure)
pylammpsmpi.wrapper.ase.get_lammps_indicies_from_ase_indices(indices, structure, el_eam_lst)
pylammpsmpi.wrapper.ase.get_lammps_indicies_from_ase_structure(structure, el_eam_lst)
pylammpsmpi.wrapper.ase.get_species_indices_dict(structure)
pylammpsmpi.wrapper.ase.get_species_symbols(structure)
pylammpsmpi.wrapper.ase.get_structure_indices(structure)
pylammpsmpi.wrapper.ase.set_selective_dynamics(structure, calc_md)