CONSTRAINT
Function
CONSTRAINT handles `soft' constraints in the DYNAMO library.
This module is a new one but it has the same functionality (and more) of the module ENERGY_EXTRA described in chapter 10
of the book A Practical Introduction to the
Simulation of Molecular Systems.
Note that the energy subroutines in this module do not handle second derivatives.
Dependencies
Module | Variables |
CONSTANTS | TO_DEGREES |
DEFINITIONS | DP |
FILES | NEXT_UNIT |
IO_UNITS | OUTPUT |
LINEAR_ALGEBRA | CROSS_PRODUCT |
STATUS | ERROR |
ATOMS | ATMCRD, NATOMS, NFREE |
Public Variables
None that the user is likely to need.
Public Procedures
There are eight public subroutines in this module that users are likely to want to use.
Subroutine | Purpose |
CONSTRAINT_DEFINE | Define a harmonic constraint. |
CONSTRAINT_INITIALIZE | Remove all previously defined harmonic constraints. |
CONSTRAINT_POINT_DEFINE | Define a point for use in a constraint definition. |
CONSTRAINT_PRINT | Print a list of the currently defined constraints. |
CONSTRAINT_WRITING_START | Start writing of constraint data to external files. |
CONSTRAINT_WRITING_STOP | Halt writing of constraint data. |
TETHER_DEFINE | Define a set of tether constraints for some atoms. |
TETHER_INITIALIZE | Remove a previously defined set of tether constraints. |
CONSTRAINT_DEFINE
Argument | Type | Intent | Optional | Purpose |
TYPE | Character ( Len = * ) | In | No | The type of constraint. |
FC | Real | In | No | The harmonic constraint force constant. |
EQ | Real | In | No | The harmonic constraint equilibrium value. |
FILE | Character ( Len = * ) | In | Yes | A file on which to write constraint data. |
PRINT | Logical | In | Yes | A print flag. |
WEIGHTS | Real(:) | In | Yes | A set of weights. |
Error | Meaning |
Unknown constraint type. | The string TYPE is not one of "ANGLE", "DIHEDRAL", "DISTANCE",
"MULTIPLE_DISTANCE" or "TRANSFER". |
The constraint has an invalid number of points. | The number of points defined for the constraint is
invalid. |
I/O Error on constraint data file. | There is a problem with the constraint file. |
The WEIGHTS array has the wrong size. | The size of the WEIGHTS array is not equal to half the number of
points defined for a MULTIPLE_DISTANCE constraint. |
A WEIGHTS array was present with a non-MULTIPLE_DISTANCE constraint. | A WEIGHTS array is only needed for
a MULTIPLE_DISTANCE constraint. |
- CONSTRAINT_DEFINE defines a harmonic constraint. The type of constraint is defined by the argument TYPE which must be
one of the strings "ANGLE", "DIHEDRAL", "DISTANCE", "MULTIPLE_DISTANCE" or "TRANSFER".
- The points used in the constraint definition must have already been defined before a call to
CONSTRAINT_DEFINE. This is done by an appropriate number of calls to the subroutine CONSTRAINT_POINT_DEFINE. Three
points are required for an ANGLE constraint, four for a DIHEDRAL constraint, two for a DISTANCE constraint and three
for a TRANSFER constraint. The number of points in a MULTIPLE_DISTANCE constraint is arbitrary but must be
even. Once the constraint has been defined by CONSTRAINT_DEFINE, all the currently defined constraint points are
forgotten by the module.
- The arguments FC and EQ define the force constant and the equilibrium value for the constraint.
- The argument FILE gives the name of an external file for the constraint. If this argument is present, data for the
constraint will be written to this file at each energy evaluation after a call to CONSTRAINT_WRITING_START. Writing
to the file can be halted by a call to CONSTRAINT_WRITING_STOP. Data is not written for constraints that were defined
without the argument FILE.
- PRINT is a print flag. If it is present with the value .TRUE. or is absent, information about the constraint
definition will be written on leaving the subroutine.
- WEIGHTS is an optional array that is used in the definition of a MULTIPLE_DISTANCE constraint. If it is absent,
weights with a value of one will be used for each of the distances in the constraint. The dimension of WEIGHTS must
be equal to the number of distances in the constraint definition or, equivalently, to half the number of points used
to define the constraint.
- There is no limit to the number of constraints that may be defined and stored in the module.
CONSTRAINT_INITIALIZE
There are no arguments for this subroutine.
- CONSTRAINT_INITIALIZE reinitializes the constraint data structure. This means that all previously defined constraints
are removed.
CONSTRAINT_POINT_DEFINE
Argument | Type | Intent | Optional | Purpose |
SELECTION | Logical(1:NATOMS) | In | No | An atom selection array. |
PRINT | Logical | In | Yes | A print flag. |
WEIGHTS | Real(1:NATOMS) | In | Yes | A set of weights. |
Error | Meaning |
Invalid selection array size. | The array SELECTION does not have a length of NATOMS. |
Invalid weight array size. | The array WEIGHTS does not have a length of NATOMS. |
No atoms have been selected. | All the elements of the array SELECTION are .FALSE.. |
- CONSTRAINT_POINT_DEFINE defines a point for a constraint definition. Any call to CONSTRAINT_DEFINE must be
preceded by an appropriate number of calls to CONSTRAINT_POINT_DEFINE. Each point is a weighted sum of the Cartesian
coordinates of a group of atoms selected in the array SELECTION.
- PRINT is a print flag. If it is present with the value .TRUE. or is absent, information about the point definition
will be written on leaving the subroutine.
- WEIGHTS is an optional array that is used to define the weights in the point definition. If it is absent, weights
with a value of one will be used for each of the atoms in the point definition.
- There is no limit to the number of points that may be defined and stored in the module although all constraints,
except for MULTIPLE_DISTANCE constraints, require four or less points.
CONSTRAINT_PRINT
There are no arguments for this subroutine.
- CONSTRAINT_PRINT prints a list of all currently defined constraints.
CONSTRAINT_WRITING_START
There are no arguments for this subroutine.
- CONSTRAINT_WRITING_START is used to indicate that writing of constraint data to external files is to be started. Data
will be written for all constraints for which external files were defined in their calls to CONSTRAINT_DEFINE.
CONSTRAINT_WRITING_STOP
Argument | Type | Intent | Optional | Purpose |
CLOSE | Logical | In | Yes | The flag for whether to close the external files. |
- CONSTRAINT_WRITING_STOP indicates that writing of constraint data to external files is to be stopped. The default is
to halt writing permanently which is done by closing all the external files. To halt writing temporarily can be
achieved by using the argument CLOSE with the value .FALSE.
TETHER_DEFINE
Argument | Type | Intent | Optional | Purpose |
FORCE_CONSTANT | Real | In | No | The force constant for the tether constraints. |
REFERENCE_STRUCTURE | Real(1:3,1:NATOMS) | In | Yes | The reference structure. |
SELECTION | Logical(1:NATOMS) | In | Yes | An atom selection array. |
Error | Meaning |
The tether constraint reference structure is missing. | No reference structure has been given. |
- TETHER_DEFINE defines harmonic position constraints for a selected group of atoms.
- The argument FORCE_CONSTANT defines the force constant for the constraints. If it is zero or less no tether
constraints are defined and all previously defined tether constraints are removed.
- The argument REFERENCE_STRUCTURE contains the reference structure for the calculation of the constraints. It
must be present if FORCE_CONSTANT has a value of more than zero.
- The argument SELECTION can be used to define the atoms for which constraints are to be calculated. The default is to
define the constraints for all atoms.
TETHER_INITIALIZE
There are no arguments for this subroutine.
- TETHER_INITIALIZE removes a set of previously defined tether constraints.
Stability
The constraint definitions may be changed to take account of the minimum image convention and second derivatives need to
be implemented. Otherwise, stable.