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
39// Forward declarations
40namespace IntHash_NS {
41 class inthash_t;
42}
44
45namespace LAMMPS_NS {
46
47class FixColvars : public Fix {
48
49 public:
50 FixColvars(class LAMMPS *, int, char **);
51 ~FixColvars() override;
52
53 int setmask() override;
54 void init() override;
55 void setup(int) override;
56 int modify_param(int, char **) override;
57 void min_setup(int vflag) override { setup(vflag); };
58 void min_post_force(int) override;
59 void post_force(int) override;
60 void post_force_respa(int, int, int) override;
61 void end_of_step() override;
62 void post_run() override;
63 double compute_scalar() override;
64 double memory_usage() override;
65
66 void write_restart(FILE *) override;
67 void restart(char *) override;
68
69 protected:
70 colvarproxy_lammps *proxy; // pointer to the colvars proxy class
71 char *conf_file; // name of colvars config file
72 char *inp_name; // name/prefix of colvars restart file
73 char *out_name; // prefix string for all output files
74 char *tfix_name; // name of thermostat fix.
75 int rng_seed; // seed to initialize random number generator
76 double t_target = 0.0; // thermostat target temperature
77 double energy; // biasing energy of the fix
78
79 int me; // my MPI rank in this "world".
80 int num_coords; // total number of atoms controlled by this fix
81 tagint *taglist; // list of all atom IDs referenced by colvars.
82
83 int nmax; // size of atom communication buffer.
84 int size_one; // bytes per atom in communication buffer.
85 struct commdata *comm_buf; // communication buffer
86 double *force_buf; // communication buffer
87
89 unsigned char *script_args[100];
90
91 IntHash_NS::inthash_t *idmap; // hash for mapping atom indices to consistent order.
92
93 int nlevels_respa; // flag to determine respa levels.
94 int store_forces; // flag to determine whether to store total forces
95 int unwrap_flag; // 1 if atom coords are unwrapped, 0 if not
96 int init_flag; // 1 if initialized, 0 if not
97 static int instances; // count fix instances, since colvars currently
98 // only supports one instance at a time
99 MPI_Comm root2root; // inter-root communicator for multi-replica support
100
101 void init_taglist(); // initialize list of atom tags and hash table
102
105
107 void setup_io();
108
113 int parse_fix_arguments(int narg, char **arg, bool fix_constructor = true);
114};
115
116} // namespace LAMMPS_NS
117
118#endif
119#endif
Definition: fix_colvars.h:47
void setup_io()
Tell Colvars where to get its state from and where to save it.
Definition: fix_colvars.cpp:438
int parse_fix_arguments(int narg, char **arg, bool fix_constructor=true)
Definition: fix_colvars.cpp:160
unsigned char * script_args[100]
Arguments passed from fix_modify to the Colvars script interface.
Definition: fix_colvars.h:89
void set_thermostat_temperature()
Share with Colvars the thermostat fix named by tfix_name.
Definition: fix_colvars.cpp:295
Communication between colvars and LAMMPS (implementation of colvarproxy)
Definition: colvarproxy_lammps.h:27
Definition: inthash.h:9
Definition: fix_colvars.cpp:56