Previous Thread
Next Thread
Print Thread
Calculation of Pressure with Periodic Boundaries
#22842 11/20/09 10:29 PM
Joined: Oct 2008
Posts: 22
Forum Member
OP Offline
Forum Member
Joined: Oct 2008
Posts: 22
I was trying to figure out whether or not CHARMM uses a pairwise sum in the virial calculation when periodic boundary conditions are used. Allen and Tildesley say on page 48 of their 1989 "Computer Simulation of Liquids" book that when periodic boundary conditions are used the virial should be calculated using the pairwise SUM(r.ij dot f.ij), not the SUM(r.i dot f.i) form.

When I look at the source/dynamc/prssre.src file to figure out how CHARMM calculates the pressure I am led to the subroutine VIRAL, which seems to calculate the virial as SUM(r.i dot f.i).

1.) Am I looking in the wrong place for pressure calculations with periodic boundary conditions?

2.) Does CHARMM actually use the correct pairwise sum to calculate the virial when periodic boundary conditions are turned on?

Re: Calculation of Pressure with Periodic Boundaries
cranapple #22844 11/21/09 01:00 AM
Joined: Sep 2003
Posts: 8,506
rmv Online Content
Forum Member
Online Content
Forum Member
Joined: Sep 2003
Posts: 8,506
The implementation was tested fairly thoroughly when it was added about 15 years ago. Do you have any results or tests which indicate it is not correct?

A&T don't say one cannot use the SUM(r.i dot f.i) form, only that the pairwise SUM(r.ij dot f.ij) should be used with PBC, but without providing any further explanation or reference. A very good book, but not always the final word on a subject.

The comments in the source code hint that the virial tensor calculation may differ from the scalar form.


Rick Venable
computational chemist

Re: Calculation of Pressure with Periodic Boundaries
rmv #22845 11/21/09 02:21 AM
Joined: Oct 2008
Posts: 22
Forum Member
OP Offline
Forum Member
Joined: Oct 2008
Posts: 22
My mistrust of the SUM(r.i dot f.i) form of the virial in the case of periodic boundary conditions stems from reading this paper:

Manuel J. Louwerse, Evert Jan Baerends, "Calculation of pressure in case of periodic boundary conditions", Chem Phys Lett 421 (2006) 138-141.

and then I went back and read the aforementioned text in Allen and Tildesley.

Re: Calculation of Pressure with Periodic Boundaries
cranapple #22846 11/21/09 05:12 AM
Joined: Sep 2003
Posts: 8,506
rmv Online Content
Forum Member
Online Content
Forum Member
Joined: Sep 2003
Posts: 8,506
The article faults the case for scaling the cell w/o scaling coordinates, but CHARMM does scale the coordinates, so it's not clear the warning applies in this case.


Rick Venable
computational chemist

Re: Calculation of Pressure with Periodic Boundari
rmv #23055 12/10/09 08:57 AM
Joined: Dec 2009
Posts: 1
M
Forum Member
Offline
Forum Member
M
Joined: Dec 2009
Posts: 1
I found this thread by chance and thought I should respond:

In the abovementioned article we show that the SUM(r.i dot f.i) cannot be used in combination with periodic boundaries. period.
The remark about not scaling the coordinates does not mean that the warning is only about that case, but that that is the term that is being missed mathematically. Ofcourse you scale the coordinates!

The point I want to make: yes the warning definitely applies in this case. If you do not believe it: calculate both sums and you will see there is a difference.

Good luck,
Manuel Louwerse

Last edited by mlouwerse; 12/10/09 10:24 AM.
Re: Calculation of Pressure with Periodic Boundari
mlouwerse #23056 12/10/09 08:52 PM
Joined: Sep 2003
Posts: 394
Forum Member
Offline
Forum Member
Joined: Sep 2003
Posts: 394
1. CHARMM does use the single sum, SUM(r.i dot f.i)

2. CHARMM does not use the minimum image convention as is done in most (all?) other programs. Image atoms are treated explicitly, and the single sum internal virial is computed before the image forces are transformed back to primary atoms (in the routine TRANSI). By doing it this way, the single sum virial can be used. It's the same as the double sum...

Note that in order to get an accurate pressures with Verlet type integrator, you need to solve this triangle self consistently :
(pressure -> rate of box change -> velocities -> pressure)
To get good conservation of energy we use on-step velocities, half-step velocities, on-step coordinates, and even half-step coordinates.

Finally...
We get very good total conservation of energy (including piston energies). I believe it is better than what any other program can do. You cannot do it wrong in the manner you suggest and get energy conservation.

Re: Calculation of Pressure with Periodic Boundari
mlouwerse #23066 12/11/09 02:04 AM
Joined: Sep 2003
Posts: 394
Forum Member
Offline
Forum Member
Joined: Sep 2003
Posts: 394
A few more points...

1.
"Ofcourse you scale the coordinates!"

CHARMM allows for both scaling and non-scaling of the coordinates as a options. There are many situations where scaling coordinates is not appropriate. CHARMM uses a general symmetry operator, so we even handle the cases where there is rotational or inversion symmetry (e.g. asymmetric unit cells) and for both finite and infinite (1-D, 2-D, and 3-D). All crystal groups are supported.

2.
Code has been well tested with a "TEST FIRST" command which compares forces and virials with changing box sizes and atom positions using finite differences.

3.
What we lack with our method is the ability to compute pressure profiles in slabs. For example, we cannot calculate pressure changes as a function of the z-coordinate as one goes through a lipid bilayer.

4.
Literature where we've published stuff relating to this discussion:

Pastor RW, Brooks BR, Szabo A. An analysis of the accuracy of Langevin and molecular dynamics algorithms. Molecular Physics. 1989;65(6):1409-1419.

SE Feller, Y Zhang, RW Pastor and BR Brooks. Constant pressure molecular dynamics simulation: The Langevin piston method. J. Chem. Phys. 1995 103(11).

Bogusz S, Cheatham TE, Brooks BR. Removal of pressure and free energy artifacts in charged periodic systems via net charge corrections to the ewald potential. Journal of Chemical Physics. 1998;108(17):7070-84.

BR Brooks, CL Brooks III, AD Mackerell, Jr, L Nilsson, RJ Petrella, B Roux, Y Won, G Archontis, C Bartels, S Boresch, A Caflisch, L Caves, Q Cui, AR Dinner, M Feig, S Fischer, J Gao, M Hodoscek, W Im, K Kuczera, T Lazaridis, J Ma, V Ovchinnikov, E Paci, RW Pastor, CB Post, JZ Pu, M Schaefer, B Tidor, RM Venable, HL Woodcock, X Wu, W Yang, DM York, M Karplus. CHARMM: The Biomolecular Simulation Program. J. Comp. Chem. 2009; 30(10):1545.

You can find active links (both pubmed and journal) to these papers at:
http://www.lobos.nih.gov/cbs/publications.shtml


Moderated by  BRBrooks, lennart, rmv 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 5.6.33-0+deb8u1 Page Time: 0.010s Queries: 28 (0.002s) Memory: 0.9456 MB (Peak: 1.0519 MB) Data Comp: Off Server Time: 2020-10-29 07:59:25 UTC
Valid HTML 5 and Valid CSS