espressopp.analysis.CMVelocity

Compute and reset (set to zero) the center-of-mass (CM) velocity of the system.

class espressopp.analysis.CMVelocity(system)
Parameters:system (espressopp.System) – system object

Note

CMVelocity can be attached to the integrator. In this case the reset() method is called, so you will reset the CM-velocity every n-th steps.

Methods

compute()

Compute the CM-velocity of the system

Return type:Real3D
reset()

Reset (set to zero) the CM-velocity of the system. Done by computing the CM-velocity of the system and subtracting it then from every particle.

Return type:void

Example of resetting velocity

>>> total_velocity = espressopp.analysis.CMVelocity(system)
>>> total_velocity.reset()

Example of attaching to integrator

>>> # This extension can be attached to integrator
>>> # and run `reset()` every `n-th` steps.
>>> total_velocity = espressopp.analysis.CMVelocity(system)
>>> ext_remove_com = espressopp.integrator.ExtAnalyze(total_velocity, 10)
>>> integrator.addExtension(ext_remove_com)