pyiron.lammps package

Submodules

pyiron.lammps.base module

class pyiron.lammps.base.Input[source]

Bases: object

from_hdf(hdf5)[source]
Parameters:hdf5

Returns:

to_hdf(hdf5)[source]
Parameters:hdf5

Returns:

class pyiron.lammps.base.LammpsBase(project, job_name)[source]

Bases: pyiron.atomistics.job.atomistic.AtomisticGenericJob

Class to setup and run and analyze LAMMPS simulations which is a derivative of atomistics.job.generic.GenericJob. The functions in these modules are written in such the function names and attributes are very generic (get_structure(), molecular_dynamics(), version) but the functions are written to handle LAMMPS specific input/output.

Parameters:
  • project (pyiron.project.Project instance) – Specifies the project path among other attributes
  • job_name (str) – Name of the job
input

Instance which handles the input

Type:lammps.Input instance
calc_md(temperature=None, pressure=None, n_ionic_steps=1000, time_step=1.0, n_print=100, temperature_damping_timescale=100.0, pressure_damping_timescale=1000.0, seed=None, tloop=None, initial_temperature=None, langevin=False, delta_temp=None, delta_press=None)[source]

Set an MD calculation within LAMMPS. Nosé Hoover is used by default.

Parameters:
  • temperature (None/float) – Target temperature. If set to None, an NVE calculation is performed. It is required when the pressure is set or langevin is set
  • pressure (None/float) – Target pressure. If set to None, an NVE or an NVT calculation is performed. (This tag will allow for a list in the future as it is done for calc_minimize())
  • n_ionic_steps (int) – Number of ionic steps
  • time_step (float) – Step size between two steps. In fs if units==metal
  • n_print (int) – Print frequency
  • temperature_damping_timescale (float) – The time associated with the thermostat adjusting the temperature. (In fs. After rescaling to appropriate time units, is equivalent to Lammps’ Tdamp.)
  • pressure_damping_timescale (float) – The time associated with the barostat adjusting the temperature. (In fs. After rescaling to appropriate time units, is equivalent to Lammps’ Pdamp.)
  • seed (int) – Seed for the random number generation (required for the velocity creation)
  • tloop
  • initial_temperature (None/float) – Initial temperature according to which the initial velocity field is created. If None, the initial temperature will be twice the target temperature (which would go immediately down to the target temperature as described in equipartition theorem). If 0, the velocity field is not initialized (in which case the initial velocity given in structure will be used). If any other number is given, this value is going to be used for the initial temperature.
  • langevin (bool) – (True or False) Activate Langevin dynamics
  • delta_temp (float) – Thermostat timescale, but in your Lammps time units, whatever those are. (DEPRECATED.)
  • delta_press (float) – Barostat timescale, but in your Lammps time units, whatever those are. (DEPRECATED.)
calc_minimize(e_tol=0.0, f_tol=0.01, max_iter=100000, pressure=None, n_print=100)[source]
Parameters:
  • e_tol
  • f_tol
  • max_iter
  • pressure
  • n_print

Returns:

calc_static()[source]

Returns:

collect_dump_file(file_name='dump.out', cwd=None)[source]

general purpose routine to extract static from a lammps dump file

Parameters:
  • file_name
  • cwd

Returns:

collect_errors(file_name, cwd=None)[source]
Parameters:
  • file_name
  • cwd

Returns:

collect_h5md_file(file_name='dump.h5', cwd=None)[source]
Parameters:
  • file_name
  • cwd

Returns:

collect_logfiles()[source]

Returns:

collect_output()[source]

Returns:

collect_output_log(file_name='log.lammps', cwd=None)[source]

general purpose routine to extract static from a lammps log file

Parameters:
  • file_name
  • cwd

Returns:

compress(files_to_compress=None)[source]

Compress the output files of a job object.

Parameters:files_to_compress (list) –
convergence_check()[source]

Validate the convergence of the calculation.

Returns:If the calculation is converged
Return type:(bool)
cutoff_radius

type: Returns

enable_h5md()[source]

Returns:

from_hdf(hdf=None, group_name=None)[source]
Parameters:
  • hdf
  • group_name

Returns:

get_final_structure()[source]

Returns:

get_potentials_for_structure()[source]

Returns:

list_potentials()[source]

List of interatomic potentials suitable for the current atomic structure.

use self.potentials_view() to get more details.

Returns:potential names
Return type:list
next(snapshot=-1, job_name=None, job_type=None)[source]

Restart a new job created from an existing Lammps calculation. :param project: Project instance at which the new job should be created :type project: pyiron.project.Project instance :param snapshot: Snapshot of the calculations which would be the initial structure of the new job :type snapshot: int :param job_name: Job name :type job_name: str :param job_type: Job type. If not specified a Lammps job type is assumed :type job_type: str

Returns:New job
Return type:new_ham (lammps.lammps.Lammps instance)
potential

Execute view_potential() or list_potential() in order to see the pre-defined potential files

Returns:

potential_list

List of interatomic potentials suitable for the current atomic structure.

use self.potentials_view() to get more details.

Returns:potential names
Return type:list
potential_view

List all interatomic potentials for the current atomistic sturcture including all potential parameters.

To quickly get only the names of the potentials you can use: self.potentials_list()

Returns:Dataframe including all potential parameters.
Return type:pandas.Dataframe
read_restart_file(filename='restart.out')[source]
Parameters:filename

Returns:

restart(snapshot=-1, job_name=None, job_type=None)[source]

Restart a new job created from an existing Lammps calculation. :param project: Project instance at which the new job should be created :type project: pyiron.project.Project instance :param snapshot: Snapshot of the calculations which would be the initial structure of the new job :type snapshot: int :param job_name: Job name :type job_name: str :param job_type: Job type. If not specified a Lammps job type is assumed :type job_type: str

Returns:New job
Return type:new_ham (lammps.lammps.Lammps instance)
set_potential(file_name)[source]
Parameters:file_name

Returns:

to_hdf(hdf=None, group_name=None)[source]
Parameters:
  • hdf
  • group_name

Returns:

validate_ready_to_run()[source]

Returns:

view_potentials()[source]

List all interatomic potentials for the current atomistic sturcture including all potential parameters.

To quickly get only the names of the potentials you can use: self.potentials_list()

Returns:Dataframe including all potential parameters.
Return type:pandas.Dataframe
write_input()[source]

Call routines that generate the code specific input files

Returns:

write_restart_file(filename='restart.out')[source]
Parameters:filename

Returns:

pyiron.lammps.base.to_amat(l_list)[source]
Parameters:l_list

Returns:

pyiron.lammps.control module

class pyiron.lammps.control.LammpsControl(input_file_name=None, **qwargs)[source]

Bases: pyiron.base.generic.parameters.GenericParameters

calc_md(temperature=None, pressure=None, n_ionic_steps=1000, time_step=1.0, n_print=100, temperature_damping_timescale=100.0, pressure_damping_timescale=1000.0, seed=None, tloop=None, initial_temperature=None, langevin=False, delta_temp=None, delta_press=None)[source]

Set an MD calculation within LAMMPS. Nosé Hoover is used by default.

Parameters:
  • temperature (None/float) – Target temperature. If set to None, an NVE calculation is performed. It is required when the pressure is set or langevin is set
  • pressure (None/float) – Target pressure. If set to None, an NVE or an NVT calculation is performed. (This tag will allow for a list in the future as it is done for calc_minimize())
  • n_ionic_steps (int) – Number of ionic steps
  • time_step (float) – Step size between two steps. In fs if units==metal
  • n_print (int) – Print frequency
  • temperature_damping_timescale (float) – The time associated with the thermostat adjusting the temperature. (In fs. After rescaling to appropriate time units, is equivalent to Lammps’ Tdamp.)
  • pressure_damping_timescale (float) – The time associated with the barostat adjusting the temperature. (In fs. After rescaling to appropriate time units, is equivalent to Lammps’ Pdamp.)
  • seed (int) – Seed for the random number generation (required for the velocity creation)
  • tloop
  • initial_temperature (None/float) – Initial temperature according to which the initial velocity field is created. If None, the initial temperature will be twice the target temperature (which would go immediately down to the target temperature as described in equipartition theorem). If 0, the velocity field is not initialized (in which case the initial velocity given in structure will be used). If any other number is given, this value is going to be used for the initial temperature.
  • langevin (bool) – (True or False) Activate Langevin dynamics
  • delta_temp (float) – Thermostat timescale, but in your Lammps time units, whatever those are. (DEPRECATED.)
  • delta_press (float) – Barostat timescale, but in your Lammps time units, whatever those are. (DEPRECATED.)
calc_minimize(e_tol=0.0, f_tol=1e-08, max_iter=100000, pressure=None, n_print=100)[source]
calc_static()[source]
dataset
load_default(file_content=None)[source]

Load defaults resets the dataset in the background to be empty

set_initial_velocity(temperature, seed=None, gaussian=False, append_value=False, zero_lin_momentum=True, zero_rot_momentum=True)[source]

Create initial velocities via velocity all create. More information can be found on LAMMPS website: https://lammps.sandia.gov/doc/velocity.html

Parameters:
  • temperature – (int or float)
  • seed – (int) Seed for the initial random number generator
  • gaussian – (True/False) Create velocity according to the Gaussian distribution (otherwise uniform)
  • append_value – (True/False) Add the velocity values to the current velocities (probably not functional now)
  • zero_lin_momentum – (True/False) Cancel the total linear momentum
  • zero_rot_momentum – (True/False) Cancel the total angular momentum

pyiron.lammps.interactive module

class pyiron.lammps.interactive.LammpsInteractive(project, job_name)[source]

Bases: pyiron.lammps.base.LammpsBase, pyiron.atomistics.job.interactive.GenericInteractive

calc_minimize(e_tol=1e-08, f_tol=1e-08, max_iter=1000, pressure=None, n_print=100)[source]
Parameters:
  • e_tol
  • f_tol
  • max_iter
  • pressure
  • n_print

Returns:

collect_output()[source]

Returns:

from_hdf(hdf=None, group_name=None)[source]

Recreates instance from the hdf5 file

Parameters:
  • hdf (str) – Path to the hdf5 file
  • group_name (str) – Name of the group which contains the object
get_structure(iteration_step=-1)[source]

Gets the structure from a given iteration step of the simulation (MD/ionic relaxation). For static calculations there is only one ionic iteration step :param iteration_step: Step for which the structure is requested :type iteration_step: int

Returns:The required structure
Return type:pyiron.atomistics.structure.atoms.Atoms
interactive_cells_getter()[source]
interactive_cells_setter(cell)[source]
interactive_close()[source]

Returns:

interactive_energy_pot_getter()[source]
interactive_energy_tot_getter()[source]
interactive_fetch()[source]
interactive_forces_getter()[source]
interactive_indices_getter()[source]
interactive_indices_setter(indices)[source]
interactive_initialize_interface()[source]
interactive_positions_getter()[source]
interactive_positions_setter(positions)[source]
interactive_pressures_getter()[source]
interactive_steps_getter()[source]
interactive_stress_getter()[source]

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)[source]
interactive_temperatures_getter()[source]
interactive_volume_getter()[source]
run_if_interactive()[source]

For jobs which executables are available as Python library, those can also be executed with a library call instead of calling an external executable. This is usually faster than a single core python job.

run_if_interactive_non_modal()[source]

For jobs which executables are available as Python library, those can also be executed with a library call instead of calling an external executable. This is usually faster than a single core python job.

structure

type: Returns

update_potential()[source]

pyiron.lammps.lammps module

class pyiron.lammps.lammps.Lammps(project, job_name)[source]

Bases: pyiron.lammps.interactive.LammpsInteractive

Class to setup and run and analyze LAMMPS simulations which is a derivative of atomistics.job.generic.GenericJob. The functions in these modules are written in such the function names and attributes are very generic (get_structure(), molecular_dynamics(), version) but the functions are written to handle LAMMPS specific input/output.

Parameters:
  • project (pyiron.project.Project instance) – Specifies the project path among other attributes
  • job_name (str) – Name of the job
input

Instance which handles the input

Type:lammps.Input instance
class pyiron.lammps.lammps.LammpsInt(project, job_name)[source]

Bases: pyiron.lammps.lammps.Lammps

class pyiron.lammps.lammps.LammpsInt2(project, job_name)[source]

Bases: pyiron.lammps.lammps.Lammps

pyiron.lammps.pipe module

class pyiron.lammps.pipe.LammpsLibrary[source]

Bases: object

close()[source]
command(command)[source]
extract_compute(*args)[source]
gather_atoms(*args)[source]
get_thermo(*args)[source]
static interactive_close(conn, job, funct_args)[source]
static interactive_extract_compute(conn, job, funct_args)[source]
static interactive_get_thermo(conn, job, funct_args)[source]
static interactive_lib_command(conn, job, funct_args)[source]
static interactive_run(conn, job)[source]
static interactive_scatter_atoms(conn, job, funct_args)[source]
static interative_gather_atoms(conn, job, funct_args)[source]
scatter_atoms(*args)[source]

pyiron.lammps.potential module

class pyiron.lammps.potential.LammpsPotential(input_file_name=None)[source]

Bases: pyiron.base.generic.parameters.GenericParameters

This module helps write commands which help in the control of parameters related to the potential used in LAMMPS simulations

copy_pot_files(working_directory)[source]
df
files
from_hdf(hdf, group_name=None)[source]

Restore the GenericParameters from an HDF5 file

Parameters:
  • hdf (ProjectHDFio) – HDF5 group object
  • group_name (str) – HDF5 subgroup name - optional
get_element_lst()[source]
remove_structure_block()[source]
to_hdf(hdf, group_name=None)[source]

Store the GenericParameters in an HDF5 file

Parameters:
  • hdf (ProjectHDFio) – HDF5 group object
  • group_name (str) – HDF5 subgroup name - optional
class pyiron.lammps.potential.LammpsPotentialFile(potential_df=None, default_df=None, selected_atoms=None)[source]

Bases: pyiron.atomistics.job.potentials.PotentialAbstract

The Potential class is derived from the PotentialAbstract class, but instead of loading the potentials from a list, the potentials are loaded from a file.

Parameters:
  • potential_df
  • default_df
  • selected_atoms
default()[source]
find_default(element)[source]

Find the potentials

Parameters:
  • element (set, str) – element or set of elements for which you want the possible LAMMPS potentials
  • path (bool) – choose whether to return the full path to the potential or just the potential name
Returns:

of possible potentials for the element or the combination of elements

Return type:

list

pyiron.lammps.structure module

class pyiron.lammps.structure.LammpsStructure(input_file_name=None)[source]

Bases: pyiron.base.generic.parameters.GenericParameters

Parameters:input_file_name
el_eam_lst

type: Returns

load_default()[source]

Returns:

potential
rotate_positions(structure)[source]

Rotate all atomic positions in given structure according to new Prism cell

Parameters:structure – Atoms-like object. Should has .positions attribute
Returns:List of rotated coordinates
Return type:(list)
simulation_cell()[source]

Returns:

structure

type: Returns

structure_atomic()[source]

Write routine to create atom structure static file that can be loaded by LAMMPS

Returns:

structure_bond()[source]

Returns:

structure_charge()[source]

Create atom structure including the atom charges.

By convention the LAMMPS atom type numbers are chose alphabetically for the chemical species.

Returns: LAMMPS readable structure.

structure_full()[source]

Write routine to create atom structure static file for atom_type=’full’ that can be loaded by LAMMPS

Returns:

class pyiron.lammps.structure.UnfoldingPrism(cell, pbc=(True, True, True), digits=10)[source]

Bases: ase.calculators.lammpsrun.Prism

Create a lammps-style triclinic prism object from a cell

The main purpose of the prism-object is to create suitable string representations of prism limits and atom positions within the prism. When creating the object, the digits parameter (default set to 10) specify the precision to use. lammps is picky about stuff being within semi-open intervals, e.g. for atom positions (when using create_atom in the in-file), x must be within [xlo, xhi).

Parameters:
  • cell
  • pbc
  • digits
pos_to_lammps(position)[source]

Rotate an ase-cell position to the lammps cell orientation

Parameters:position
Returns:tuple of float.
unfold_cell(cell)[source]

Unfold LAMMPS cell to original

Parameters:cell – LAMMPS cell,
Returns:unfolded cell
pyiron.lammps.structure.write_lammps_datafile(structure, file_name='lammps.data', cwd=None)[source]

Module contents