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

Merge pull request #2132 from akohlmey/collected-bugfixes-and-updates

Collected bugfixes and updates
parents 3b1219f0 01662925
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ An alphabetic list of all general LAMMPS commands.
   * :doc:`package <package>`
   * :doc:`pair_coeff <pair_coeff>`
   * :doc:`pair_modify <pair_modify>`
   * :doc:`pair_style <pair_style>`
   * :doc:`pair_write <pair_write>`
   * :doc:`partition <partition>`
   * :doc:`prd <prd>`
+3 −2
Original line number Diff line number Diff line
@@ -57,6 +57,8 @@
------------------------------------------------------------------------- */

#include "kim_init.h"
#include "fix_store_kim.h"
#include "kim_units.h"
#include <cstring>
#include <string>
#include <sstream>
@@ -71,8 +73,7 @@
#include "input.h"
#include "variable.h"
#include "citeme.h"
#include "fix_store_kim.h"
#include "kim_units.h"
#include "utils.h"

extern "C" {
#include "KIM_SimulatorHeaders.h"
+1 −1
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ FixPlumed::FixPlumed(LAMMPS *lmp, int narg, char **arg) :
    error->all(FLERR,"Incompatible API version for PLUMED in fix plumed. "
               "Only Plumed 2.4.x, 2.5.x, and 2.6.x are tested and supported.");

#if !defined(MPI_STUBS)
  // If the -partition option is activated then enable
  // inter-partition communication

@@ -108,7 +109,6 @@ FixPlumed::FixPlumed(LAMMPS *lmp, int narg, char **arg) :
  // whereas if partitions are not defined then world is equal to
  // MPI_COMM_WORLD.

#if !defined(MPI_STUBS)
  // plumed does not know about LAMMPS using the MPI STUBS library and will
  // fail if this is called under these circumstances
  p->cmd("setMPIComm",&world);
+101 −109
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <string>
#include "atom.h"
#include "force.h"
#include "update.h"
@@ -34,6 +35,7 @@
#include "kspace.h"
#include "math_const.h"
#include "utils.h"
#include "fmt/format.h"

using namespace LAMMPS_NS;
using namespace FixConst;
@@ -98,58 +100,71 @@ FixQBMSST::FixQBMSST(LAMMPS *lmp, int narg, char **arg) :
  while (iarg < narg) {
    if (strcmp(arg[iarg],"q") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command");
      qmass = atof(arg[iarg+1]); if (qmass < 0.0) error->all(FLERR,"Fix qbmsst qmass must be >= 0.0");
      qmass = force->numeric(FLERR,arg[iarg+1]);
      if (qmass < 0.0) error->all(FLERR,"Fix qbmsst qmass must be >= 0.0");
      iarg += 2;
    } else if (strcmp(arg[iarg],"mu") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command");
      mu = atof(arg[iarg+1]); if (mu < 0.0) error->all(FLERR,"Fix qbmsst mu must be >= 0.0");
      mu = force->numeric(FLERR,arg[iarg+1]);
      if (mu < 0.0) error->all(FLERR,"Fix qbmsst mu must be >= 0.0");
      iarg += 2;
    } else if (strcmp(arg[iarg],"p0") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command");
      p0 = atof(arg[iarg+1]); if (p0 < 0.0) error->all(FLERR,"Fix qbmsst p0 must be >= 0.0");
      p0 = force->numeric(FLERR,arg[iarg+1]);
      if (p0 < 0.0) error->all(FLERR,"Fix qbmsst p0 must be >= 0.0");
      p0_set = 1;
      iarg += 2;
    } else if (strcmp(arg[iarg],"v0") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command");
      v0 = atof(arg[iarg+1]); if (v0 < 0.0) error->all(FLERR,"Fix qbmsst v0 must be >= 0.0");
      v0 = force->numeric(FLERR,arg[iarg+1]);
      if (v0 < 0.0) error->all(FLERR,"Fix qbmsst v0 must be >= 0.0");
      v0_set = 1;
      iarg += 2;
    } else if (strcmp(arg[iarg],"e0") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command");
      e0 = atof(arg[iarg+1]);
      e0 = force->numeric(FLERR,arg[iarg+1]);
      e0_set = 1;
      iarg += 2;
    } else if (strcmp(arg[iarg],"tscale") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command");
      tscale = atof(arg[iarg+1]); if (tscale < 0.0 || tscale > 1.0) error->all(FLERR,"Fix qbmsst tscale must satisfy 0 <= tscale < 1");
      tscale = force->numeric(FLERR,arg[iarg+1]);
      if (tscale < 0.0 || tscale > 1.0) error->all(FLERR,"Fix qbmsst tscale must satisfy 0 <= tscale < 1");
      iarg += 2;
    } else if (strcmp(arg[iarg],"damp") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command");
      t_period = atof(arg[iarg+1]); if (t_period <= 0.0) error->all(FLERR,"Fix qbmsst damp must be > 0.0"); fric_coef = 1/t_period;
      t_period = force->numeric(FLERR,arg[iarg+1]);
      if (t_period <= 0.0) error->all(FLERR,"Fix qbmsst damp must be > 0.0");
      fric_coef = 1/t_period;
      iarg += 2;
    } else if (strcmp(arg[iarg],"seed") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command");
      seed = atof(arg[iarg+1]); if (seed <= 0) error->all(FLERR,"Fix qbmsst seed must be a positive integer");
      seed = force->inumeric(FLERR,arg[iarg+1]);
      if (seed <= 0) error->all(FLERR,"Fix qbmsst seed must be a positive integer");
      iarg += 2;
    } else if (strcmp(arg[iarg],"f_max") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command");
      f_max = atof(arg[iarg+1]); if (f_max <= 0) error->all(FLERR,"Fix qbmsst f_max must be > 0.0");
      f_max = force->numeric(FLERR,arg[iarg+1]);
      if (f_max <= 0) error->all(FLERR,"Fix qbmsst f_max must be > 0.0");
      iarg += 2;
    } else if (strcmp(arg[iarg],"N_f") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command");
      N_f = atof(arg[iarg+1]); if (N_f <= 0) error->all(FLERR,"Fix qbmsst N_f must be a positive integer");
      N_f = force->inumeric(FLERR,arg[iarg+1]);
      if (N_f <= 0) error->all(FLERR,"Fix qbmsst N_f must be a positive integer");
      iarg += 2;
    } else if (strcmp(arg[iarg],"eta") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command");
      eta = atof(arg[iarg+1]); if (eta <= 0) error->all(FLERR,"Fix qbmsst eta must be >= 0.0");
      eta = force->numeric(FLERR,arg[iarg+1]);
      if (eta <= 0) error->all(FLERR,"Fix qbmsst eta must be >= 0.0");
      iarg += 2;
    } else if (strcmp(arg[iarg],"beta") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command");
      beta = atof(arg[iarg+1]); if (beta <= 0) error->all(FLERR,"Fix qbmsst beta must be a positive integer");
      beta = force->inumeric(FLERR,arg[iarg+1]);
      if (beta <= 0) error->all(FLERR,"Fix qbmsst beta must be a positive integer");
      iarg += 2;
    } else if (strcmp(arg[iarg],"T_init") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command");
      t_init = atof(arg[iarg+1]); if (t_init <= 0) error->all(FLERR,"Fix qbmsst T_init must be >= 0.0");
      t_init = force->numeric(FLERR,arg[iarg+1]);
      if (t_init <= 0) error->all(FLERR,"Fix qbmsst T_init must be >= 0.0");
      iarg += 2;
    } else error->all(FLERR,"Illegal fix qbmsst command");
  }
@@ -157,48 +172,32 @@ FixQBMSST::FixQBMSST(LAMMPS *lmp, int narg, char **arg) :
  // check for periodicity in controlled dimensions
  if (domain->nonperiodic) error->all(FLERR,"Fix qbmsst requires a periodic box");

  maxexchange = 6*N_f+3;

  // comments
  if (comm->me == 0) {
    if (screen) {
      fprintf(screen,"QBMSST parameters:\n");
      if (direction == 0) fprintf(screen,"  Shock in x direction\n");
      else if (direction == 1) fprintf(screen,"  Shock in y direction\n");
      else if (direction == 2) fprintf(screen,"  Shock in z direction\n");

      fprintf(screen,"  Cell mass-like parameter qmass (units of mass^2/length^4) = %12.5e\n", qmass);
      fprintf(screen,"  Shock velocity = %12.5e\n", velocity);
      fprintf(screen,"  Artificial viscosity (units of mass/length/time) = %12.5e\n", mu);
    std::string msg = "QBMSST parameters:\n";

      if (p0_set)
        fprintf(screen,"  Initial pressure specified to be %12.5e\n", p0);
      else fprintf(screen,"  Initial pressure calculated on first step\n");
      if (v0_set)
        fprintf(screen,"  Initial volume specified to be %12.5e\n", v0);
      else fprintf(screen,"  Initial volume calculated on first step\n");
      if (e0_set)
        fprintf(screen,"  Initial energy specified to be %12.5e\n", e0);
      else fprintf(screen,"  Initial energy calculated on first step\n");
    }
    if (logfile) {
      fprintf(logfile,"QBMSST parameters:\n");
      if (direction == 0) fprintf(logfile,"  Shock in x direction\n");
      else if (direction == 1) fprintf(logfile,"  Shock in y direction\n");
      else if (direction == 2) fprintf(logfile,"  Shock in z direction\n");
    if (direction == 0)      msg += "  Shock in x direction\n";
    else if (direction == 1) msg += "  Shock in y direction\n";
    else if (direction == 2) msg += "  Shock in z direction\n";

      fprintf(logfile,"  Cell mass-like parameter qmass (units of mass^2/length^4) = %12.5e\n", qmass);
      fprintf(logfile,"  Shock velocity = %12.5e\n", velocity);
      fprintf(logfile,"  Artificial viscosity (units of mass/length/time) = %12.5e\n", mu);
    msg += fmt::format("  Cell mass-like parameter qmass "
                       "(units of mass^2/length^4) = {:12.5e}\n", qmass);
    msg += fmt::format("  Shock velocity = {:12.5e}\n", velocity);
    msg += fmt::format("  Artificial viscosity (units of "
                       "mass/length/time) = {:12.5e}\n", mu);

    if (p0_set)
        fprintf(logfile,"  Initial pressure specified to be %12.5e\n", p0);
      else fprintf(logfile,"  Initial pressure calculated on first step\n");
      msg += fmt::format("  Initial pressure specified to be {:12.5e}\n", p0);
    else msg += "  Initial pressure calculated on first step\n";
    if (v0_set)
        fprintf(logfile,"  Initial volume specified to be %12.5e\n", v0);
      else fprintf(logfile,"  Initial volume calculated on first step\n");
      msg += fmt::format("  Initial volume specified to be {:12.5e}\n", v0);
    else msg += "  Initial volume calculated on first step\n";
    if (e0_set)
        fprintf(logfile,"  Initial energy specified to be %12.5e\n", e0);
      else fprintf(logfile,"  Initial energy calculated on first step\n");
    }
      msg += fmt::format("  Initial energy specified to be {:12.5e}\n", e0);
    else msg += "  Initial energy calculated on first step\n";
    utils::logmesg(lmp,msg);
  }

  // create a new compute temp style
@@ -363,14 +362,17 @@ void FixQBMSST::init()

  //set up the h time step for updating the random force \delta{}h=\frac{\pi}{\Omega_{max}}
  if (int(1.0/(2*f_max*dtv)) == 0) {
    if (comm->me == 0) printf ("Warning: Either f_max is too high or the time step is too big, setting f_max to be 1/timestep!\n");
    if (comm->me == 0) error->warning(FLERR,"Either f_max is too high or the time step "
                                      "is too big, setting f_max to be 1/timestep!\n");
    h_timestep=dtv;
    alpha=1;
  } else {
    alpha=int(1.0/(2*f_max*dtv));
    h_timestep=alpha*dtv;
  }
  if (comm->me == 0) printf ("The effective maximum frequncy is now %f inverse time unit with alpha value as %d!\n", 0.5/h_timestep, alpha);
  if (comm->me == 0 && screen)
    fmt::print(screen,"The effective maximum frequency is now {} inverse time unit "
               "with alpha value as {}!\n", 0.5/h_timestep, alpha);

  //gfactor is the random force \sqrt{\frac{2\gamma{}m_{i}}{\alpha*\delta{}t}}, \sqrt{12} makes the random array variance equal to unit.
  for (int i = 1; i <= atom->ntypes; i++) {
@@ -432,20 +434,16 @@ void FixQBMSST::setup(int /*vflag*/)
  if ( v0_set == 0 ) {
    v0 = compute_vol();
    v0_set = 1;
    if (comm->me == 0) {
      if ( screen ) fprintf(screen,"Fix QBMSST v0 = %12.5e\n", v0);
      if ( logfile ) fprintf(logfile,"Fix QBMSST v0 = %12.5e\n", v0);
    }
    if (comm->me == 0)
      utils::logmesg(lmp,fmt::format("Fix QBMSST v0 = {:12.5e}\n", v0));
  }

  if ( p0_set == 0 ) {
    p0 = p_current[direction];
    p0_set = 1;

    if ( comm->me == 0 ) {
      if ( screen ) fprintf(screen,"Fix QBMSST p0 = %12.5e\n", p0);
      if ( logfile ) fprintf(logfile,"Fix QBMSST p0 = %12.5e\n", p0);
    }
    if ( comm->me == 0 )
      utils::logmesg(lmp,fmt::format("Fix QBMSST p0 = {:12.5e}\n", p0));
  }

  if ( e0_set == 0 ) {
@@ -453,11 +451,8 @@ void FixQBMSST::setup(int /*vflag*/)
    e0_set = 1;
    old_eavg = e0;

    if ( comm->me == 0 ) {
      if ( screen ) fprintf(screen,"Fix QBMSST e0 = to be %12.5e\n",e0);
      if ( logfile ) fprintf(logfile,"Fix QBMSST e0 = to be %12.5e\n",e0);
    }

    if ( comm->me == 0 )
      utils::logmesg(lmp,fmt::format("Fix QBMSST e0 = to be {:12.5e}\n",e0));
  }

  temperature->compute_vector();
@@ -476,16 +471,10 @@ void FixQBMSST::setup(int /*vflag*/)
    omega[direction]=-1*sqrt(fac1);
    double fac2 = omega[direction]/v0;

    if ( comm->me == 0 && tscale != 1.0) {
      if ( screen )
        fprintf(screen,"Fix QBMSST initial strain rate of %12.5e established "
                "by reducing temperature by factor of %12.5e\n",
                fac2,tscale);
      if ( logfile )
        fprintf(logfile,"Fix QBMSST initial strain rate of %12.5e established "
                "by reducing temperature by factor of %12.5e\n",
                fac2,tscale);
    }
    if ( comm->me == 0 && tscale != 1.0)
      utils::logmesg(lmp,fmt::format("Fix QBMSST initial strain rate of {:12.5e} "
                                 "established by reducing temperature by "
                                 "factor of {:12.5e}\n",fac2,tscale));
    for (int i = 0; i < atom->nlocal; i++) {
      if (mask[i] & groupbit) {
        for (int k = 0; k < 3; k++ ) {
@@ -531,8 +520,8 @@ void FixQBMSST::initial_integrate(int /*vflag*/)
  // decide if the qtb temperature need to be updated or not
  if (counter_l == 0) {
    t_current -= dtv*fric_coef*eta*beta*(old_eavg-e0)/(3*ntotal*boltz);
    if (t_current > 0.0) {
      old_eavg = 0;//clear old energy average
    if (t_current < 0.0) t_current=0;

      // load omega_H with calculated spectrum at a specific temperature (corrected spectrum), omega_H is the Fourier transformation of time_H
      for (int k = 0; k < 2*N_f; k++) {
@@ -557,6 +546,7 @@ void FixQBMSST::initial_integrate(int /*vflag*/)
        time_H[n]/=(2.0*N_f);
      }
    }
  }

  //update the colored random force every alpha MD steps
  if (counter_mu == 0) {
@@ -1170,11 +1160,12 @@ void FixQBMSST::copy_arrays(int i, int j, int /*delflag*/)
------------------------------------------------------------------------- */
int FixQBMSST::pack_exchange(int i, double *buf)
{
  for (int m = 0; m < 2*N_f; m++) buf[m] = random_array_0[i][m];
  for (int m = 0; m < 2*N_f; m++) buf[m+2*N_f] = random_array_1[i][m];
  for (int m = 0; m < 2*N_f; m++) buf[m+4*N_f] = random_array_2[i][m];
  for (int m = 0; m < 3; m++) buf[m+6*N_f] = fran[i][m];
  return 6*N_f+3;
  int n = 0;
  for (int m = 0; m < 2*N_f; m++) buf[n++] = random_array_0[i][m];
  for (int m = 0; m < 2*N_f; m++) buf[n++] = random_array_1[i][m];
  for (int m = 0; m < 2*N_f; m++) buf[n++] = random_array_2[i][m];
  for (int m = 0; m < 3; m++) buf[n++] = fran[i][m];
  return n;
}

/* ----------------------------------------------------------------------
@@ -1182,9 +1173,10 @@ int FixQBMSST::pack_exchange(int i, double *buf)
------------------------------------------------------------------------- */
int FixQBMSST::unpack_exchange(int nlocal, double *buf)
{
  for (int m = 0; m < 2*N_f; m++) random_array_0[nlocal][m] = buf[m];
  for (int m = 0; m < 2*N_f; m++) random_array_1[nlocal][m] = buf[m+2*N_f];
  for (int m = 0; m < 2*N_f; m++) random_array_2[nlocal][m] = buf[m+4*N_f];
  for (int m = 0; m < 3; m++) fran[nlocal][m] = buf[m+6*N_f];
  return 6*N_f+3;
  int n = 0;
  for (int m = 0; m < 2*N_f; m++) random_array_0[nlocal][m] = buf[n++];
  for (int m = 0; m < 2*N_f; m++) random_array_1[nlocal][m] = buf[n++];
  for (int m = 0; m < 2*N_f; m++) random_array_2[nlocal][m] = buf[n++];
  for (int m = 0; m < 3; m++) fran[nlocal][m] = buf[n++];
  return n;
}
+31 −21
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@
#include "math_const.h"
#include "memory.h"
#include "error.h"
#include "utils.h"
#include "fmt/format.h"

using namespace LAMMPS_NS;
using namespace FixConst;
@@ -62,27 +64,34 @@ FixQTB::FixQTB(LAMMPS *lmp, int narg, char **arg) :
  while (iarg < narg) {
    if (strcmp(arg[iarg],"temp") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal fix qtb command");
      t_target = atof(arg[iarg+1]); if (t_target < 0.0) error->all(FLERR,"Fix qtb temp must be >= 0.0");
      t_target = force->numeric(FLERR,arg[iarg+1]);
      if (t_target < 0.0) error->all(FLERR,"Fix qtb temp must be >= 0.0");
      iarg += 2;
    } else if (strcmp(arg[iarg],"damp") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal fix qtb command");
      t_period = atof(arg[iarg+1]); if (t_period <= 0.0) error->all(FLERR,"Fix qtb damp must be > 0.0"); fric_coef = 1/t_period;
      t_period = force->numeric(FLERR,arg[iarg+1]);
      if (t_period <= 0.0) error->all(FLERR,"Fix qtb damp must be > 0.0"); fric_coef = 1/t_period;
      iarg += 2;
    } else if (strcmp(arg[iarg],"seed") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal fix qtb command");
      seed = atof(arg[iarg+1]); if (seed <= 0) error->all(FLERR,"Illegal fix qtb command");
      seed = force->inumeric(FLERR,arg[iarg+1]);
      if (seed <= 0) error->all(FLERR,"Illegal fix qtb command");
      iarg += 2;
    } else if (strcmp(arg[iarg],"f_max") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal fix qtb command");
      f_max = atof(arg[iarg+1]); if (f_max <= 0) error->all(FLERR,"Illegal fix qtb command");
      f_max = force->numeric(FLERR,arg[iarg+1]);
      if (f_max <= 0) error->all(FLERR,"Illegal fix qtb command");
      iarg += 2;
    } else if (strcmp(arg[iarg],"N_f") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal fix qtb command");
      N_f = atof(arg[iarg+1]); if (N_f <= 0) error->all(FLERR,"Illegal fix qtb command");
      N_f = force->inumeric(FLERR,arg[iarg+1]);
      if (N_f <= 0) error->all(FLERR,"Illegal fix qtb command");
      iarg += 2;
    } else error->all(FLERR,"Illegal fix qtb command");
  }

  maxexchange = 6*N_f+3;

  // allocate qtb
  gfactor1 = NULL;
  gfactor3 = NULL;
@@ -105,10 +114,6 @@ FixQTB::FixQTB(LAMMPS *lmp, int narg, char **arg) :
  // allocate random-arrays and fran
  grow_arrays(atom->nmax);
  atom->add_callback(0);
  // memory->create(random_array_0,atom->nmax+300,2*N_f,"qtb:random_array_0");
  // memory->create(random_array_1,atom->nmax+300,2*N_f,"qtb:random_array_1");
  // memory->create(random_array_2,atom->nmax+300,2*N_f,"qtb:random_array_2");
  // memory->create(fran,atom->nmax+300,3,"qtb:fran");

  // allocate omega_H and time_H
  memory->create(omega_H,2*N_f,"qtb:omega_H");
@@ -160,14 +165,17 @@ void FixQTB::init()

  //set up the h time step for updating the random force \delta{}h=\frac{\pi}{\Omega_{max}}
  if (int(1.0/(2*f_max*dtv)) == 0) {
    if (comm->me == 0) printf ("Warning: Either f_max is too high or the time step is too big, setting f_max to be 1/timestep!\n");
    if (comm->me == 0) error->warning(FLERR,"Either f_max is too high or the time step "
                                      "is too big, setting f_max to be 1/timestep!\n");
    h_timestep=dtv;
    alpha=1;
  } else {
    alpha=int(1.0/(2*f_max*dtv));
    h_timestep=alpha*dtv;
  }
  if (comm->me == 0) printf ("The effective maximum frequncy is now %f inverse time unit with alpha value as %d!\n", 0.5/h_timestep, alpha);
  if (comm->me == 0 && screen)
    fmt::print(screen,"The effective maximum frequency is now {} inverse time unit "
               "with alpha value as {}!\n", 0.5/h_timestep, alpha);

  // set force prefactors
  if (!atom->rmass) {
@@ -404,11 +412,12 @@ void FixQTB::copy_arrays(int i, int j, int /*delflag*/)
------------------------------------------------------------------------- */
int FixQTB::pack_exchange(int i, double *buf)
{
  for (int m = 0; m < 2*N_f; m++) buf[m] = random_array_0[i][m];
  for (int m = 0; m < 2*N_f; m++) buf[m+2*N_f] = random_array_1[i][m];
  for (int m = 0; m < 2*N_f; m++) buf[m+4*N_f] = random_array_2[i][m];
  for (int m = 0; m < 3; m++) buf[m+6*N_f] = fran[i][m];
  return 6*N_f+3;
  int n = 0;
  for (int m = 0; m < 2*N_f; m++) buf[n++] = random_array_0[i][m];
  for (int m = 0; m < 2*N_f; m++) buf[n++] = random_array_1[i][m];
  for (int m = 0; m < 2*N_f; m++) buf[n++] = random_array_2[i][m];
  for (int m = 0; m < 3; m++) buf[n++] = fran[i][m];
  return n;
}

/* ----------------------------------------------------------------------
@@ -416,9 +425,10 @@ int FixQTB::pack_exchange(int i, double *buf)
------------------------------------------------------------------------- */
int FixQTB::unpack_exchange(int nlocal, double *buf)
{
  for (int m = 0; m < 2*N_f; m++) random_array_0[nlocal][m] = buf[m];
  for (int m = 0; m < 2*N_f; m++) random_array_1[nlocal][m] = buf[m+2*N_f];
  for (int m = 0; m < 2*N_f; m++) random_array_2[nlocal][m] = buf[m+4*N_f];
  for (int m = 0; m < 3; m++) fran[nlocal][m] = buf[m+6*N_f];
  return 6*N_f+3;
  int n = 0;
  for (int m = 0; m < 2*N_f; m++) random_array_0[nlocal][m] = buf[n++];
  for (int m = 0; m < 2*N_f; m++) random_array_1[nlocal][m] = buf[n++];
  for (int m = 0; m < 2*N_f; m++) random_array_2[nlocal][m] = buf[n++];
  for (int m = 0; m < 3; m++) fran[nlocal][m] = buf[n++];
  return n;
}
Loading