[gmx-developers] virial
Jason de Joannis
jdejoan at emory.edu
Thu Jan 11 22:28:14 CET 2007
Okay, the problem is that I am using the mol-shift rather than the
nearest-image-shift (not heeding Erik's earlier warning). The latter
is not stored as an array which is why that part of the virial is
computed as via fshift from the outer kernel loop. Thus an independent
calculation of the virial is not possible because I don't have access to
f_ij.
To provide more clarity on this matter, I suggest in future manuals to
use something like this:
The vector $\textbf{r}_{ij}^k = \textbf{r}_i-\textbf{r}_j+\delta^k$
shall represent the interparticle distance between the $k$th image of
$i$ and the `real' $j$. There are 27 such images for a triclinic cell;
one of these, lets call it $n$, produces the smallest distance (minimum
image). Similarly we shall define the force $\textbf{F}_{ij}^k$ as
equal to the normal interparticle force $\textbf{F}_{ij}$ if $k=n$, but
zero otherwise. This is equivalent to the use of a cutoff that is less
than half the box length. This notation allows us to represent the
image summation explicitely in the virial,
\begin{equation}
\Xi = -\frac{1}{2}\sum_{k=1}^{27}\sum_{i<j}
\textbf{r}_{ij}^k \otimes \textbf{F}_{ij}^k.
\end{equation}
Now we can decouple things as follows,
\begin{eqnarray}
\Xi &=& -\frac{1}{2}\left(
\sum_{k=1}^{27}\sum_{i<j}
(\textbf{r}_i-\textbf{r}_j) \otimes \textbf{F}_{ij}^k
+\sum_{k=1}^{27}\sum_{i<j}
\delta^k \otimes \textbf{F}_{ij}^k
\right) \\
&=& -\frac{1}{2}\left(
\sum_{i<j}(\textbf{r}_i-\textbf{r}_j)
\otimes \sum_{k=1}^{27}\textbf{F}_{ij}^k
+\sum_{k=1}^{27}\delta^k
\otimes \sum_{i<j} \textbf{F}_{ij}^k
\right) \\
&=& -\frac{1}{2}\left(
\sum_{i=1}^N\textbf{r}_i \otimes \textbf{F}_i
+\sum_{k=1}^{27}\delta^k \otimes \textbf{F}^k
\right),
\end{eqnarray}
where the new $\textbf{F}^k$ is defined implicitely.
/Jason
Quoting Jason de Joannis <jdejoan at emory.edu>:
> Hi David,
>
> Yes, I have a rectangular box. The debug file does print out all the fshift
> contributions. But the bottom line is that when these are all totaled
> and compared to the N-particle xshift[i]*f[i] calculation, things
> should match up.
>
> On a related note, but not one likely to resolve this situation, what
> is the meaning of "we must in the implementation double the term
> containing the shift delta-i" on page 182 of the manual? The
> equivalent statement is not present on page 1709 of the Gromacs05
> paper and I don't see the sense of it.
>
> Thanks.
>
> /Jason
>
> Quoting David van der Spoel <spoel at xray.bmc.uu.se>:
>
>> Jason de Joannis wrote:
>>> Let me revive an old topic concerning the fshift correction
>>> to the virial. This term is added up in the calc_vir function and
>>> I believe it is equivalent to the second term in Eq(2) of the 2005
>>> Gromacs paper or Eq. B.11 of the manual. Since that term is
>>> rather simple it should be easy to check with the following snippet
>>> of code:
>>>
>>> clear_mat(virtest);
>>> for (n=start; n<start+homenr; n++)
>>> for (i=0;i<DIM;i++) for (j=0;j<DIM;j++)
>>> virtest[i][j] -= 0.25*box[i][i]*graph->ishift[n][i]*f[n][j];
>>>
>>> Unfortunately I am not getting the same number for the trace of the
>>> virial tensor. Any suggestions would be appreciated.
>>>
>>> /Jason
>>
>> Do you have a rectangular box? Otherwise you need to use box[i][j].
>>
>> Have you run mdrun with -debug? It will print temp variables to mdrun.log.
>>
>> --
>> David.
>> ________________________________________________________________________
>> David van der Spoel, PhD, Assoc. Prof., Molecular Biophysics group,
>> Dept. of Cell and Molecular Biology, Uppsala University.
>> Husargatan 3, Box 596, 75124 Uppsala, Sweden
>> phone: 46 18 471 4205 fax: 46 18 511 755
>> spoel at xray.bmc.uu.se spoel at gromacs.org http://folding.bmc.uu.se
>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>> _______________________________________________
>> gmx-developers mailing list
>> gmx-developers at gromacs.org
>> http://www.gromacs.org/mailman/listinfo/gmx-developers
>> Please don't post (un)subscribe requests to the list. Use the www
>> interface or send it to gmx-developers-request at gromacs.org.
>>
>>
>>
>
>
>
> --
> \ Jason de Joannis \
> \ Emory University \
> \ jdejoan at emory.edu \
> \ 404-402-1332 \
>
>
> _______________________________________________
> gmx-developers mailing list
> gmx-developers at gromacs.org
> http://www.gromacs.org/mailman/listinfo/gmx-developers
> Please don't post (un)subscribe requests to the list. Use the www
> interface or send it to gmx-developers-request at gromacs.org.
>
>
>
--
\ Jason de Joannis \
\ Emory University \
\ jdejoan at emory.edu \
\ 404-402-1332 \
More information about the gromacs.org_gmx-developers
mailing list