From 9e12d4de4442984fe4359ad4e39c69835d2fc9fd Mon Sep 17 00:00:00 2001
From: Giovanni Bussi <giovanni.bussi@gmail.com>
Date: Thu, 19 Jun 2014 09:05:49 +0200
Subject: [PATCH] Improved doc for COORDINATION and DHENERGY

---
 src/colvar/Coordination.cpp | 15 +++++++++++----
 src/colvar/DHEnergy.cpp     |  8 ++++++++
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/src/colvar/Coordination.cpp b/src/colvar/Coordination.cpp
index 7f3d0d0f6..797954560 100644
--- a/src/colvar/Coordination.cpp
+++ b/src/colvar/Coordination.cpp
@@ -34,12 +34,19 @@ namespace colvar{
 /*
 Calculate coordination numbers.
 
-This keyword can be used to calculate the coordination numbers for atoms in your system. 
-We use the following switching function to make the coordination number differentiable:
-
+This keyword can be used to calculate the number of contacts between two groups of atoms
+and is defined as
+\f[
+\sum_{i\in A} \sum_{i\in B} s_{ij}
+\f]
+where \f$s_{ij}\f$ is 1 if the contact between atoms \f$i\f$ and \f$j\f$ is formed,
+zero otherwise.
+In practise, \f$s_{ij}\f$ is replaced with a switching function to make it differentiable.
+The default switching function is:
 \f[
-s = \frac{ 1 - \left(\frac{r-d_0}{r_0}\right)^n } { 1 - \left(\frac{r-d_0}{r_0}\right)^m }
+s_{ij} = \frac{ 1 - \left(\frac{{\bf r}_{ij}-d_0}{r_0}\right)^n } { 1 - \left(\frac{{\bf r}_{ij}-d_0}{r_0}\right)^m }
 \f]
+but it can be changed using the optional SWITCH option.
 
 To make your calculation faster you can use a neighbor list, which makes it that only a
 relevant subset of the pairwise distance are calculated at every step.
diff --git a/src/colvar/DHEnergy.cpp b/src/colvar/DHEnergy.cpp
index 024c1c5cf..56d875e2c 100644
--- a/src/colvar/DHEnergy.cpp
+++ b/src/colvar/DHEnergy.cpp
@@ -38,6 +38,14 @@ namespace colvar{
 /*
 Calculate Debye-Huckel interaction energy among GROUPA and GROUPB.
 
+This variable calculates the electrostatic interaction among GROUPA and GROUPB
+using a Debye-Huckel approximation defined as
+\f[
+\frac{1}{4\pi\epsilon_r\epsilon_0}
+\sum_{i\in A} \sum_{j \in B} q_i q_j
+\frac{e^{-\kappa |{\bf r}_{ij}|}}{|{\bf r}_{ij}|}
+\f]
+
 This collective variable can be used to analyze or induce electrostatically driven reactions \cite do13jctc.
 The two atom groups should be disjointed. Notice that the value of the DHENERGY is returned in plumed units (see \ref UNITS).
 
-- 
GitLab