{
"cells": [
{
"cell_type": "markdown",
"id": "afe7364c",
"metadata": {
"tags": []
},
"source": [
"(sec:coord)=\n",
"\n",
"# Choice of coordinates\n",
"\n",
"A fundamental concept in quantum chemistry is the multi-dimensional potential energy surface (PES). It captures the interplay between the electronic and nuclear degrees of freedom in a system, and stationary points on the PES are important in elucidating molecular conformations and explaining the mechanisms of chemical and photo-chemical reactions. The first- (gradient) and second-order (Hessian) derivatives of the energy with respect to nuclear displacements are key elements in locating these points (minima and transition states) and determining minimum energy reaction pathways. \n",
"\n",
"We will here discuss the choice of coordinates in which these energy derivatives are expressed.\n",
"\n",
"```{figure} ../../img/pes/coordinates.png\n",
"---\n",
"name: coordinates\n",
"width: 600px\n",
"align: center\n",
"---\n",
"```\n",
"\n",
"## Cartesian coordinates\n",
"\n",
"The most straightforward way to define atomic positions is to use a Cartesian reference system and define each atomic position in terms of its $(x,y,z)$-coordinates. In this coordinate system it is very easy to determine the total energy and energy gradient, but this choice is not favorable for geometry optimization because these coordinates are strongly coupled to one another. \n",
"\n",
"## Internal coordinates\n",
"\n",
"A more favorable choice is to work with internal coordinates, such as bond lengths, valence angles and dihedrals. The most well known set of internal coordinates is the Z-matrix, which uses this properties in order to describe the molecular structure. However, using internal coordinates poses two challenges: (1) the choice of coordinates is not unique, and (2) internal coordinates have to be transformed back into Cartesian coordinates to compute the energy and gradient. Several ways of handling these problems are discussed below.\n",
"\n",
"(sec:internal-to-cartesian)=\n",
"## Transforming between coordinate systems\n",
"\n",
"%One common choice of coordinates in molecular structure optimization are the *redundant internal coordinates* (RIC) {cite}`Pulay1992`.\n",
"\n",
"Given the set of internal coordinates $\\mathbf{q}=(q_1,q_2,...,q_{n_q})$, we would like to relate displacements performed in these coordinates to displacements in the $n_x=3N$ Cartesian coordinates $\\mathbf{x}=(x_1,x_2,...,x_{n_x})$ (to simplify, we denoted all Cartesian coordinates by $x$). For this purpose, we define matrix $\\mathbf{B}$ (called the Wilson $\\mathbf{B}$-matrix) {cite}`orcamanual`\n",
"\n",
"$$\n",
" B_{ij} = \\frac{\\partial q_i}{\\partial x_j}\n",
"$$\n",
"\n",
"To determine the changes in $\\mathbf{x}$ as a result of changes performed in $\\mathbf{q}$, we basically need to obtain the inverse relation $\\partial x_j/\\partial q_i$. However, because $\\mathbf{B}$ is generally rectangular and cannot be directly inverted, we first have to construct a square matrix $\\mathbf{G}$\n",
"\n",
"$$\n",
" \\mathbf{G} = \\mathbf{B}\\mathbf{B}^\\mathrm{T} \n",
"$$\n",
"\n",
"If we are using non-redundant internal coordinates, $\\mathbf{G}$ can be inverted directly. However, if the internal coordinates are redundant, some of the rows of $\\mathbf{G}$ will be linearly dependent. In this case, we have to set up and solve an eigenvalue equation that will allow us to separate out the redundancies {cite}`Pulay1992`\n",
"\n",
"$$\n",
" \\mathbf{G} \n",
" \\begin{pmatrix}\n",
" \\mathbf{U} & \\mathbf{R}\n",
" \\end{pmatrix} = \n",
" \\begin{pmatrix}\n",
" \\mathbf{U} & \\mathbf{R}\n",
" \\end{pmatrix} \n",
" \\begin{bmatrix}\n",
" \\boldsymbol{\\Lambda} & 0 \\\\\n",
" 0 & 0\n",
" \\end{bmatrix} \n",
"$$\n",
"\n",
"This equation has $n=3N-6$ (or $3N-5$ for linear molecules) non-zero eigenvalues and $n_q-n$ zero eigenvalues. The non-zero eigenvalues correspond to linearly independent coordinates, while those which are zero identify the redundant ones. Furthermore, the first $n$ eigenvectors contained in the matrix $\\mathbf{U}$ are non-redundant and can be used to define a set of non-redundant coordinates $\\mathbf{s}$:\n",
"\n",
"(eq:coord_nonred)=\n",
"$$\n",
" \\mathbf{s} = \\mathbf{U}^\\mathrm{T} \\mathbf{q} \n",
"$$\n",
"\n",
"The eigenvalue equation can be used to define a generalized inverse matrix $\\mathbf{G}^{-}$:\n",
"\n",
"$$\n",
" \\mathbf{G}^{-} = \n",
" \\begin{pmatrix}\n",
" \\mathbf{U} & \\mathbf{R}\n",
" \\end{pmatrix} \n",
" \\begin{bmatrix}\n",
" \\boldsymbol{\\Lambda}^{-1} & 0 \\\\\n",
" 0\\,\\,\\,\\,\\,\\,\\,\\, & 0\n",
" \\end{bmatrix}\n",
" \\begin{pmatrix}\n",
" \\mathbf{U}^\\mathrm{T}\\\\ \n",
" \\mathbf{R}^\\mathrm{T}\n",
" \\end{pmatrix}\n",
"$$\n",
"\n",
"which, in turn, is used to determine the transformation between Cartesian and internal coordinates displacements {cite}`Wang2016`:\n",
"\n",
"$$\n",
" \\Delta\\mathbf{x} = \\mathbf{B}^\\mathrm{T}\\mathbf{G}^{-}\\Delta\\mathbf{q}\n",
"$$ \n",
"\n",
"In a similar way, the gradient can be transformed from Cartesian to internal coordinates {cite}`orcamanual`:\n",
"\n",
"$$\n",
" \\mathbf{g}_q = \\mathbf{G}^{-}\\mathbf{B}\\mathbf{g}_x \n",
"$$\n",
"\n",
"where we have denoted the gradient in Cartesian coordinates by $\\mathbf{g}_x$ and the gradient in internal coordinates by $\\mathbf{g}_q$. \n",
"\n",
"With these equations we can now transform a displacement in internal coordinates to a displacement in Cartesian coordinates, compute the energy gradient, and transform the gradient back to internal coordinates.\n",
"\n",
"In the case of the Hessian matrix, the transformation to internal coordinates requires the second-order derivatives of $q_i$ with respect to the Cartesian coordinates $x_j$, $x_k$\n",
"\n",
"$$\n",
" B^{(2)}_{ijk} = \\frac{\\partial^2 q_i}{\\partial x_j\\partial x_k}\n",
"$$\n",
"\n",
"These derivatives, together with $\\mathbf{G}^{-}$, the Wilson $\\mathbf{B}$-matrix and gradient are then used to transform the Hessian from Cartesian ($\\mathbf{H}_x$) to internal ($\\mathbf{H}_q$) coordinates\n",
"\n",
"$$\n",
" \\mathbf{H}_q = \\mathbf{G}^{-} \\mathbf{B} \\left[ \\mathbf{H}_x - \\mathbf{g}_q \\mathbf{B}^{(2)}\\right]\\mathbf{B}^\\mathrm{T} \\mathbf{G}^{-\\mathrm{T}}\n",
"$$\n",
"\n",
"After these transformations are carried out, further transformations to related internal coordinates, for example to use $1/R$ instead of $R$ (bond length), are easy to implement, as exemplified for the gradient: Given the gradient in terms of $R$\n",
"\n",
"$$\n",
" g(R) = \\frac{\\mathrm{d} E}{\\mathrm{d}R}\n",
"$$\n",
"\n",
"the transformation to $u=1/R$ is a simple change of variables\n",
"\n",
"$$\n",
" g(u) = \\frac{\\mathrm{d} E}{\\mathrm{d}u}=\\frac{\\mathrm{d} E}{\\mathrm{d}R}\\frac{\\mathrm{d} R}{\\mathrm{d}u} = \\frac{\\mathrm{d} E}{\\mathrm{d}R}\\frac{\\mathrm{d} u^{-1}}{\\mathrm{d}u} = -u^{-2}\\,g(R) = -R^{2} \\,g(R)\n",
"$$\n",
"\n",
"The transformation of the Hessian can be carried out similarly.\n",
"\n",
"\n",
""
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b1aec9b9-6e77-4ba9-a0d2-4ae6e52782dd",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"celltoolbar": "Tags",
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}