Function: Constrain

In computational chemistry and molecular simulations, constraints are often applied to impose certain geometric restrictions on atoms or molecules during optimization or dynamics calculations. The Constrain function, in this context, is used to manage and apply constraints to various atomic coordinates or molecular properties, typically with the aim of fixing certain variables (such as atom positions, bond lengths, angles, etc.) or keeping them within a specified range.

When to Use Constrain? The Constrain function is typically used when you want to fix certain geometric properties during simulations. For example, during geometry optimization, you may wish to keep specific attributes, such as bond lengths or angles, constant. It is also essential in scan tasks, where you may want to fix certain degrees of freedom while scanning parameters like bond lengths or dihedral angles. Additionally, in reaction mechanism studies, certain atoms or bonds can be held in place to ensure they stay within a specific configuration while allowing the rest of the system to relax. Other situations may involve controlling molecular structures for various purposes, such as optimizing systems with constrained variables or studying specific molecular behaviors.

Constrain functions are added in the post-processing section of the `.inp` file.

Explanation of Each Command and Option:

C Command: Fix an Atom

This command fixes the position of atom i in the simulation, meaning its position will not change during the calculation.

Format: C i

Example: C 3

B Command: Fix a Bond Length

This fixes the bond angle between atoms i, j, and k. The angle formed by the bond vectors from j to i and j to k will remain fixed during the simulation.

Format: B i j

Example: B 1 5

A Command: Fix a Bond Angle

This fixes the dihedral angle formed by atoms i, j, k, and l. The torsion angle between these atoms is held constant throughout the simulation.

Format: A i j k

Example: A 2 1 4

D Command: Fix a Dihedral Angle

This fixes the dihedral angle formed by atoms i, j, k, and l. The torsion angle between these atoms is held constant throughout the simulation.

Format: D i j k l

Example: D 1 2 3 6

S Command: Scanning Path

The S command, used only in scan tasks, specifies which internal coordinate (bond length, bond angle, or dihedral angle) will be scanned and defines the starting value, step size, and number of steps.

Format: S i j step steps

Example: S 1 2 0.05 5

Practical Example of Usage:

Imagine you're running a geometry optimization task and you want to hold a specific bond length constant while allowing the rest of the system to relax. You would include the following in your input file:

B 2 5

This ensures that during optimization, the bond length between atoms 2 and 5 is fixed, while the rest of the system undergoes optimization.

Multi-dimensional Scan Example:

If you want to scan both a bond length and an angle, you could include multiple S commands in your input file. For example:

S 1 2 0.05 5

S 2 1 3 10.0 6

This will scan the bond length between atoms 1 and 2, and also scan the bond angle between atoms 1, 2, and 3.

Overall, the Constrain function is crucial when you need to apply geometric restrictions or scanning paths in your simulations. Whether you're fixing atoms, bond lengths, angles, or scanning specific coordinates, this functionality ensures you have the flexibility to control molecular structures during optimization and dynamics tasks.