NBFIX 1-4 scaling term ignored for CHARMM format parameters

From: Sunhwan Jo (sunhwan_at_uchicago.edu)
Date: Wed Aug 07 2013 - 15:21:33 CDT

Hi,

I'd like to submit a patch in NAMD. I've sent a mail to namd_at_ks.uiuc.edu<mailto:namd_at_ks.uiuc.edu>, also sending this to here as well.

I noticed NAMD ignores 1-4 scaling term in NBFIX when CHARMM format parameters is used. When CHARMM format parameters are used, NAMD expects only 2 terms (epsilon and r_min), whereas official CHARMM parameters can have extra 2 terms for 1-4 scaled vdW (epsilon1-4 and r_min1-4).

I've confirmed this in the source code (src/Parameters.C), which just assign epsilon and r_min to epsilon1-4 and r_min1-4.

I've attached necessary modification below.

[quote]
void Parameters::add_vdw_pair_param(char *buf)
{
  char atom1name[11]; // Atom 1 name
  char atom2name[11]; // Atom 2 name
  Real A; // A value for pair
  Real B; // B value for pair
  Real A14; // A value for 1-4 ints
  Real B14; // B value for 1-4 ints
  Real sqrt26; // 2^(1/6)
  Real epsilon; // epsilon
  int read_count; // count from sscanf
  struct vdw_pair_params *new_node; // new node

  /* Parse up the input line using sscanf */
  if (paramType == paraXplor)
  {
    /* read XPLOR format */
    read_count=sscanf(buf, "%*s %s %s %f %f %f %f\n", atom1name,
       atom2name, &A, &B, &A14, &B14);
  }
  else if (paramType == paraCharmm)
  {
    // XXX CHARMM CAN HAVE 1-4 PARAMETERS TOO!!!
    /* read CHARMM format */
    read_count=sscanf(buf, "%s %s %f %f %f %f\n", atom1name,
       atom2name, &A, &B, &A14, &B14);
  }

  /* Check to make sure we got what we expected */
  if ((read_count != 6) && (paramType == paraXplor))
  {
    char err_msg[512];

    sprintf(err_msg, "BAD vdW PAIR FORMAT IN XPLOR PARAMETER FILE\nLINE=*%s*", buf);
    NAMD_die(err_msg);
  }
  if ( ((read_count != 6) && (read_count != 4)) && (paramType == paraCharmm))
  {
    char err_msg[512];

    sprintf(err_msg, "BAD vdW PAIR FORMAT IN CHARMM PARAMETER FILE\nLINE=*%s*", buf);
    NAMD_die(err_msg);
  }

  if (paramType == paraCharmm)
  {
    // convert CHARMM to XPLOR format
    epsilon=-A;
    sqrt26=pow(2.,(1./6.));
    B=B/sqrt26;
    A=4*epsilon*pow(B,12.);
    B=4*epsilon*pow(B,6.);

    if (read_count == 4)
    {
      A14=A;
      B14=B;
    }
    else
    {
      epsilon=-A14;
      sqrt26=pow(2.,(1./6.));
      B14=B14/sqrt26;
      A14=4*epsilon*pow(B14,12.);
      B14=4*epsilon*pow(B14,6.);
    }
  }

  /* Allocate a new node */
  new_node = new vdw_pair_params;

  if (new_node == NULL)
  {
    NAMD_die("memory allocation failed in Parameters::add_vdw_pair_param\n");
  }

  strcpy(new_node->atom1name, atom1name);
  strcpy(new_node->atom2name, atom2name);

  /* Assign values to this node */
  new_node->A = A;
  new_node->A14 = A14;
  new_node->B = B;
  new_node->B14 = B14;

  new_node->next = NULL;

  /* Add this node to the tree */
  add_to_vdw_pair_list(new_node);

  return;
}
[/quote]

Best,
Sunhwan

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