Unverified Commit a5651acb authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

must not forget to generate compute ids and store them.

parent 1ea0eca2
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -582,8 +582,12 @@ void ComputeChunkAtom::init()
  // fixstore initializes all values to 0.0

  if ((idsflag == ONCE || lockcount) && !fixstore) {
    modify->add_fix(fmt::format("{}_COMPUTE_STORE {} STORE peratom 1 1",
                                id,group->names[igroup]));
    std::string cmd = id + std::string("_COMPUTE_STORE");
    id_fix = new char[cmd.size()+1];
    strcpy(id_fix,cmd.c_str());

    cmd += fmt::format(" {} STORE peratom 1 1", group->names[igroup]);
    modify->add_fix(cmd);
    fixstore = (FixStore *) modify->fix[modify->nfix-1];
  }

+6 −2
Original line number Diff line number Diff line
@@ -73,8 +73,12 @@ ComputeDisplaceAtom::ComputeDisplaceAtom(LAMMPS *lmp, int narg, char **arg) :
  // create a new fix STORE style
  // id = compute-ID + COMPUTE_STORE, fix group = compute group

  modify->add_fix(fmt::format("{}_COMPUTE_STORE {} STORE peratom 1 3",
                              id,group->names[igroup]));
  std::string cmd = id + std::string("_COMPUTE_STORE");
  id_fix = new char[cmd.size()+1];
  strcpy(id_fix,cmd.c_str());

  cmd += fmt::format(" {} STORE peratom 1 3", group->names[igroup]);
  modify->add_fix(cmd);
  fix = (FixStore *) modify->fix[modify->nfix-1];

  // calculate xu,yu,zu for fix store array
+6 −11
Original line number Diff line number Diff line
@@ -55,17 +55,12 @@ FixNumDiff::FixNumDiff(LAMMPS *lmp, int narg, char **arg) :
  if (nevery <= 0 || delta <= 0.0)
    error->all(FLERR,"Illegal fix numdiff command");

  int n = strlen(id) + 6;
  id_pe = new char[n];
  strcpy(id_pe,id);
  strcat(id_pe,"_pe");

  char **newarg = new char*[3];
  newarg[0] = id_pe;
  newarg[1] = (char *) "all";
  newarg[2] = (char *) "pe";
  modify->add_compute(3,newarg);
  delete [] newarg;
  std::string cmd = id + std::string("_pe");
  id_pe = new char[cmd.size()+1];
  strcpy(id_pe,cmd.c_str());

  cmd += " all pe";
  modify->add_compute(cmd);

  maxatom = 0;

+13 −23
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
#include "fix_press_berendsen.h"
#include <cstring>
#include <cmath>
#include <string>
#include "atom.h"
#include "force.h"
#include "comm.h"
@@ -217,35 +218,24 @@ FixPressBerendsen::FixPressBerendsen(LAMMPS *lmp, int narg, char **arg) :
  // compute group = all since pressure is always global (group all)
  //   and thus its KE/temperature contribution should use group all

  int n = strlen(id) + 6;
  id_temp = new char[n];
  strcpy(id_temp,id);
  strcat(id_temp,"_temp");

  char **newarg = new char*[3];
  newarg[0] = id_temp;
  newarg[1] = (char *) "all";
  newarg[2] = (char *) "temp";
  modify->add_compute(3,newarg);
  delete [] newarg;
  std::string tcmd = id + std::string("_temp");
  id_temp = new char[tcmd.size()+1];
  strcpy(id_temp,tcmd.c_str());

  tcmd += " all temp";
  modify->add_compute(tcmd);
  tflag = 1;

  // create a new compute pressure style
  // id = fix-ID + press, compute group = all
  // pass id_temp as 4th arg to pressure constructor

  n = strlen(id) + 7;
  id_press = new char[n];
  strcpy(id_press,id);
  strcat(id_press,"_press");

  newarg = new char*[4];
  newarg[0] = id_press;
  newarg[1] = (char *) "all";
  newarg[2] = (char *) "pressure";
  newarg[3] = id_temp;
  modify->add_compute(4,newarg);
  delete [] newarg;
  std::string pcmd = id + std::string("_press");
  id_press = new char[pcmd.size()+1];
  strcpy(id_press,pcmd.c_str());

  pcmd += " all pressure " + std::string(id_temp);
  modify->add_compute(pcmd);
  pflag = 1;

  nrigid = 0;
+7 −11
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@

#include "fix_temp_berendsen.h"
#include <cstring>
#include <string>
#include <cmath>
#include "atom.h"
#include "force.h"
@@ -70,17 +71,12 @@ FixTempBerendsen::FixTempBerendsen(LAMMPS *lmp, int narg, char **arg) :
  // create a new compute temp style
  // id = fix-ID + temp, compute group = fix group

  int n = strlen(id) + 6;
  id_temp = new char[n];
  strcpy(id_temp,id);
  strcat(id_temp,"_temp");

  char **newarg = new char*[3];
  newarg[0] = id_temp;
  newarg[1] = group->names[igroup];
  newarg[2] = (char *) "temp";
  modify->add_compute(3,newarg);
  delete [] newarg;
  std::string cmd = id + std::string("_temp");
  id_temp = new char[cmd.size()+1];
  strcpy(id_temp,cmd.c_str());

  cmd += group->names[igroup] + std::string(" temp");
  modify->add_compute(cmd);
  tflag = 1;

  energy = 0;
Loading