Constraints
Constraints in MAPLE allow you to impose geometric restrictions on atoms or internal coordinates during optimization, scan, and dynamics calculations. They are specified in the post-processing section of the input file, which follows the coordinate block. Constraint commands fix specific degrees of freedom (atom positions, bond lengths, angles, or dihedrals) at their initial values, while scan commands define coordinate ranges to be systematically explored.
Atom Constraints (C Command)
The C command freezes an atom at its current position. The atom will not move during optimization or dynamics. This is useful for anchoring specific parts of a molecular system, such as fixing a metal center or holding boundary atoms in place.
| Format | Description |
|---|---|
C i |
Fix the position of atom i |
C 3
This freezes atom 3 at its initial Cartesian coordinates. All three spatial components (x, y, z) are held fixed.
You can fix multiple atoms by including multiple C commands:
C 1
C 5
C 12
Bond Constraints (B Command)
The B command fixes the distance between two atoms at its initial value. During optimization, the bond length will remain constant while the rest of the system relaxes.
| Format | Description |
|---|---|
B i j |
Fix the bond distance between atoms i and j |
B 1 5
This constrains the distance between atoms 1 and 5 at whatever value it has in the input geometry.
Angle Constraints (A Command)
The A command fixes the bond angle formed by three atoms. The angle i-j-k (with j as the vertex atom) is held constant during the calculation.
| Format | Description |
|---|---|
A i j k |
Fix the bond angle at vertex atom j between atoms i, j, and k |
A 2 1 4
This constrains the angle formed by atoms 2-1-4 at its initial value.
Dihedral Constraints (D Command)
The D command fixes the dihedral (torsion) angle formed by four atoms. The torsion angle defined by the i-j-k-l atom sequence is held constant throughout the simulation.
| Format | Description |
|---|---|
D i j k l |
Fix the dihedral angle formed by atoms i, j, k, l |
D 1 2 3 6
This constrains the torsion angle along the 1-2-3-6 atom chain at its initial value.
Scan Coordinates (S Command)
The S command defines an internal coordinate to be scanned over a range of values. It is used exclusively with #scan tasks. The scan systematically varies the specified coordinate from its initial value, stepping by a fixed increment for the requested number of steps. Relaxed scans optimize the remaining degrees of freedom at each scan point; rigid scans move the detected connected fragment to satisfy the target coordinate without optimization.
| Coordinate Type | Format | Description |
|---|---|---|
| Bond length | S i j step nsteps |
Scan the distance between atoms i and j |
| Bond angle | S i j k step nsteps |
Scan the angle at vertex j |
| Dihedral angle | S i j k l step nsteps |
Scan the torsion angle along i-j-k-l |
The step parameter specifies the increment per step (in Angstroms for bond lengths, degrees for angles and dihedrals). MAPLE writes the initial point plus each requested step, so one S line produces nsteps + 1 scan points.
S 1 2 0.05 10
This scans the bond length between atoms 1 and 2 over 11 points: the initial geometry plus 10 increments of 0.05 Angstroms.
S 2 1 3 10.0 6
This scans the bond angle at atom 1 (between atoms 2, 1, and 3) over 7 points: the initial angle plus 6 increments of 10 degrees.
Tip
You can define up to three S commands for 1D, 2D, or 3D scans. MAPLE varies all scan coordinates as a Cartesian-product grid across the combined coordinate space.
POST Command
The POST command allows you to load constraint definitions from an external file instead of listing them inline. This is useful when you have a large number of constraints or want to reuse the same constraint set across multiple calculations.
POST /path/to/constraints.txt
The external file should contain constraint commands (one per line) in the same format as inline constraints:
C 1
C 2
B 3 7
A 4 5 6
D 1 2 3 4
Examples
Constrained optimization: freeze atoms and fix a bond
#model = uma
#device = gpu0
#opt(method=lbfgs, level=tight)
0 1
C 0.000000 0.000000 0.000000
C 1.540000 0.000000 0.000000
O 2.340000 1.100000 0.000000
H -0.392000 1.011000 0.000000
H -0.392000 -0.506000 0.875000
H -0.392000 -0.506000 -0.875000
H 1.932000 -0.506000 0.875000
H 1.932000 -0.506000 -0.875000
C 3
B 1 2
Atom 3 (oxygen) is frozen and the C-C bond (atoms 1-2) is held at its initial distance while everything else optimizes.
Constrained optimization: fix a dihedral angle
#model = aimnet2
#device = gpu0
#opt(method=lbfgs)
0 1
C 0.000000 0.000000 0.000000
C 1.540000 0.000000 0.000000
C 2.100000 1.450000 0.000000
C 3.640000 1.450000 0.000000
H -0.392000 1.011000 0.000000
H -0.392000 -0.506000 0.875000
H 1.932000 -0.506000 0.875000
H 1.932000 -0.506000 -0.875000
H 1.700000 1.956000 0.875000
H 1.700000 1.956000 -0.875000
H 4.032000 0.944000 0.875000
H 4.032000 0.944000 -0.875000
H 4.032000 2.461000 0.000000
D 5 1 2 3
The dihedral angle along H(5)-C(1)-C(2)-C(3) is fixed at its initial value while the rest of the geometry relaxes.
1D bond scan
Checked-in MAPLE example: example/scan/C18.inp. The full coordinate block is kept in the source example; the scan command belongs after that coordinate block:
#model=aimnet2nse
#scan(mode=rigid)
#device=gpu0
[XYZ coordinates from example/scan/C18.inp]
S 1 36 0.1 50
Scans the atom 1–36 distance over 51 points: the initial geometry plus 50 increments of 0.1 Angstroms.
2D scan: two distance coordinates
Checked-in MAPLE example: example/scan/da.inp. It defines a two-coordinate relaxed scan with the default L-BFGS method. The long coordinate block is omitted here, but the S commands must remain after it:
#model=ANI-1xnr
#scan
#device=gpu0
[XYZ coordinates from example/scan/da.inp]
S 11 52 -0.1 15
S 14 51 -0.1 15
Each coordinate gives 16 values, producing a 256-point 2D potential energy surface.
Using the POST command for external constraints
#model = uma
#device = gpu0
#opt(method=lbfgs)
XYZ /path/to/molecule.xyz
POST /path/to/constraints.txt
