Forces

class Forces(configuration)

Class for calculating the forces on the atomic configuration.

Parameters:configuration (MoleculeConfiguration | BulkConfiguration | DeviceConfiguration | SurfaceConfiguration) – Configuration with a calculator that supports forces calculations.
evaluate()
Returns:The atomic forces. The shape of the force matrix is (number_of_atoms, 3).
Return type:PhysicalQuantity with the unit eV / Angstrom
metatext()
Returns:The metatext of the object or None if no metatext is present.
Return type:str | unicode | None
nlprint(stream=None)

Print a string containing an ASCII table useful for plotting the AnalysisSpin object.

Parameters:stream (python stream) – The stream the table should be written to.
Default: NLPrintLogger()
setMetatext(metatext)

Set a given metatext string on the object.

Parameters:metatext (str | unicode | None) – The metatext string that should be set. A value of “None” can be given to remove the current metatext.

Usage Examples

Calculate and print the forces on a water molecule:

# Define elements
elements = [Oxygen, Hydrogen, Hydrogen]

# Define coordinates
cartesian_coordinates = [[  0.0,  -1.70000000e-05,   1.20198000e-01],
                         [  0.0,   7.59572000e-01,  -4.86714000e-01],
                         [  0.0,  -7.59606000e-01,  -4.86721000e-01]]*Angstrom

# Set up configuration
molecule_configuration = MoleculeConfiguration(
    elements=elements,
    cartesian_coordinates=cartesian_coordinates
    )

# define a a calculator
molecule_configuration.setCalculator(LCAOCalculator())

# calculate and print the forces
forces = Forces(molecule_configuration)
forces.nlprint()

forces.py

Notes

To print the data of the Forces, use the method nlprint.