Atoms
- class atomman.Atoms(natoms: Optional[int] = None, atype: Optional[Union[int, Sequence[Sequence[Sequence[Sequence[Sequence[Any]]]]], _SupportsArray[dtype], Sequence[_SupportsArray[dtype]], Sequence[Sequence[_SupportsArray[dtype]]], Sequence[Sequence[Sequence[_SupportsArray[dtype]]]], Sequence[Sequence[Sequence[Sequence[_SupportsArray[dtype]]]]], bool, float, complex, str, bytes, Sequence[Union[bool, int, float, complex, str, bytes]], Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]], Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]], Sequence[Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]]]]] = None, pos: Optional[Union[int, Sequence[Sequence[Sequence[Sequence[Sequence[Any]]]]], _SupportsArray[dtype], Sequence[_SupportsArray[dtype]], Sequence[Sequence[_SupportsArray[dtype]]], Sequence[Sequence[Sequence[_SupportsArray[dtype]]]], Sequence[Sequence[Sequence[Sequence[_SupportsArray[dtype]]]]], bool, float, complex, str, bytes, Sequence[Union[bool, int, float, complex, str, bytes]], Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]], Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]], Sequence[Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]]]]] = None, prop: Optional[dict] = None, model: Optional[Union[str, IOBase, DataModelDict]] = None, safecopy: bool = False, **kwargs)
Bases:
object
Class for representing a collection of atoms.
- class PropertyDict(host: Atoms)
Bases:
OrderedDict
Extends OrderedDict to work with Atoms
- df() DataFrame
Returns a pandas.DataFrame of all atomic properties. Multi-dimensional per-atom data will be converted into multiple table columns.
- extend(value: Union[Atoms, int]) Atoms
Allows additional atoms to be added to the end of the atoms list.
- Parameters:
value (atomman.Atoms or int) – An int value will result in the atoms object being extended by that number of atoms, with all per-atom properties having default values (atype = 1, everything else = 0). For an Atoms value, the current atoms list will be extended by the correct number of atoms and all per-atom properties in value will be copied over. Any properties defined in one Atoms object and not the other will be set to default values.
- Returns:
A new Atoms object containing all atoms and properties of the current object plus the additional atoms.
- Return type:
- model(prop_name: Optional[list] = None, unit: Optional[list] = None, prop_unit: Optional[dict] = None) DataModelDict
Generates a data model for the Atoms object.
- Parameters:
prop_name (list, optional) – The Atoms properties to include. If neither prop_name nor prop_unit are given, all system properties will be included.
unit (list, optional) – Lists the units for each prop_name as stored in the table. For a value of None, no conversion will be performed for that property. If neither unit nor prop_units given, pos will be given in Angstroms and all other values will not be converted.
prop_unit (dict, optional) – dictionary where the keys are the property keys to include, and the values are units to use. If neither unit nor prop_units given, pos will be given in Angstroms and all other values will not be converted.
- Returns:
A JSON/XML data model for the current Atoms object.
- Return type:
DataModelDict.DataModelDict
- prop(key: Optional[str] = None, index: Optional[Union[int, list, slice]] = None, value: Optional[Any] = None, a_id: Optional[int] = None) Optional[Union[list, Atoms, ndarray]]
Accesses the per-atom properties for controlled getting and setting. For getting values, prop() always returns a copy of the underlying data as opposed to the data itself.
- Parameters:
- Returns:
list – If no parameters given, returns a list of all assigned property keys.
atomman.Atoms – If index or a_id is given without value or key, returns a new Atoms instance for the specified atom indices.
numpy.ndarray – If key (and index/a_id) is given without value, returns a copy of the data associated with that property key.
- Raises:
ValueError – If a_id and index are both given, or only value is given.
- prop_atype(key: str, value: Any, atype: Optional[int] = None)
Allows for per-atom properties to be assigned according to Atoms.atypes.
- Parameters:
- Raises:
ValueError – If length of value does not match Atoms.natypes or atype is not in Atoms.atypes.
- property view: PropertyDict
All assigned per-atom properties.
- Type: