final set of styles in the src folder to be simplified

This commit is contained in:
Axel Kohlmeyer
2020-06-28 23:25:37 -04:00
parent f94eeece72
commit a1c0b78a3a
3 changed files with 21 additions and 41 deletions

View File

@ -14,6 +14,7 @@
#include "compute_msd.h"
#include <mpi.h>
#include <cstring>
#include <string>
#include "atom.h"
#include "update.h"
#include "group.h"
@ -21,6 +22,7 @@
#include "modify.h"
#include "fix_store.h"
#include "error.h"
#include "fmt/format.h"
using namespace LAMMPS_NS;
@ -63,21 +65,13 @@ ComputeMSD::ComputeMSD(LAMMPS *lmp, int narg, char **arg) :
// create a new fix STORE style for reference positions
// id = compute-ID + COMPUTE_STORE, fix group = compute group
int n = strlen(id) + strlen("_COMPUTE_STORE") + 1;
id_fix = new char[n];
strcpy(id_fix,id);
strcat(id_fix,"_COMPUTE_STORE");
std::string fixcmd = id + std::string("_COMPUTE_STORE");
id_fix = new char[fixcmd.size()+1];
strcpy(id_fix,fixcmd.c_str());
char **newarg = new char*[6];
newarg[0] = id_fix;
newarg[1] = group->names[igroup];
newarg[2] = (char *) "STORE";
newarg[3] = (char *) "peratom";
newarg[4] = (char *) "1";
newarg[5] = (char *) "3";
modify->add_fix(6,newarg);
fixcmd += fmt::format(" {} STORE peratom 1 3",group->names[igroup]);
modify->add_fix(fixcmd);
fix = (FixStore *) modify->fix[modify->nfix-1];
delete [] newarg;
// calculate xu,yu,zu for fix store array
// skip if reset from restart file