Commit 5345ad2d authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

merge in the remainder of the USER-REAXC-OMP code. still a lot of work to do....

merge in the remainder of the USER-REAXC-OMP code. still a lot of work to do. compiles only with -fopenmp active
parent bb890941
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -126,4 +126,5 @@ fi

if (test $1 = "USER-REAXC") then
  depend KOKKOS
  depend USER-OMP
fi
+1300 −0

File added.

Preview size limit exceeded, changes collapsed.

+84 −0
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.
------------------------------------------------------------------------- */

/* ----------------------------------------------------------------------
   Contributing author: Hasan Metin Aktulga, Purdue University
   (now at Lawrence Berkeley National Laboratory, hmaktulga@lbl.gov)

   Please cite the related publication:
   H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama,
   "Parallel Reactive Molecular Dynamics: Numerical Methods and
   Algorithmic Techniques", Parallel Computing, in press.
------------------------------------------------------------------------- */

#ifdef FIX_CLASS

FixStyle(qeq/reax/omp,FixQEqReaxOMP)

#else

#ifndef LMP_FIX_QEQ_REAX_OMP_H
#define LMP_FIX_QEQ_REAX_OMP_H

#include "fix_qeq_reax.h"

namespace LAMMPS_NS {

class FixQEqReaxOMP : public FixQEqReax {

 public:
  FixQEqReaxOMP(class LAMMPS *, int, char **);
  ~FixQEqReaxOMP();
  virtual void init();
  virtual void init_storage();
  virtual void pre_force(int);
  virtual void post_constructor();
  
 protected:
  double **b_temp;

  class PairReaxCOMP *reaxc;

  int do_aspc;
  int aspc_order, aspc_order_max;
  double aspc_omega;
  double * aspc_b;
  
  virtual void pertype_parameters(char*);
  virtual void allocate_storage();
  virtual void deallocate_storage();
  virtual void allocate_matrix();
  virtual void init_matvec();
  virtual void compute_H();

  virtual int CG(double*,double*);
  virtual void sparse_matvec(sparse_matrix*,double*,double*);
  virtual void calculate_Q();
  
  /* virtual double parallel_norm( double*, int ); */
  /* virtual double parallel_dot( double*, double*, int ); */
  /* virtual double parallel_vector_acc( double*, int ); */

  virtual void vector_sum(double*,double,double*,double,double*,int);
  virtual void vector_add(double*, double, double*,int);

  // dual CG support  
  virtual int dual_CG(double*,double*,double*,double*);
  virtual void dual_sparse_matvec(sparse_matrix*,double*,double*,double*);
  virtual void dual_sparse_matvec(sparse_matrix*,double*,double*);
};

}

#endif
#endif
+83 −0
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.
------------------------------------------------------------------------- */

/* ----------------------------------------------------------------------
   Contributing authors: Ray Shan (Sandia, tnshan@sandia.gov)
   			 Oleg Sergeev (VNIIA, sergeev@vniia.ru)
------------------------------------------------------------------------- */

#include "lmptype.h"
#include "stdlib.h"
#include "math.h"
#include "atom.h"
#include "string.h"
#include "fix_ave_atom.h"
#include "fix_reaxc_species_omp.h"
#include "domain.h"
#include "update.h"
#include "pair_reaxc_omp.h"
#include "modify.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "comm.h"
#include "force.h"
#include "compute.h"
#include "input.h"
#include "variable.h"
#include "memory.h"
#include "error.h"
#include "reaxc_list.h"

using namespace LAMMPS_NS;
using namespace FixConst;

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

FixReaxCSpeciesOMP::FixReaxCSpeciesOMP(LAMMPS *lmp, int narg, char **arg) :
  FixReaxCSpecies(lmp, narg, arg)
{
}

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

void FixReaxCSpeciesOMP::init()
{
  if (atom->tag_enable == 0)
    error->all(FLERR,"Cannot use fix reax/c/species unless atoms have IDs");

  reaxc = (PairReaxCOMP *) force->pair_match("reax/c/omp",1);
  if (reaxc == NULL) error->all(FLERR,"Cannot use fix reax/c/species/omp without "
		  "pair_style reax/c/omp");

  reaxc->fixspecies_flag = 1;
  nvalid = update->ntimestep+nfreq;

  // check if this fix has been called twice
  int count = 0;
  for (int i = 0; i < modify->nfix; i++)
    if (strcmp(modify->fix[i]->style,"reax/c/species/omp") == 0) count++;
  if (count > 1 && comm->me == 0)
    error->warning(FLERR,"More than one fix reax/c/species");

  if (!setupflag) {
    // create a compute to store properties
    create_compute();

    // create a fix to point to fix_ave_atom for averaging stored properties
    create_fix();

    setupflag = 1;
  }

}
+44 −0
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.
------------------------------------------------------------------------- */

#ifdef FIX_CLASS

FixStyle(reax/c/species/omp,FixReaxCSpeciesOMP)

#else

#ifndef LMP_FIX_REAXC_SPECIES_OMP_H
#define LMP_FIX_REAXC_SPECIES_OMP_H

#include "pair_reaxc_omp.h"
#include "fix_reaxc_species.h"

#define BUFLEN 1000

namespace LAMMPS_NS {
  
  class FixReaxCSpeciesOMP : public FixReaxCSpecies {
    
  public:
    FixReaxCSpeciesOMP(class LAMMPS *, int, char **);
    ~FixReaxCSpeciesOMP(){};
    virtual void init();
    
  private:
    class PairReaxCOMP *reaxc;
    
  };
}

#endif
#endif
Loading