pair_correlation

py4vasp.calculation.pair_correlation

(*args, **kwargs)

The pair-correlation function measures the distribution of atoms.

A pair-correlation function is a statistical measure to describe the spatial distribution of atoms within a system. Specifically, the pair correlation function quantifies the probability density of finding two particles at specific separation distances. This function is helpful in the study of liquids and solids because it acts as a fingerprint of the system that can be compared to X-ray or neutron scattering experiments. Another use case is the detection of specific phases.

Use this class to inspect the pair-correlation function computed by VASP for all pairs of ionic types. You can control how often VASP samples the pair correlation function with the NBLOCK tag. If you want to split your trajectory into multiple subsets include the tag KBLOCK in your INCAR file.

Examples

If you access a method of this class, the result will depend on the blocks that you selected with the [] operator. Without any selection the results from the final block will be used.

>>> calculation.pair_correlation.read()

To select the results for all blocks, you don’t specify the array boundaries.

>>> calculation.pair_correlation[:].read()

You can also select specific blocks or a subset of blocks as follows

>>> calculation.pair_correlation[5].read()
>>> calculation.pair_correlation[1:6].read()

labels

()
Return all possible labels for the selection string.

path

Returns the path from which the output is obtained.

plot

(*args, **kwargs)

Almost same as the to_graph() function.

All arguments will be passed to to_graph. If the to_graph() would produce multiple graphs this method will merge them into a single one.

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

() → dict

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. Some quantities provide additional elements which can be passed as selection for other routines.

Returns

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

to_csv

(

  • *args,
  • filename: str | Path = None,
  • **kwargs

)

Writes the data to a csv file.

Writes out a csv file for data stored in a dataframe generated with the to_frame() method. Useful for creating external plots for further analysis.

If no filename is provided a default filename is deduced from the name of the class.

Note that the filename must be a keyword argument, i.e., you explicitly need to write filename=”name_of_file” because the arguments are passed on to the to_graph() method. Please check the documentation of that method to learn which arguments are allowed.

Parameters

filename: str | Path = None
Name of the csv file which the data is exported to.

to_dict

(selection: str = None) → dict

Read the pair-correlation function and store it in a dictionary.

Parameters

selection: str = None
String specifying which pair-correlation functions are used. Select ‘total’ for the total pair-correlation function or the name of any two ion types (e.g. ‘Sr~Ti’) for a specific pair-correlation function. When no selection is given, all possibilities are read. Separate distinct labels by commas or whitespace. For a complete list of all possible selections, please use
>>> calculation.pair_correlation.labels()

Returns

dict
Contains the labels corresponding to the selection and the associated pair-correlation function for every selected block. Furthermore, the dictionary contains the distances at which the pair-correlation functions are evaluated.

Examples

If you access this method, the result will depend on the blocks of the class that you selected with the [] operator. Without any selection the results from the final block will be used.

>>> calculation.pair_correlation.to_dict()

To select the results for all blocks, you don’t specify the array boundaries.

>>> calculation.pair_correlation[:].to_dict()

You can also select specific blocks or a subset of blocks as follows

>>> calculation.pair_correlation[5].to_dict()
>>> calculation.pair_correlation[1:6].to_dict()

to_frame

(*args, **kwargs) → Dataframe

Convert data to pandas dataframe.

This will first convert use the to_graph() method to convert to a Graph. All arguments are passed to that method. The resulting graph is then converted to a dataframe.

Returns

Dataframe
Pandas dataframe corresponding to data in the graph

to_graph

(selection: str = ’total’) → Graph

Plot selected pair-correlation functions.

Parameters

selection: str = ’total'
String specifying which pair-correlation functions are used. Select ‘total’ for the total pair-correlation function or the name of any two ion types (e.g. ‘Sr~Ti’) for a specific pair-correlation function. When no selection is given, the total pair correlation is used. Separate distinct labels by commas or whitespace. For a complete list of all possible selections, please use
>>> calculation.pair_correlation.labels()

Returns

Graph
The graph plots the pair-correlation function for all selected blocks and ion pairs. Note that the various blocks with the same legend and only different ion combinations use different color schemes.

Examples

If you access this method, the result will depend on the blocks of the class that you selected with the [] operator. Without any selection the results from the final block will be used.

>>> calculation.pair_correlation.to_graph()

To select the results for all blocks, you don’t specify the array boundaries.

>>> calculation.pair_correlation[:].to_graph()

You can also select specific blocks or a subset of blocks as follows

>>> calculation.pair_correlation[5].to_graph()
>>> calculation.pair_correlation[1:6].to_graph()

to_image

(

  • *args,
  • filename = None,
  • **kwargs

)

Read the data and generate an image writing to the given filename.

The filetype is automatically deduced from the filename; possible are common raster (png, jpg) and vector (svg, pdf) formats. If no filename is provided a default filename is deduced from the name of the class and the picture has png format.

Note that the filename must be a keyword argument, i.e., you explicitly need to write filename=”name_of_file” because the arguments are passed on to the to_graph() method. Please check the documentation of that method to learn which arguments are allowed.

to_plotly

(*args, **kwargs)

Produces a graph and convertes it to a plotly figure.

The arguments to this function are passed on to the to_graph() method. Takes the resulting graph and converts it to a plotly figure.