[lammps-users] restart2data for new pair styles

Dear LAMMPS community,

I have written a new pair style for shifted-force lennard-jones. When I attempt to convert my binary restart files with the restart2data tool, I get the error “Unknown pair style” for obvious reasons. I can’t seem to figure out how to edit restart2data to do my new potential, which is equivalent to lj/cut for the purposes of restart2data (same number of arguments, etc).

Is there a better way to get data files from a simulation with a custom pair style? Or is there an easy way to trick restart2data to think lj/sf is the same as lj/cut? Or has someone already done this for shifted-force?

Thank you,

Harold Hatch

Dear LAMMPS community,

I have written a new pair style for shifted-force lennard-jones. When I
attempt to convert my binary restart files with the restart2data tool, I get
the error “Unknown pair style” for obvious reasons. I can’t seem to figure
out how to edit restart2data to do my new potential, which is equivalent to
lj/cut for the purposes of restart2data (same number of arguments, etc).

i don't quite get what is so difficult in making a change like this?

--- restart2data.cpp 2010-03-10 18:05:42.000000000 -0500
+++ restart2data.cpp 2010-03-10 18:07:03.000000000 -0500
@@ -1697,6 +1697,7 @@
       }

   } else if ((strcmp(style,"lj/cut") == 0) ||
+ (strcmp(style,"lj/sf") == 0) ||
      (strcmp(style,"lj/cut/opt") == 0) ||
      (strcmp(style,"lj/cut/coul/cut") == 0) ||
      (strcmp(style,"lj/cut/coul/debye") == 0) ||
@@ -1704,7 +1705,7 @@
      (strcmp(style,"lj/cut/coul/long/tip4p") == 0) ||
      (strcmp(style,"lj/coul") == 0)) {

- if ((strcmp(style,"lj/cut") == 0) || (strcmp(style,"lj/cut/opt") == 0)) {
+ if ((strcmp(style,"lj/cut") == 0) || (strcmp(style,"lj/sf") == 0)

(strcmp(style,"lj/cut/opt") == 0)) {

       m = 0;
       double cut_lj_global = read_double(fp);
       int offset_flag = read_int(fp);
@@ -2716,6 +2717,7 @@
     pair_class2_epsilon[i],pair_class2_sigma[i]);

     } else if ((strcmp(pair_style,"lj/cut") == 0) ||
+ (strcmp(pair_style,"lj/sf") == 0) ||
          (strcmp(pair_style,"lj/cut/opt") == 0) ||
          (strcmp(pair_style,"lj/cut/coul/cut") == 0) ||
          (strcmp(pair_style,"lj/cut/coul/debye") == 0) ||

cheers,
    axel.

restart2data-ljsf.diff (1.09 KB)

Is there a better way to get data files from a simulation with a custom pair style? Or is there an easy way to >trick restart2data to think lj/sf is the same as lj/cut? Or has someone already done this for shifted-force?

Since your pair style writes its name and other params into the binary
restart file,
there is no way for any tool to know how to parse that unless you tell it. That
is why you have to add the correct logic (at a minimum the name of the
new potential)
to tools/restart2data.cpp.

Steve