pyiron.lammps.base module¶
-
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
-
property
bond_dict
¶ A dictionary which defines the nature of LAMMPS bonds that are to be drawn between atoms. To set the values, use the function define_bonds.
- Returns
Dictionary of the bond properties for every species
- Return type
dict
-
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/list) – Target temperature value(-s). If set to None, an NVE calculation is performed. It is required when the pressure is set or langevin is set It can be a list of temperature values, containing the initial target temperature and the final target temperature (in between the target value is varied linearly).
pressure (None/float/numpy.ndarray/list) – Target pressure. If set to None, an NVE or an NVT calculation is performed. A list of up to length 6 can be given to specify xx, yy, zz, xy, xz, and yz components of the pressure tensor, respectively. These values can mix floats and None to allow only certain degrees of cell freedom to change. (Default is None, run isochorically.)
n_ionic_steps (int) – Number of ionic steps
time_step (float) – Step size in fs between two steps.
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.)
job_name (str) – Job name of the job to generate a unique random seed.
rotation_matrix (numpy.ndarray) – The rotation matrix from the pyiron to Lammps coordinate frame.
-
calc_minimize
(e_tol=0.0, f_tol=0.0001, max_iter=1000000, pressure=None, n_print=100, style='cg')[source]¶ Sets parameters required for minimization.
- Parameters
e_tol (float) – If the magnitude of difference between energies of two consecutive steps is lower than or equal to e_tol, the minimisation terminates. (Default is 0.0 eV.)
f_tol (float) – If the magnitude of the global force vector at a step is lower than or equal to f_tol, the minimisation terminates. (Default is 1e-4 eV/angstrom.)
max_iter (int) – Maximum number of minimisation steps to carry out. If the minimisation converges before max_iter steps, terminate at the converged step. If the minimisation does not converge up to max_iter steps, terminate at the max_iter step. (Default is 100000.)
pressure (None/float/numpy.ndarray/list) – Target pressure. If set to None, an NVE or an NVT calculation is performed. A list of up to length 6 can be given to specify xx, yy, zz, xy, xz, and yz components of the pressure tensor, respectively. These values can mix floats and None to allow only certain degrees of cell freedom to change. (Default is None, run isochorically.)
n_print (int) – Write (dump or print) to the output file every n steps (Default: 100)
style ('cg'/'sd'/other values from Lammps docs) – The style of the numeric minimization, either conjugate gradient, steepest descent, or other keys permissible from the Lammps docs on ‘min_style’. (Default is ‘cg’ – conjugate gradient.)
rotation_matrix (numpy.ndarray) – The rotation matrix from the pyiron to Lammps coordinate frame.
-
calc_vcsgc
(mu=None, target_concentration=None, kappa=1000.0, mc_step_interval=100, swap_fraction=0.1, temperature_mc=None, window_size=None, window_moves=None, 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, initial_temperature=None, langevin=False)[source]¶ Run variance-constrained semi-grand-canonical MD/MC for a binary system. In addition to VC-SGC arguments, all arguments for a regular MD calculation are also accepted.
https://vcsgc-lammps.materialsmodeling.org
Note
For easy visualization later (with get_structure), it is highly recommended that the initial structure contain at least one atom of each species.
Warning
The fix does not yet support non-orthogonal simulation boxes; using one will give a runtime error.
- Parameters
mu (dict) – A dictionary of chemical potentials, one for each element the potential treats, where the dictionary keys are just the chemical symbol. Note that only the relative chemical potentials are used here, such that the swap acceptance probability is influenced by the chemical potential difference between the two species (a more negative value increases the odds of swapping to that element.) (Default is None, all elements have the same chemical potential.)
target_concentration – A dictionary of target simulation domain concentrations for each species in the potential. Dictionary keys should be the chemical symbol of the corresponding species, and the sum of all concentrations must be 1. (Default is None, which runs regular semi-grand-canonical MD/MC without any variance constraint.)
kappa – Variance constraint for the MC. Larger value means a tighter adherence to the target concentrations. (Default is 1000.)
mc_step_interval (int) – How many steps of MD between each set of MC moves. (Default is 100.) Must divide the number of ionic steps evenly.
swap_fraction (float) – The fraction of atoms whose species is swapped at each MC phase. (Default is 0.1.)
temperature_mc (float) – The temperature for accepting MC steps. (Default is None, which uses the MD temperature.)
window_size (float) – The size of the sampling window for parallel calculations as a fraction of something unspecified in the VC-SGC docs, but it must lie between 0.5 and 1. (Default is None, window is determined automatically.)
window_moves (int) – The number of times the sampling window is moved during one MC cycle. (Default is None, number of moves is determined automatically.)
-
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_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)
-
property
cutoff_radius
¶ Returns:
-
define_bonds
(species, element_list, cutoff_list, max_bond_list, bond_type_list, angle_type_list=None)[source]¶ Define the nature of bonds between different species. Make sure that the bonds between two species are defined only once (no double counting).
- Parameters
species (str) – Species for which the bonds are to be drawn (e.g. O, H, C ..)
element_list (list) – List of species to which the bonds are to be made (e.g. O, H, C, ..)
cutoff_list (list) – Draw bonds only for atoms within this cutoff distance
max_bond_list (list) – Maximum number of bonds drawn from each molecule
bond_type_list (list) – Type of the bond as defined in the LAMMPS potential file
angle_type_list (list) – Type of the angle as defined in the LAMMPS potential file
Example
The command below defined bonds between O and H atoms within a cutoff raduis of 2 $AA$ with the bond and angle types 1 defined in the potential file used
>> job_lammps.define_bonds(species=”O”, element_list-[“H”], cutoff_list=[2.0], bond_type_list=[1], angle_type_list=[1])
-
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
(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 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)
-
property
potential
¶ Execute view_potential() or list_potential() in order to see the pre-defined potential files
Returns:
-
property
potential_available
¶
-
property
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
-
property
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
-
property
publication
¶
-
remap_indices
(lammps_indices)[source]¶ Give the Lammps-dumped indices, re-maps these back onto the structure’s indices to preserve the species.
The issue is that for an N-element potential, Lammps dumps the chemical index from 1 to N based on the order that these species are written in the Lammps input file. But the indices for a given structure are based on the order in which chemical species were added to that structure, and run from 0 up to the number of species currently in that structure. Therefore we need to be a little careful with mapping.
- Parameters
indices (numpy.ndarray/list) – The Lammps-dumped integers.
- Returns
Those integers mapped onto the structure.
- Return type
numpy.ndarray
-
restart
(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 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_input_to_read_only
()[source]¶ This function enforces read-only mode for the input classes, but it has to be implement in the individual classes.