force

py4vasp.calculation.force
class py4vasp.calculation._force.Force(*args, **kwargs)

The forces determine the path of the atoms in a trajectory.

You can use this class to analyze the forces acting on the atoms. The forces are the first derivative of the DFT total energy. The forces being small is an important criterion for the convergence of a relaxation calculation. The size of the forces is also related to the maximal time step in MD simulations. When you choose a too large time step, the forces become large and the atoms may move too much in a single step leading to an unstable trajectory. You can use this class to visualize the forces in a trajectory or read the values to analyze them numerically.

Examples

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

>>> calc.force.read()

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

>>> calc.force[:].read()

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

>>> calc.force[5].read()
>>> calc.force[1:6].read()
force_rescale = 1.5

Scaling constant to convert forces to Å.

plot()

Visualize the forces showing arrows at the atoms.

Returns:

Shows the structure with cell and all atoms adding arrows to the atoms sized according to the strength of the force.

Return type:

Viewer3d

Examples

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

>>> calc.force.to_graph()

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

>>> calc.force[:].to_graph()

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

>>> calc.force[5].to_graph()
>>> calc.force[1:6].to_graph()
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_dict()

Read the forces and associated structural information for one or more selected steps of the trajectory.

Returns:

Contains the forces for all selected steps and the structural information to know on which atoms the forces act.

Return type:

dict

Examples

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

>>> calc.force.to_dict()

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

>>> calc.force[:].to_dict()

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

>>> calc.force[5].to_dict()
>>> calc.force[1:6].to_dict()