Collective Variables Module - Developer Documentation
Loading...
Searching...
No Matches
fix_colvars.h
1// -*- c++ -*-
2
3// This file is part of the Collective Variables module (Colvars).
4// The original version of Colvars and its updates are located at:
5// https://github.com/Colvars/colvars
6// Please update all Colvars source files before making any changes.
7// If you wish to distribute your changes, please submit them to the
8// Colvars repository at GitHub.
9
10/* -*- c++ -*- ----------------------------------------------------------
11 LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
12 https://www.lammps.org/, Sandia National Laboratories
13 LAMMPS development team: developers@lammps.org
14
15 Copyright (2003) Sandia Corporation. Under the terms of Contract
16 DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
17 certain rights in this software. This software is distributed under
18 the GNU General Public License.
19
20 See the README file in the top-level LAMMPS directory.
21------------------------------------------------------------------------- */
22
23/* ----------------------------------------------------------------------
24 Contributing author: Axel Kohlmeyer (Temple U)
25 Currently maintained by: Giacomo Fiorin (NIH)
26------------------------------------------------------------------------- */
27
28#ifdef FIX_CLASS
29// clang-format off
30FixStyle(colvars,FixColvars);
31// clang-format on
32#else
33
34#ifndef LMP_FIX_COLVARS_H
35#define LMP_FIX_COLVARS_H
36
37#include "fix.h"
38#include <unordered_map>
39
40// Forward declarations
42
43namespace LAMMPS_NS {
44
45class FixColvars : public Fix {
46
47 public:
48 FixColvars(class LAMMPS *, int, char **);
49 ~FixColvars() override;
50
51 int setmask() override;
52 void init() override;
53 void setup(int) override;
54 int modify_param(int, char **) override;
55 void min_setup(int vflag) override { setup(vflag); };
56 void min_post_force(int) override;
57 void post_force(int) override;
58 void post_force_respa(int, int, int) override;
59 void end_of_step() override;
60 void post_run() override;
61 double compute_scalar() override;
62 double memory_usage() override;
63
64 void write_restart(FILE *) override;
65 void restart(char *) override;
66
67 protected:
68 colvarproxy_lammps *proxy; // pointer to the colvars proxy class
69 char *conf_file; // name of colvars config file
70 char *inp_name; // name/prefix of colvars restart file
71 char *out_name; // prefix string for all output files
72 char *tfix_name; // name of thermostat fix.
73 int rng_seed; // seed to initialize random number generator
74 double t_target = 0.0; // thermostat target temperature
75 double energy; // biasing energy of the fix
76
77 int num_coords; // total number of atoms controlled by this fix
78 tagint *taglist; // list of all atom IDs referenced by colvars.
79
80 int nmax; // size of atom communication buffer.
81 int size_one; // bytes per atom in communication buffer.
82 struct commdata *comm_buf; // communication buffer
83 double *force_buf; // communication buffer
84
86 unsigned char *script_args[100];
87
88 std::unordered_map<int, int> idmap; // for mapping atom indices to consistent order.
89
90 int nlevels_respa; // flag to determine respa levels.
91 int store_forces; // flag to determine whether to store total forces
92 int unwrap_flag; // 1 if atom coords are unwrapped, 0 if not
93 int init_flag; // 1 if initialized, 0 if not
94 static int instances; // count fix instances, since colvars currently
95 // only supports one instance at a time
96 MPI_Comm root2root; // inter-root communicator for multi-replica support
97
98 void init_taglist(); // initialize list of atom tags and hash table
99
102
104 void setup_io();
105
110 int parse_fix_arguments(int narg, char **arg, bool fix_constructor = true);
111};
112
113} // namespace LAMMPS_NS
114
115#endif
116#endif
Definition: fix_colvars.h:45
void setup_io()
Tell Colvars where to get its state from and where to save it.
Definition: fix_colvars.cpp:415
int parse_fix_arguments(int narg, char **arg, bool fix_constructor=true)
Definition: fix_colvars.cpp:148
unsigned char * script_args[100]
Arguments passed from fix_modify to the Colvars script interface.
Definition: fix_colvars.h:86
void set_thermostat_temperature()
Share with Colvars the thermostat fix named by tfix_name.
Definition: fix_colvars.cpp:281
Communication between colvars and LAMMPS (implementation of colvarproxy)
Definition: colvarproxy_lammps.h:25
Definition: fix_colvars.cpp:54