VELOCITY
Function
Velocity stores the atoms' velocities and has procedures for manipulating them.
The use of this module is fully explained in chapter 8 of the book A Practical Introduction to the Simulation of Molecular Systems.
Dependencies
Module | Variables |
CONSTANTS | AMUA2PS2_TO_K, AMUA2PS2_TO_KJMOL, AMU_TO_KG, KBOLTZ, MS_TO_APS |
DEFINITIONS | DP |
IO_UNITS | OUTPUT |
RANDOM_NUMBERS | RANDOM_GAUSS |
STATUS | ERROR |
ATOMS | ATMCRD, ATMFIX, ATMMAS, NATOMS, NFIXED, NFREE |
CONSTRAINT | QTETHER |
LINEAR_ALGEBRA | CROSS_PRODUCT, SCHMIDT_ORTHOGONALIZE |
XYZ_IO | XYZ_READ, XYZ_WRITE |
Public Variables
There are two public scalar variables and a single public array variable in this module.
Variable | Type | Size | Purpose |
EKE | Integer | Scalar | The kinetic energy. |
TEMPERATURE | Integer | Scalar | The temperature. |
ATMVEL | Real | (1:3,1:NATOMS) | The atoms' velocites. |
- All scalar variables are initialized to have the value zero at the start of the program and all arrays are
unallocated.
- The array ATMVEL is allocated to have the correct size after a call to VELOCITY_ASSIGN or VELOCITY_READ.
Public Procedures
There are three public subroutines in this module.
Subroutine | Purpose |
VELOCITY_ASSIGN | Assign the velocities to the atoms of a system. |
VELOCITY_READ | Read the velocities from a file. |
VELOCITY_WRITE | Write the velocities out to a file. |
VELOCITY_ASSIGN
Argument | Type | Intent | Optional | Purpose |
TNEEDED | Real | In | No | The temperature at which the velocities are to be assigned. |
REMOVE_TRANSLATION | Logical | In | Yes | The remove translational motion flag. |
PRINT | Logical | In | Yes | A print flag. |
- VELOCITY_ASSIGN assigns the velocities to the atoms randomly from a Maxwell-Boltzmann distribution at a temperature of
TNEEDED. It will then scale the velocities of the atoms so that the instantaneous temperature for the system is
exactly TNEEDED.
- In addition to assigning the velocites, VELOCITY_ASSIGN determines the number of degrees of freedom in the system
which is a quantity necessary for the temperature calculation. By default VELOCITY_ASSIGN determines the number of
degrees of freedom as 3 * NFREE - NPROJECT where NFREE is the number of free atoms and NPROJECT is the number of
translational degrees of freedom for the system as a whole. Wherever possible the subroutine tries to maximize the
value of NPROJECT. To suppress removal of translational motions the argument REMOVE_TRANSLATION should be present
with a value of .FALSE. Note that the presence of REMOVE_TRANSLATION with a value of .TRUE. in cases where
translations cannot be removed (such as if there are fixed atoms or tether constraints) will result in an error.
- If PRINT is present with the value .TRUE. or is absent, information about the velocity assignment is printed on exit
from the subroutine.
VELOCITY_READ
Argument | Type | Intent | Optional | Purpose |
FILE | Character ( Len = * ) | In | No | The file name. |
REMOVE_TRANSLATION | Logical | In | Yes | The remove translational motion flag. |
- VELOCITY_READ reads in the atoms' velocities from a file in XYZ format. In addition to reading in the velocities,
the subroutine also calculates the temperature of the system and sets the number of degrees of freedom using the
same sequence of commands as VELOCITY_ASSIGN (see the description of that subroutine for a fuller discussion).
- VELOCITY_READ is particularly useful for restarting dynamics simulations in a separate job and should be used in
place of VELOCITY_ASSIGN for this purpose.
VELOCITY_WRITE
Argument | Type | Intent | Optional | Purpose |
FILE | Character ( Len = * ) | In | No | The file name. |
- VELOCITY_WRITE writes out the velocities to a file in XYZ format.
Stability
Stable.