1 // clang-format off
2 /* ----------------------------------------------------------------------
3 LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
4 https://www.lammps.org/, Sandia National Laboratories
5 Steve Plimpton, sjplimp@sandia.gov
6
7 Copyright (2003) Sandia Corporation. Under the terms of Contract
8 DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
9 certain rights in this software. This software is distributed under
10 the GNU General Public License.
11
12 See the README file in the top-level LAMMPS directory.
13 ------------------------------------------------------------------------- */
14
15 #include "fix_npt_sphere_omp.h"
16
17 #include "error.h"
18 #include "modify.h"
19
20 using namespace LAMMPS_NS;
21 using namespace FixConst;
22
23 /* ---------------------------------------------------------------------- */
24
FixNPTSphereOMP(LAMMPS * lmp,int narg,char ** arg)25 FixNPTSphereOMP::FixNPTSphereOMP(LAMMPS *lmp, int narg, char **arg) :
26 FixNHSphereOMP(lmp, narg, arg)
27 {
28 if (!tstat_flag)
29 error->all(FLERR,"Temperature control must be used with fix npt/sphere/omp");
30 if (!pstat_flag)
31 error->all(FLERR,"Pressure control must be used with fix npt/sphere/omp");
32
33 // create a new compute temp style
34 // id = fix-ID + temp
35 // compute group = all since pressure is always global (group all)
36 // and thus its KE/temperature contribution should use group all
37
38 id_temp = utils::strdup(std::string(id) + "_temp");
39 modify->add_compute(fmt::format("{} all temp/sphere",id_temp));
40 tcomputeflag = 1;
41
42 // create a new compute pressure style
43 // id = fix-ID + press, compute group = all
44 // pass id_temp as 4th arg to pressure constructor
45
46 id_press = utils::strdup(std::string(id) + "_press");
47 modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp));
48 pcomputeflag = 1;
49 }
50