topology

py4vasp.calculation.topology
class py4vasp.calculation._topology.Topology(data_context, **kwargs)

The topology of the crystal describes the ions of a crystal and their connectivity.

At the current stage, this class only exposes the name of the atoms in the unit cell. In the future, we could add functionality for the user to group multiple atoms. If you are interested in this feature and have a specific use case in mind, please create an issue on Github.

elements()

Extract the element of all atoms.

classmethod from_ase(structure)

Generate a Topology from the given ase Atoms object.

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 instance.

read(*args, **kwargs)

Convenient wrapper around to_dict. Check that function for examples and optional arguments.

selections()

Returns possible alternatives for this particular quantity VASP can produce.

The returned dictionary contains a single item with the name of the quantity mapping to all possible selections. Each of these selection may be passed to other functions of this quantity to select which output of VASP is used.

Returns:

The key indicates this quantity and the values possible choices for arguments to other functions of this quantity.

Return type:

dict

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

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.