pyiron_atomistics.lammps.potential.LammpsPotential#
- class pyiron_atomistics.lammps.potential.LammpsPotential(input_file_name=None)[source]#
Bases:
GenericParametersThis module helps write commands which help in the control of parameters related to the potential used in LAMMPS simulations
Methods
__init__([input_file_name])Clears all fields in the object
copy_pot_files(working_directory)define_blocks(block_dict)Define a block section within the GenericParameters
from_dict(obj_dict[, version])Populate the object from the serialized object.
from_hdf(hdf[, group_name])Restore the GenericParameters from an HDF5 file
get(parameter_name[, default_value])Get the value of a specific parameter from GenericParameters - if the parameter is not available return default_value if that is set.
get_attribute(attribute_name)Get the value of a specific parameter from GenericParameters
get_charge(element_symbol)Return charge for element.
get_element_id(element_symbol)Return numeric element id for element.
get_element_lst()Output the GenericParameters object as Pandas Dataframe for human readability.
Get list of strings from GenericParameters to write to input file
instantiate(obj_dict[, version])Create a blank instance of this class.
keys()Return keys of GenericParameters object
Load defaults resets the dataset in the background to be empty
load_string(input_str)Load a multi line string to overwrite the current parameter settings
modify([separator, append_if_not_present])Modify values for existing parameters.
read_input(file_name[, ignore_trigger])Read input file and store the data in GenericParameters - this overwrites the current parameter settings
remove_keys(key_list)Remove a list of keys from the GenericParameters
remove_structure_block()set([separator])Set the value of multiple parameters or create new parameter key, if they do not exist already.
set_dict(dictionary)Set a dictionary of key value pairs
set_value(line, val)Set the value of a parameter in a specific line
to_dict()Reduce the object to a dictionary.
to_hdf(hdf[, group_name])Store the GenericParameters in an HDF5 file
write_file(file_name[, cwd])Write GenericParameters to input file
Attributes
Get the separator that characterizes comment
dfGet the special character at the end of every line
Get the file name of the input file
filesGet the multi word separator to have multi word keys
Get the dictionary to replace certain character combinations
Get the separator that characterizes the split between key and value
Get the name of the input table inside the HDF5 file
Get the boolean option to switch from a key value list to an value only input file
- clear_all() None#
Clears all fields in the object
- property comment_char: str | None#
Get the separator that characterizes comment
- Returns:
comment character
- Return type:
str
- define_blocks(block_dict: Dict[str, List[str]]) None#
Define a block section within the GenericParameters
- Parameters:
block_dict (dict) – dictionary to define the block
- property end_value_char: str | None#
Get the special character at the end of every line
- Returns:
end of line character
- Return type:
str
- property file_name: str | None#
Get the file name of the input file
- Returns:
file name
- Return type:
str
- from_dict(obj_dict, version: str = None)[source]#
Populate the object from the serialized object.
- Parameters:
obj_dict (dict) – data previously returned from
to_dict()version (str) – version tag written together with the data
- 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(parameter_name: str, default_value: str | None = None) str | None#
Get the value of a specific parameter from GenericParameters - if the parameter is not available return default_value if that is set.
- Parameters:
parameter_name (str) – parameter key
default_value (str) – default value to return is the parameter is not set
- Returns:
value of the parameter
- Return type:
str
- get_attribute(attribute_name: str) str | None#
Get the value of a specific parameter from GenericParameters
- Parameters:
attribute_name (str) – parameter key
- Returns:
value of the parameter
- Return type:
str
- get_charge(element_symbol)[source]#
Return charge for element. If potential does not specify a charge, raise a :class:NameError. Only makes sense for potentials with pair_style “full”.
- Parameters:
element_symbol (str) – short symbol for element
- Returns:
charge speicified for the given element
- Return type:
float
- Raises:
NameError – if potential does not specify charge for this element
- get_element_id(element_symbol)[source]#
Return numeric element id for element. If potential does not contain the element raise a :class:NameError. Only makes sense for potentials with pair_style “full”.
- Parameters:
element_symbol (str) – short symbol for element
- Returns:
id matching the given symbol
- Return type:
int
- Raises:
NameError – if potential does not contain this element
- get_pandas() DataFrame#
Output the GenericParameters object as Pandas Dataframe for human readability.
- Returns:
Pandas Dataframe of the GenericParameters object
- Return type:
pandas.DataFrame
- get_string_lst() List[str]#
Get list of strings from GenericParameters to write to input file
- Returns:
List of strings representing the GenericParameters object
- Return type:
List[str]
- classmethod instantiate(obj_dict: dict, version: str = None) Self#
Create a blank instance of this class.
This can be used when some values are already necessary for the objects __init__.
- Parameters:
obj_dict (dict) – data previously returned from
to_dict()version (str) – version tag written together with the data
- Returns:
a blank instance of the object that is sufficiently initialized to call
_from_dict()on it- Return type:
object
- keys() List[str]#
Return keys of GenericParameters object
- load_default() None#
Load defaults resets the dataset in the background to be empty
- load_string(input_str: str) None#
Load a multi line string to overwrite the current parameter settings
- Parameters:
input_str (str) – multi line string
- modify(separator: str | None = None, append_if_not_present: bool = False, **modify_dict: str | bool) None#
Modify values for existing parameters. The command is called as modify(param1=val1, param2=val2, …)
- Parameters:
separator (str) – needed if the parameter name contains special characters such as par: use then as input: modify(separator=”:”, par=val) - optional
append_if_not_present (bool) – do not raise an exception but append the parameter in practice use set(par=val) - default=False
**modify_dict (dict) – dictionary of parameter names and values
- property multi_word_separator: str | None#
Get the multi word separator to have multi word keys
- Returns:
multi word separator
- Return type:
str
- read_input(file_name: str, ignore_trigger: str | None = None) None#
Read input file and store the data in GenericParameters - this overwrites the current parameter settings
- Parameters:
file_name (str) – absolute path to the input file
ignore_trigger (str) – trigger for lines to be ignored
- remove_keys(key_list: List[str]) None#
Remove a list of keys from the GenericParameters
- Parameters:
key_list (list) – list of keys to be removed
- property replace_char_dict: Dict[str, str] | None#
Get the dictionary to replace certain character combinations
- Returns:
character replace dictionary
- Return type:
dict
- property separator_char: str | None#
Get the separator that characterizes the split between key and value
- Returns:
separator character
- Return type:
str
- set(separator: str | None = None, **set_dict: str | bool) None#
Set the value of multiple parameters or create new parameter key, if they do not exist already.
- Parameters:
separator (float/int/str) – separator string - optional
**set_dict (dict) – dictionary containing the parameter keys and their corresponding values to be set
- set_dict(dictionary: Dict[str, str | bool]) None#
Set a dictionary of key value pairs
- Parameters:
dictionary (dict) – dictionary of key value pairs
- set_value(line: int, val: str | bytes) None#
Set the value of a parameter in a specific line
- Parameters:
line (float/int/str) – line number - starting with 0
val (str/bytes) – value to be set
- property table_name: str | None#
Get the name of the input table inside the HDF5 file
- Returns:
table name
- Return type:
str
- to_dict()[source]#
Reduce the object to a dictionary.
- Returns:
serialized state of this object
- Return type:
dict
- 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
- property val_only: bool | None#
Get the boolean option to switch from a key value list to an value only input file
- Returns:
[True/False]
- Return type:
bool
- write_file(file_name: str, cwd: str | None = None) None#
Write GenericParameters to input file
- Parameters:
file_name (str) – name of the file, either absolute (then cwd must be None) or relative
cwd (str) – path name (default: None)