~ubuntu-branches/debian/sid/lammps/sid

« back to all changes in this revision

Viewing changes to src/MOLECULE/dihedral_charmm.cpp

  • Committer: Package Import Robot
  • Author(s): Anton Gladky
  • Date: 2013-11-20 22:41:36 UTC
  • mfrom: (1.2.2)
  • Revision ID: package-import@ubuntu.com-20131120224136-tzx7leh606fqnckm
Tags: 0~20131119.git7162cf0-1
* [e65b919] Imported Upstream version 0~20131119.git7162cf0
* [f7bddd4] Fix some problems, introduced by upstream recently.
* [3616dfc] Use wrap-and-sort script.
* [7e92030] Ignore quilt dir

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
 
39
39
/* ---------------------------------------------------------------------- */
40
40
 
41
 
DihedralCharmm::DihedralCharmm(LAMMPS *lmp) : Dihedral(lmp) {}
 
41
DihedralCharmm::DihedralCharmm(LAMMPS *lmp) : Dihedral(lmp)
 
42
{
 
43
  weightflag = 0;
 
44
  writedata = 1;
 
45
}
42
46
 
43
47
/* ---------------------------------------------------------------------- */
44
48
 
331
335
  // arbitrary phase angle shift could be allowed, but would break
332
336
  //   backwards compatibility and is probably not needed
333
337
 
334
 
  double k_one = force->numeric(arg[1]);
335
 
  int multiplicity_one = force->inumeric(arg[2]);
336
 
  int shift_one = force->inumeric(arg[3]);
337
 
  double weight_one = force->numeric(arg[4]);
 
338
  double k_one = force->numeric(FLERR,arg[1]);
 
339
  int multiplicity_one = force->inumeric(FLERR,arg[2]);
 
340
  int shift_one = force->inumeric(FLERR,arg[3]);
 
341
  double weight_one = force->numeric(FLERR,arg[4]);
338
342
 
339
343
  if (multiplicity_one < 0)
340
344
    error->all(FLERR,"Incorrect multiplicity arg for dihedral coefficients");
341
345
  if (weight_one < 0.0 || weight_one > 1.0)
342
346
    error->all(FLERR,"Incorrect weight arg for dihedral coefficients");
 
347
  if (weight_one > 0.0) weightflag=1;
343
348
 
344
349
  int count = 0;
345
350
  for (int i = ilo; i <= ihi; i++) {
365
370
  // insure use of CHARMM pair_style if any weight factors are non-zero
366
371
  // set local ptrs to LJ 14 arrays setup by Pair
367
372
 
368
 
  weightflag = 0;
369
 
  for (int i = 1; i <= atom->ndihedraltypes; i++)
370
 
    if (weight[i] > 0.0) weightflag = 1;
371
 
 
372
373
  if (weightflag) {
373
374
    int itmp;
374
375
    if (force->pair == NULL)
394
395
  fwrite(&multiplicity[1],sizeof(int),atom->ndihedraltypes,fp);
395
396
  fwrite(&shift[1],sizeof(int),atom->ndihedraltypes,fp);
396
397
  fwrite(&weight[1],sizeof(double),atom->ndihedraltypes,fp);
 
398
  fwrite(&weightflag,sizeof(int),1,fp);
397
399
}
398
400
 
399
401
/* ----------------------------------------------------------------------
409
411
    fread(&multiplicity[1],sizeof(int),atom->ndihedraltypes,fp);
410
412
    fread(&shift[1],sizeof(int),atom->ndihedraltypes,fp);
411
413
    fread(&weight[1],sizeof(double),atom->ndihedraltypes,fp);
 
414
    fread(&weightflag,sizeof(int),1,fp);
412
415
  }
413
416
  MPI_Bcast(&k[1],atom->ndihedraltypes,MPI_DOUBLE,0,world);
414
417
  MPI_Bcast(&multiplicity[1],atom->ndihedraltypes,MPI_INT,0,world);
415
418
  MPI_Bcast(&shift[1],atom->ndihedraltypes,MPI_INT,0,world);
416
419
  MPI_Bcast(&weight[1],atom->ndihedraltypes,MPI_DOUBLE,0,world);
 
420
  MPI_Bcast(&weightflag,1,MPI_INT,0,world);
417
421
 
418
422
  for (int i = 1; i <= atom->ndihedraltypes; i++) {
419
423
    setflag[i] = 1;
421
425
    sin_shift[i] = sin(MY_PI*shift[i]/180.0);
422
426
  }
423
427
}
 
428
 
 
429
/* ----------------------------------------------------------------------
 
430
   proc 0 writes to data file
 
431
------------------------------------------------------------------------- */
 
432
 
 
433
void DihedralCharmm::write_data(FILE *fp)
 
434
{
 
435
  for (int i = 1; i <= atom->ndihedraltypes; i++)
 
436
    fprintf(fp,"%d %g %d %d %g\n",i,k[i],multiplicity[i],shift[i],weight[i]);
 
437
}
 
438