Topology¶
- class py4vasp.data.Topology(raw_data)¶
Bases:
py4vasp.data._base.DataBase
This class accesses the topology of the crystal.
At the current stage this only provides access to the name of the atoms in the unit cell, but one could extend it to identify logical units like the octahedra in perovskites
- Parameters
raw_topology (RawTopology) – A dataclass containing the extracted topology information.
Methods Summary
elements
()Extract the element of all atoms.
from_dict
(dict_)Initialize refinement class from data dictionary
from_file
([file])Read the data dictionary from the given file.
Return the type of all ions in the system as string.
names
()Extract the labels of all atoms.
Return the number of atoms in the system.
print
()Print a string representation of this class to standard output.
read
()Read the topology and convert it to a dictionary.
to_dict
()Read the topology and convert it to a dictionary.
to_frame
()Convert the topology to a DataFrame
Convert the topology to a mdtraj.Topology.
to_poscar
([format_newline])Generate the topology lines for the POSCAR file.
Methods Documentation
- elements()¶
Extract the element of all atoms.
- classmethod from_dict(dict_)¶
Initialize refinement class from data dictionary
- Parameters
data_dict (dict) – Data dictionary that contains one or more different raw data sources.
- classmethod from_file(file=None)¶
Read the data dictionary from the given file.
You want to use this method if you want to avoid using the Calculation wrapper, for example because you renamed the output of the VASP calculation.
- Parameters
file (str or Path or raw.File) – Filename from which the data is extracted. If not present the default filename is used. Alternatively, you can open the file yourself and pass the File object. In that case, you need to take care the file is properly closed again and be aware the generated instance of this class becomes unusable after the file is closed.
- Returns
The returned instance handles opening and closing the file for every function called on it, unless a File object in which case this is left to the user.
- Return type
DataBase
- ion_types()¶
Return the type of all ions in the system as string.
- names()¶
Extract the labels of all atoms.
- number_atoms()¶
Return the number of atoms in the system.
- print()¶
Print a string representation of this class to standard output.
- read()¶
Read the topology and convert it to a dictionary.
- Returns
A map from particular labels to the corresponding atom indices. For every atom a single label of the form Element*_*Number (e.g. Sr_1) is constructed. In addition there is a map from atoms of a specific element type to all indices of that element and from atom-indices strings to atom-indices integers. These access strings are used throughout all of the refinement classes.
- Return type
dict
- to_dict()¶
Read the topology and convert it to a dictionary.
- Returns
A map from particular labels to the corresponding atom indices. For every atom a single label of the form Element*_*Number (e.g. Sr_1) is constructed. In addition there is a map from atoms of a specific element type to all indices of that element and from atom-indices strings to atom-indices integers. These access strings are used throughout all of the refinement classes.
- Return type
dict
- to_frame()¶
Convert the topology to a DataFrame
- Returns
The dataframe matches atom label and element type.
- Return type
pd.DataFrame
- to_mdtraj()¶
Convert the topology to a mdtraj.Topology.
- to_poscar(format_newline='')¶
Generate the topology lines for the POSCAR file.
- Parameters
format_newline (str) – If you want to display the POSCAR file in a particular way, you can use an additional string to add formatting.
- Returns
A string used to describe the atoms in the system in the POSCAR file augmented by the additional formatting string, if given.
- Return type
str