Unverified Commit 25a4fd47 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer Committed by GitHub
Browse files

Merge pull request #1262 from evoyiatzis/evoyiatzis-patch-1

Addition of extract() method for class2 pair potentials
parents dd668860 96eb0ad5
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "pair_lj_class2.h"
#include "atom.h"
#include "comm.h"
@@ -394,3 +395,13 @@ double PairLJClass2::single(int /*i*/, int /*j*/, int itype, int jtype, double r
    offset[itype][jtype];
  return factor_lj*philj;
}

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

void *PairLJClass2::extract(const char *str, int &dim)
{
  dim = 2;
  if (strcmp(str,"epsilon") == 0) return (void *) epsilon;
  if (strcmp(str,"sigma") == 0) return (void *) sigma;
  return NULL;
}
+1 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ class PairLJClass2 : public Pair {
  void write_data(FILE *);
  void write_data_all(FILE *);
  double single(int, int, int, int, double, double, double, double &);
  void *extract(const char *, int &);

 protected:
  double cut_global;
+14 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "pair_lj_class2_coul_cut.h"
#include "atom.h"
#include "comm.h"
@@ -466,3 +467,16 @@ double PairLJClass2CoulCut::single(int i, int j, int itype, int jtype,

  return eng;
}

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

void *PairLJClass2CoulCut::extract(const char *str, int &dim)
{
  dim = 0;
  if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul;
  dim = 2;
  if (strcmp(str,"epsilon") == 0) return (void *) epsilon;
  if (strcmp(str,"sigma") == 0) return (void *) sigma;
  return NULL;
}
+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ class PairLJClass2CoulCut : public Pair {
  void write_data(FILE *);
  void write_data_all(FILE *);
  double single(int, int, int, int, double, double, double, double &);
  void *extract(const char *, int &);

 protected:
  double cut_lj_global,cut_coul_global;
+3 −0
Original line number Diff line number Diff line
@@ -549,5 +549,8 @@ void *PairLJClass2CoulLong::extract(const char *str, int &dim)
{
  dim = 0;
  if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul;
  dim = 2;
  if (strcmp(str,"epsilon") == 0) return (void *) epsilon;
  if (strcmp(str,"sigma") == 0) return (void *) sigma;
  return NULL;
}