Re: Code question: Partitioning the patch contents into water and non-water

From: Floris Buelens (
Date: Mon Sep 10 2007 - 11:00:13 CDT

Hi Vincent and namd users,

Can I ask how you got on with the question below? I'm struggling with something similar and thought you might be interested or have some suggestions... I'd also like to flag up certain interactions for different nonbonded interaction treatment, and I have an implementation that seems almost but not quite there.
I started out trying to replicate the treatment of scaled 1-4 potentials, which are flagged as a subtype of nonbonded exclusion; atom pairs are then sorted into three pairlists (normal, modified and excluded):

      int excl_flag = excl_flags[atom2];
      switch ( excl_flag ) {
      case 0: *(plin++) = j; break;
      case 1: *(plix++) = j; break;
      case 2: *(plim++) = j; break;

..and ComputeNonbondedBase2.h is then called twice to calculate the normal and modified nonbonded potentials. I put some extra stuff in molecule.C to add flagged exclusions for my 'special' atom pairs, then fed this information through to the excl_flags referenced above to sort atoms into new pairlists for case 3, 4 etc, then calculate interactions with different macros defined for each pairlist.
Large parts of this setup seem to work fine but I'm tripping up somewhere... for small test systems, energies are identical to normal for a few 100 steps, then they slowly diverge; for a real system, step 0 energy differs, but only in the vdW term (not electrostatics). The vdW value also changes if I change config file values relating to patch assignment, eg. minatomsperpatch 10000, maxpairpart 1. Also NAMD gets upset about my global exclusion count checksum despite my attempts to add in all the totals from each pairlist.
I assume I've missed something relating to patch assignment - I'd be very grateful for any guesses where I might have gone wrong!
Thanks a lot

Floris Buelens
Department of Crystallography, Birkbeck College, London

----- Original Message ----
From: Vincent Kraeutler <>
Sent: Friday, 17 August, 2007 10:01:24 AM
Subject: namd-l: Code question: Partitioning the patch contents into water and non-water


I'm currently looking into customized water-water interactions. So one
thing I need to do is to partition the atoms contained in a patch into
water and non-water. From what I can tell so far, this seems to be
non-trivial, i.e. it looks like the atoms contained in a given patch
come in no particular order.

I would be deeply grateful if anyone could answer the following questions:

i) Are the atoms in a patch sorted in any particular way? (I think they
are not, but I'm not sure). If so, which one?

ii) If I need to sort the atoms, I suppose it would be best to perform
the sort right after atom migration and before the assignment to compute
objects. Could you suggest where (in the code) I would best do that?
(I'm currently looking at PatchMgr.* and friends with limited success)

iii) How would I go about distinguishing water from non-water atoms? Or
even just solvent from solute atoms? Is there an explicit way to do it,
or would I have to go via topological information?

Thanks & cheers,

Want ideas for reducing your carbon footprint? Visit Yahoo! For Good

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:45:14 CST