Skip to main content
← OpenMECP Documentation

calculate_tangent

Function calculate_tangent 

Source
fn calculate_tangent(
    prev: Option<&Geometry>,
    current: &Geometry,
    next: Option<&Geometry>,
) -> Vec<f64>
Expand description

Calculates the tangent vector for NEB path optimization.

The tangent vector defines the local direction of the reaction path at each image. It’s crucial for the NEB method because it determines how spring forces are applied and ensures that true forces don’t interfere with path spacing.

§Theoretical Background

The tangent vector τ̂_i at image i represents the local path direction:

τ̂_i = (path direction at image i) / |path direction|

Different algorithms exist for computing tangents:

  • Simple tangent: τ = R_{i+1} - R_{i-1}
  • Bisector tangent: τ = (R_{i+1} - R_i) + (R_i - R_{i-1})
  • Improved tangent: Energy-weighted combination (not implemented here)

§Algorithm Implementation

§Interior Images (both neighbors exist)

Uses the bisector method:

v_plus = (R_{i+1} - R_i) / |R_{i+1} - R_i|
v_minus = (R_i - R_{i-1}) / |R_i - R_{i-1}|
τ = v_plus + v_minus
τ̂ = τ / |τ|

§Boundary Images (one neighbor missing)

Uses simple difference:

τ = R_neighbor - R_current
τ̂ = τ / |τ|

§Arguments

  • prev - Previous geometry in path (None for first image)
  • current - Current geometry for which to calculate tangent
  • next - Next geometry in path (None for last image)

§Returns

Normalized tangent vector with length 3×N_atoms, representing the path direction in Cartesian coordinate space.

§Tangent Vector Properties

§Normalization

The tangent is always normalized: |τ̂| = 1 This ensures consistent force scaling regardless of path curvature.

§Smoothness

The bisector method provides smoother tangents than simple differences, reducing oscillations in the optimization.

§Boundary Handling

Special treatment for endpoints prevents undefined tangents and maintains proper force directions.

§Mathematical Details

§Vector Operations

  • Subtraction: Component-wise difference between geometries
  • Normalization: Division by Euclidean norm
  • Addition: Component-wise sum for bisector calculation

§Coordinate Representation

The tangent vector contains [dx₁, dy₁, dz₁, dx₂, dy₂, dz₂, …] where (dxᵢ, dyᵢ, dzᵢ) represents the path direction for atom i.

§Applications in NEB

  • Spring force direction: Springs act along τ̂
  • Force projection: True forces projected perpendicular to τ̂
  • Path characterization: Tangent describes local path geometry