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_nvt.h"
16 
17 #include "error.h"
18 #include "group.h"
19 #include "modify.h"
20 
21 using namespace LAMMPS_NS;
22 using namespace FixConst;
23 
24 /* ---------------------------------------------------------------------- */
25 
FixNVT(LAMMPS * lmp,int narg,char ** arg)26 FixNVT::FixNVT(LAMMPS *lmp, int narg, char **arg) :
27   FixNH(lmp, narg, arg)
28 {
29   if (!tstat_flag)
30     error->all(FLERR,"Temperature control must be used with fix nvt");
31   if (pstat_flag)
32     error->all(FLERR,"Pressure control can not be used with fix nvt");
33 
34   // create a new compute temp style
35   // id = fix-ID + temp
36 
37   id_temp = utils::strdup(std::string(id) + "_temp");
38   modify->add_compute(fmt::format("{} {} temp",id_temp,group->names[igroup]));
39   tcomputeflag = 1;
40 }
41