Commit 91edee25 authored by sjplimp's avatar sjplimp Committed by GitHub
Browse files

Merge pull request #186 from akohlmey/small-bugfixes

Collected small bugfixes and enhancements
parents b9d0f96a 5bb85b48
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
# Title: charmm correction map
# DATE: 2016-09-26 CONTRIBUTOR: Robert Latour, latourr@clemson.edu  CITATION: TBA
# Title: charmm22/charmm27 dihedral correction map

#  alanine map, type 1

+1023 −0

File added.

Preview size limit exceeded, changes collapsed.

+1023 −0

File added.

Preview size limit exceeded, changes collapsed.

+218 −201
Original line number Diff line number Diff line
@@ -13,9 +13,9 @@

/* ----------------------------------------------------------------------
   Implementation of the CHARMM CMAP; adds an extra energy term for the
   peptide backbone dihedrals.  The tools/ch2lmp.pl conversion script, which
   generates an extra section in the LAMMPS data file, is needed in order to
   generate the info used by this fix style.
   peptide backbone dihedrals.  The tools/ch2lmp/charmm2lammps.pl
   conversion script, which generates an extra section in the LAMMPS data
   file, is needed in order to generate the info used by this fix style.

   Contributing authors:
   Xiaohu Hu, CMB/ORNL (hux2@ornl.gov)
@@ -27,11 +27,11 @@
   - MacKerell et al., J. Comput. Chem. 25(2004):1400-1415.
 -------------------------------------------------------------------------*/

#include "mpi.h"
#include "math.h"
#include "stdlib.h"
#include "string.h"
#include "stdio.h"
#include <mpi.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "fix_cmap.h"
#include "atom.h"
#include "atom_vec.h"
@@ -622,16 +622,19 @@ double FixCMAP::compute_scalar()

void FixCMAP::read_grid_map(char *cmapfile)
{
  char line[MAXLINE];
  char *chunk;
  char linebuf[MAXLINE];
  char *chunk,*line;
  int i1, i2, i3, i4, i5, i6, j1, j2, j3, j4, j5, j6, counter;

  FILE *fp = fopen(cmapfile,"r");
  FILE *fp = NULL;
  if (comm->me == 0) {
    fp = force->open_potential(cmapfile);
    if (fp == NULL) {
      char str[128];
      sprintf(str,"Cannot open fix cmap file %s",cmapfile);
      error->one(FLERR,str);
    }
  }

  for (int ix1 = 0; ix1 < 6; ix1++)
    for (int ix2 = 0; ix2 < CMAPDIM; ix2++)
@@ -642,8 +645,24 @@ void FixCMAP::read_grid_map(char *cmapfile)
  i1 = i2 = i3 = i4 = i5 = i6 = 0;
  j1 = j2 = j3 = j4 = j5 = j6 = 0;

  while (fgets(line,MAXLINE,fp) != NULL) {
    if (line == "" || line[0] == '#') { ;; }
  int done = 0;

  while (!done) {
    // only read on rank 0 and broadcast to all other ranks
    if (comm->me == 0)
      done = (fgets(linebuf,MAXLINE,fp) == NULL);

    MPI_Bcast(&done,1,MPI_INT,0,world);
    if (done) continue;

    MPI_Bcast(linebuf,MAXLINE,MPI_CHAR,0,world);

    // remove leading whitespace
    line = linebuf;
    while (line && (*line == ' ' || *line == '\t' || *line == '\r')) ++line;

    // skip if empty line or comment
    if (!line || *line =='\n' || *line == '\0' || *line == '#') continue;

    // read in the cmap grid point values
    // NOTE: The order to read the 6 grid maps is HARD-CODED, thus errors
@@ -657,7 +676,6 @@ void FixCMAP::read_grid_map(char *cmapfile)
    // 5. Glycine map
    // 6. Glycine before proline map

    else {
    chunk = strtok(line, " \r\n");
    while (chunk != NULL) {

@@ -747,9 +765,8 @@ void FixCMAP::read_grid_map(char *cmapfile)
      else break;
    }
  }
  }

  fclose(fp);
  if (comm->me == 0) fclose(fp);
}

/* ---------------------------------------------------------------------- */
@@ -956,7 +973,7 @@ void FixCMAP::bc_coeff(double *gs, double *d1gs, double *d2gs, double *d12gs)
      4,-4, 4,-4, 2, 2,-2,-2, 2,-2,-2, 2, 1, 1, 1, 1
    };

  int i, j, k, l, in;
  int i, j, k, in;
  double xx, x[16];

  for (i = 0; i < 4; i++) {
+1 −1
Original line number Diff line number Diff line
/* ----------------------------------------------------------------------
/* -*- c++ -*- ----------------------------------------------------------
   LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
   http://lammps.sandia.gov, Sandia National Laboratories
   Steve Plimpton, sjplimp@sandia.gov
Loading