LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Mailing List Archives
[lammps-users] the returned integer from extract() method of pair_styles
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lammps-users] the returned integer from extract() method of pair_styles

From: JENEL PETRISOR VATAMANU <u0615401@...222...>
Date: Fri, 10 Nov 2017 03:09:49 +0000

I have a question regarding the returned integer in the extract method of pairs , specifically the variable "dim"  in
void *PairLJCharmmCoulLong::extract(const char *str, int &dim).

For this pair the returned value of dim is 2 for the lj parameters and 0 for the cut offs (as shown below).
---pasted from pair_lj_charmm_coul_long.cpp of lammps' source code:
 void *PairLJCharmmCoulLong::extract(const char *str, int &dim)
   dim = 2;
   if (strcmp(str,"lj14_1") == 0) return (void *) lj14_1;
   if (strcmp(str,"lj14_2") == 0) return (void *) lj14_2;
   if (strcmp(str,"lj14_3") == 0) return (void *) lj14_3;
   if (strcmp(str,"lj14_4") == 0) return (void *) lj14_4;

   dim = 0;
   if (strcmp(str,"implicit") == 0) return (void *) &implicit;
   if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul;

   return NULL;

I examined some functions (such as ppm.cpp) that called the extract( some_char*,dim ) method.
---pasted from pppm.cpp of lammps' source code:
   int itmp = 0;
   double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp);
   if (p_cutoff == NULL)
     error->all(FLERR,"KSpace style is incompatible with Pair style");
  cutoff = *p_cutoff;

In above pasted code the variable &dim from the extract of the pair is stored in itmp however it seems to me that the pppm does not use the itmp any further. 

I haven' yet figured out the &dim variable returned from the extract() of the pairs, and my question is:
For a 'new/custom' defined/codded pair-wise additive pair_style  (call it:"PairACustomBuiltPairCutCoulLong") should the returned int at &dim from the extract method of this pairstyle:
 void *PairACustomBuiltPairCutCoulLong::extract(const char *str, int &dim){...}

be dim=2  for the van der Waals parameters and dim=0 for cut offs? Or what other values should have?

 Thank you.