Commit f0512a96 authored by sjplimp's avatar sjplimp
Browse files

git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@3567 f3b2605a-c512-4ea7-a41b-209d697bcdaa
parent 55bfda11
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@ if ($1 == 1) then
  cp dihedral_hybrid.cpp ..
  cp dihedral_multi_harmonic.cpp ..
  cp dihedral_opls.cpp ..
  cp dump_bond.cpp ..
  cp fix_bond_break.cpp ..
  cp fix_bond_create.cpp ..
  cp fix_bond_swap.cpp ..
@@ -74,7 +73,6 @@ if ($1 == 1) then
  cp dihedral_hybrid.h ..
  cp dihedral_multi_harmonic.h ..
  cp dihedral_opls.h ..
  cp dump_bond.h ..
  cp fix_bond_break.h ..
  cp fix_bond_create.h ..
  cp fix_bond_swap.h ..
@@ -118,7 +116,6 @@ else if ($1 == 0) then
  rm ../dihedral_hybrid.cpp
  rm ../dihedral_multi_harmonic.cpp
  rm ../dihedral_opls.cpp
  rm ../dump_bond.cpp
  rm ../fix_bond_break.cpp
  rm ../fix_bond_create.cpp
  rm ../fix_bond_swap.cpp
@@ -157,7 +154,6 @@ else if ($1 == 0) then
  rm ../dihedral_hybrid.h
  rm ../dihedral_multi_harmonic.h
  rm ../dihedral_opls.h
  rm ../dump_bond.h
  rm ../fix_bond_break.h
  rm ../fix_bond_create.h
  rm ../fix_bond_swap.h

src/MOLECULE/dump_bond.cpp

deleted100644 → 0
+0 −140
Original line number Diff line number Diff line
/* ----------------------------------------------------------------------
   LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
   http://lammps.sandia.gov, Sandia National Laboratories
   Steve Plimpton, sjplimp@sandia.gov

   Copyright (2003) Sandia Corporation.  Under the terms of Contract
   DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
   certain rights in this software.  This software is distributed under 
   the GNU General Public License.

   See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */

#include "string.h"
#include "dump_bond.h"
#include "atom.h"
#include "domain.h"
#include "update.h"
#include "error.h"

using namespace LAMMPS_NS;

/* ---------------------------------------------------------------------- */

DumpBond::DumpBond(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg)
{
  if (narg != 5) error->all("Illegal dump bond command");
  if (atom->molecular == 0)
    error->all("Cannot use dump bond with non-molecular system");

  size_one = 3;

  char *str = (char *) "%d %d %d %d";
  int n = strlen(str) + 1;
  format_default = new char[n];
  strcpy(format_default,str);
}

/* ---------------------------------------------------------------------- */

void DumpBond::init()
{
  delete [] format;
  char *str;
  if (format_user) str = format_user;
  else str = format_default;

  int n = strlen(str) + 2;
  format = new char[n];
  strcpy(format,str);
  strcat(format,"\n");

  // open single file, one time only

  if (multifile == 0) openfile();
}

/* ---------------------------------------------------------------------- */

void DumpBond::write_header(int ndump)
{
  if (me == 0) {
    fprintf(fp,"ITEM: TIMESTEP\n");
    fprintf(fp,"%d\n",update->ntimestep);
    fprintf(fp,"ITEM: NUMBER OF BONDS\n");
    fprintf(fp,"%d\n",ndump);
    fprintf(fp,"ITEM: BONDS\n");
  }
}

/* ---------------------------------------------------------------------- */

int DumpBond::count()
{
  index = 0;

  int *num_bond = atom->num_bond;
  int **bond_type = atom->bond_type;
  int **bond_atom = atom->bond_atom;
  int *mask = atom->mask;
  int nlocal = atom->nlocal;

  int i,j,k;

  int m = 0;
  for (i = 0; i < nlocal; i++) {
    if (!(mask[i] & groupbit)) continue;
    for (j = 0; j < num_bond[i]; j++) {
      k = atom->map(bond_atom[i][j]);
      if (k >= 0 && !(mask[k] & groupbit)) continue;
      if (bond_type[i][j] == 0) continue;
      m++;
    }
  }
  return m;
}

/* ---------------------------------------------------------------------- */

int DumpBond::pack()
{
  int *num_bond = atom->num_bond;
  int **bond_type = atom->bond_type;
  int **bond_atom = atom->bond_atom;
  int *tag = atom->tag;
  int *mask = atom->mask;
  int nlocal = atom->nlocal;

  int i,j,k,type,iatom;

  int m = 0;
  for (i = 0; i < nlocal; i++) {
    if (!(mask[i] & groupbit)) continue;
    for (j = 0; j < num_bond[i]; j++) {
      iatom = bond_atom[i][j];
      k = atom->map(iatom);
      if (k >= 0 && !(mask[k] & groupbit)) continue;
      type = bond_type[i][j];
      if (type == 0) continue;
      buf[m++] = type;
      buf[m++] = tag[i];
      buf[m++] = iatom;
    }
  }
  return m;
}

/* ---------------------------------------------------------------------- */

void DumpBond::write_data(int n, double *buf)
{
  int m = 0;
  for (int i = 0; i < n; i++) {
    index++;
    fprintf(fp,format,
	    index, static_cast<int> (buf[m]),
	    static_cast<int> (buf[m+1]), static_cast<int> (buf[m+2]));
    m += size_one;
  }
}

src/MOLECULE/dump_bond.h

deleted100644 → 0
+0 −37
Original line number Diff line number Diff line
/* ----------------------------------------------------------------------
   LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
   http://lammps.sandia.gov, Sandia National Laboratories
   Steve Plimpton, sjplimp@sandia.gov

   Copyright (2003) Sandia Corporation.  Under the terms of Contract
   DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
   certain rights in this software.  This software is distributed under 
   the GNU General Public License.

   See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */

#ifndef DUMP_BOND_H
#define DUMP_BOND_H

#include "dump.h"

namespace LAMMPS_NS {

class DumpBond : public Dump {
 public:
  DumpBond(LAMMPS *, int, char **);
  void init();

 private:
  int index;            // counter for bond output

  void write_header(int);
  int count();
  int pack();
  void write_data(int, double *);
};

}

#endif
+0 −8
Original line number Diff line number Diff line
@@ -85,14 +85,6 @@ DihedralStyle(multi/harmonic,DihedralMultiHarmonic)
DihedralStyle(opls,DihedralOPLS)
#endif

#ifdef DumpInclude
#include "dump_bond.h"
#endif

#ifdef DumpClass
DumpStyle(bond,DumpBond)
#endif

#ifdef FixInclude
#include "fix_bond_break.h"
#include "fix_bond_create.h"