RE: TclForces and efficient PBC corrections

From: Morgan, Brittany (
Date: Wed Nov 13 2013 - 10:31:31 CST


Thank you very much for the suggestion to use modulus - far fewer calculations than the way I had been doing it. Between that and using curly braces with all expr evaluations, I've gotten an 8x increase in my speed.

For any who might be interested, the function to use in Tcl is fmod(x,y).

Brittany Morgan

From: Norman Geist []
Sent: Tuesday, November 12, 2013 2:19 AM
To: Morgan, Brittany
Cc: Namd Mailing List
Subject: AW: namd-l: TclForces and efficient PBC corrections

1. I donít think so.

2. To get the clostest periodic distance between two atoms I usually do (pseudo code):

$xd = pmodulo($x1-$x2+$boxX/2,$boxX) - $boxX/2
$yd = pmodulo($y1-$y2+$boxY/2,$boxY) - $boxY/2
$zd = pmodulo($z1-$z2+$boxZ/2,$boxZ) - $boxZ/2
$dist = sqrt(pow($xd,2) + pow($yd,2) + pow($zd,2))

Make sure to use the pmodulo ďpositive arithmetic remainderĒ, standard module canít do negative numbers.

3. IMHO tcl donít mind. Check if you can improve parts of your script.

Norman Geist.

Von: [] Im Auftrag von Morgan, Brittany
Gesendet: Montag, 11. November 2013 19:03
Betreff: namd-l: TclForces and efficient PBC corrections

Hi All,

I use TclForces and I need to correct for periodic boundary conditions. I have procedures which correct for PBC brute force, but I'm having serious performance issues when I turn them on (the time required more than doubles).

Can anyone tell me if:
1. For the scalar distance, does "getbond <coor1> <coor2>" return a distance corrected for periodic boundary conditions?

2. Is there a built-in way to obtain the vector distance between two positions, corrected for periodic boundary conditions? Or does anyone know of a resource for doing more efficient calculations in Tcl?

3. Is the IBVERBS version of charmrun faster when using TclForces?

I didn't have serious performance issues with my PBC corrections previously, but I've recently started working on a new cluster and this problem has appeared. Previously, I was using NAMD 2.9b2, but IBVERBS is not currently working on the new cluster. I've been using NAMD 2.9-multicore instead.

Any suggestions would be much appreciated.

Brittany Morgan

This archive was generated by hypermail 2.1.6 : Wed Dec 31 2014 - 23:21:54 CST