Force¶
- class py4vasp.data.Force(raw_data)¶
Bases:
py4vasp.data._trajectory.DataTrajectory
The forces acting on the atoms for selected steps of the simulation.
You can use this class to analyze the forces acting on the atoms. In particular, you can check whether the forces are small at the end of the calculation.
- Parameters
raw_force (RawForce) – Dataclass containing the raw forces and associated structure data.
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()
Attributes Summary
Scaling constant to convert forces to Å.
Methods Summary
from_dict
(dict_)Initialize refinement class from data dictionary
from_file
([file])Read the data dictionary from the given file.
plot
()Visualize the forces showing arrows at the atoms.
print
()Print a string representation of this class to standard output.
read
()Read the forces and associated structural information for one or more selected steps of the trajectory.
to_dict
()Read the forces and associated structural information for one or more selected steps of the trajectory.
Visualize the forces showing arrows at the atoms.
Attributes Documentation
- force_rescale = 1.5¶
Scaling constant to convert forces to Å.
Methods Documentation
- 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
- 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
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.plot()
To select the results for all steps, you don’t specify the array boundaries.
>>> calc.force[:].plot()
You can also select specific steps or a subset of steps as follows
>>> calc.force[5].plot() >>> calc.force[1:6].plot()
- print()¶
Print a string representation of this class to standard output.
- read()¶
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.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()
- 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.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()
- to_viewer3d()¶
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
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.plot()
To select the results for all steps, you don’t specify the array boundaries.
>>> calc.force[:].plot()
You can also select specific steps or a subset of steps as follows
>>> calc.force[5].plot() >>> calc.force[1:6].plot()