ParameterList
- class openff.toolkit.typing.engines.smirnoff.parameters.ParameterList(input_parameter_list: list[ParameterType] | None = None)[source]
Parameter list that also supports accessing items by SMARTS string.
Warning
This API is experimental and subject to change.
- __init__(input_parameter_list: list[ParameterType] | None = None)[source]
Initialize a new ParameterList, optionally providing a list of ParameterType objects to initially populate it.
- Parameters:
input_parameter_list – A pre-existing list of ParameterType-based objects. If None, this ParameterList will be initialized empty.
Methods
__init__
([input_parameter_list])Initialize a new ParameterList, optionally providing a list of ParameterType objects to initially populate it.
append
(parameter)Add a ParameterType object to the end of the ParameterList
clear
()Remove all items from list.
copy
()Return a shallow copy of the list.
count
(value, /)Return number of occurrences of value.
extend
(other)Add a ParameterList object to the end of the ParameterList
index
(item[, start, stop])Get the numerical index of a ParameterType object or SMIRKS in this ParameterList.
insert
(index, parameter)Add a ParameterType object as if this were a list
pop
([index])Remove and return item at index (default last).
remove
(value, /)Remove first occurrence of value.
reverse
()Reverse IN PLACE.
sort
(*[, key, reverse])Sort the list in ascending order and return None.
to_list
([discard_cosmetic_attributes])Render this ParameterList to a normal list, serializing each ParameterType object in it to dict.
- append(parameter)[source]
Add a ParameterType object to the end of the ParameterList
- Parameters:
parameter –
- extend(other)[source]
Add a ParameterList object to the end of the ParameterList
- Parameters:
other –
- index(item, start=None, stop=None)[source]
Get the numerical index of a ParameterType object or SMIRKS in this ParameterList. Raises ParameterLookupError if the item is not found.
- Parameters:
item – The parameter or SMIRKS to look up in this ParameterList
start – Unsupported, added to align method signature with list.index
stop – Unsupported, added to align method signature with list.index
- Returns:
index – The index of the found item
- Raises:
ParameterLookupError if SMIRKS pattern is passed in but not found –
- insert(index, parameter)[source]
Add a ParameterType object as if this were a list
- Parameters:
index – The numerical position to insert the parameter at
parameter – The parameter to insert
- to_list(discard_cosmetic_attributes=True)[source]
Render this ParameterList to a normal list, serializing each ParameterType object in it to dict.
- Parameters:
discard_cosmetic_attributes – Whether to discard non-spec attributes of each ParameterType object.
- Returns:
parameter_list (list[dict]) – A serialized representation of a ParameterList, with each ParameterType it contains converted to dict.
- pop(index=-1, /)
Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
- sort(*, key=None, reverse=False)
Sort the list in ascending order and return None.
The sort is in-place (i.e. the list itself is modified) and stable (i.e. the order of two equal elements is maintained).
If a key function is given, apply it once to each list item and sort them, ascending or descending, according to their function values.
The reverse flag can be set to sort in descending order.