tools

Lennard Jones

class thermo.tools.lj.LJ(symbols=None, ignore_pairs=None, cut_scale=2.5)[source]

Bases: object

Stores all atoms for a simulation with their LJ parameters.

A special dictionary with atom symbols for keys and the epsilon and sigma LJ parameters for the values. This object interfaces with the UFF LJ potential parameters but can also accept arbitrary parameters.

Args:
symbols (str or list(str)):
Optional input. A single symbol or a list of symbols to add to the initial LJ list.
ignore_pairs (list(sets)):
List of sets where each set has two elements. Each element is a string for the symbol of the atom to ignore in that pair. Order in set is not important.
cut_scale (float):
Specifies the multiplicative factor to use on the sigma parameter to define the cutoffs. Default is 2.5.
acknowledge_pair(pair)[source]

Removes the pair from the ignore list and acknowledges it during the output.

Args:
pair (set):
A two-element set where each entry is a string of the symbol in the pair to un-ignore.
acknowledge_pairs(pairs)[source]

Removes pairs from the ignore list.

Args:
pairs (list(set)):
A list of two-elements sets where each entry in each set is a string of the symbol in the pair to un-ignore.
add_UFF_params(symbols, replace=False)[source]

Adds UFF parameters to the LJ object. Will replace existing parameters if ‘replace’ is set to True. UFF parameters are loaded from the package.

Args:
symbols (str or list(str)):
A single symbol or a list of symbols to add to the initial LJ list.
replace (bool):
Whether or not to replace existing symbols
add_param(symbol, data, replace=True)[source]

Adds a custom parameter to the LJ object.

Args:
symbol (str):
Symbol of atom type to add.
data (tuple(float)):
A two-element tuple of numbers to represent the epsilon and sigma LJ values.
replace (bool):
Whether or not to replace the item.
create_file(filename='ljparams.txt', atom_order=None)[source]

Outputs a GPUMD style LJ parameters file using the atoms defined in atom_order in the order defined in atom_order.

Args:
filename (str):
The filename or full path with filename of the output.
atom_order (list(str)):
List of atom symbols to include LJ params output file. The order will determine the order in the output file. Required Ex. [‘a’, ‘b’, ‘c’] = pairs => ‘aa’, ‘ab’, ‘ac’, ‘ba’, ‘bb’, ‘bc’, ‘ca’, ‘cb’ ‘cc’ in this order.
custom_cutoff(pair, cutoff)[source]

Sets a custom cutoff for a specific pair of atoms.

Args:
pair (set):
A two-element set where each entry is a string of the symbol in the pair.
cutoff (float):
Custom cutoff to use. In Angstroms.
ignore_pair(pair)[source]

Adds a pair to the list of pairs that will be ignored when output to file.

Args:
pair (set):
A two-element set where each entry is a string of the symbol in the pair to ignore.
ignore_pairs(pairs)[source]

Adds a list of pairs that will be ignored when output to file.

Args:
pairs (list(set)):
A list of two-element sets where each entry of each set is a string of the symbol in the pair to ignore.
remove_custom_cutoff(pair)[source]

Removes a custom cutoff for a pair of atoms.

Args:
pair (set):
A two-element set where each entry is a string of the symbol in the pair.
remove_param(symbol)[source]

Removes an element from the LJ object. If item does not exist, nothing happens.

Args:
symbol (str):
Symbol of atom type to remove.
replace_UFF_params(symbols, add=False)[source]

Replaces current LJ parameters with UFF values. Will add new entries if ‘add’ is set to True. UFF parameters are loaded from the package.

Args:
symbols (str or list(str)):
A single symbol or a list of symbols to add to the initial LJ list.
add (bool):
Whether or not to replace existing symbols
set_cut_scale(cut_scale)[source]

Sets the amount to scale the sigma values of each pair by to set the cutoff. Warning: setting this will remove any global cutoff, but leave custom cutoffs.

Args:
cut_scale (float):
Scaling factor to be used on sigma
set_global_cutoff(cutoff)[source]

Sets a global cutoff for all pairs. Warning: setting this will remove all other cutoff parameters.

Args:
cutoff (float):
Custom cutoff to use. In Angstroms.
thermo.tools.lj.lb_mixing(a1, a2)[source]

Applies Lorentz-Berthelot mixing rules on two atoms.

Args:
a1 (tuple):
Tuple of (epsilon, sigma)
a2 (tuple):
Tuple of (epsilon, sigma)
thermo.tools.lj.load_UFF()[source]

Loads dictionary that stores relevant LJ from UFF.

Returns:
dict:
Dictionary with atom symbols as the key and a tuple of epsilon and sigma in units of eV and Angstroms, respectively.