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(*args, **kwargs)¶
Wrapper around
to_view()
method.This method will visualize the quantity in the structure. Please refer to the
to_view()
method for a documentation of the allowed arguments.- Returns:
A visualization of the quantity within the crystal structure.
- Return type:
View
- 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()
- to_ngl(*args, **kwargs)¶
Convert the view to an NGL widget.
This method wraps the
to_view()
method and converts the resulting View to an NGL widget. Theto_view()
method documents all the possible arguments of this function.- Returns:
A widget to display the structure and other quantities in the unit cell.
- Return type:
NGLWidget
- to_view(supercell=None)¶
Visualize the forces showing arrows at the atoms.
- Parameters:
supercell (int or np.ndarray) – If present the structure is replicated the specified number of times along each direction.
- Returns:
Shows the structure with cell and all atoms adding arrows to the atoms sized according to the strength of the force.
- Return type:
View
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_view()
To select the results for all steps, you don’t specify the array boundaries.
>>> calc.force[:].to_view()
You can also select specific steps or a subset of steps as follows
>>> calc.force[5].to_view() >>> calc.force[1:6].to_view()