1 /* -*- c++ -*- ----------------------------------------------------------
2    LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
3    https://www.lammps.org/, Sandia National Laboratories
4    Steve Plimpton, sjplimp@sandia.gov
5 
6    Copyright (2003) Sandia Corporation.  Under the terms of Contract
7    DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
8    certain rights in this software.  This software is distributed under
9    the GNU General Public License.
10 
11    See the README file in the top-level LAMMPS directory.
12 ------------------------------------------------------------------------- */
13 
14 #ifdef FIX_CLASS
15 // clang-format off
16 FixStyle(pimd,FixPIMD);
17 // clang-format on
18 #else
19 
20 #ifndef FIX_PIMD_H
21 #define FIX_PIMD_H
22 
23 #include "fix.h"
24 
25 namespace LAMMPS_NS {
26 
27 class FixPIMD : public Fix {
28  public:
29   FixPIMD(class LAMMPS *, int, char **);
30   virtual ~FixPIMD();
31 
32   int setmask();
33 
34   void init();
35   void setup(int);
36   void post_force(int);
37   void initial_integrate(int);
38   void final_integrate();
39 
40   double memory_usage();
41   void grow_arrays(int);
42   void copy_arrays(int, int, int);
43   int pack_exchange(int, double *);
44   int unpack_exchange(int, double *);
45   int pack_restart(int, double *);
46   void unpack_restart(int, int);
47   int maxsize_restart();
48   int size_restart(int);
49   double compute_vector(int);
50 
51   int pack_forward_comm(int, int *, double *, int, int *);
52   void unpack_forward_comm(int, int, double *);
53 
54   int method;
55   int np;
56   double inverse_np;
57 
58   /* ring-polymer model */
59 
60   double omega_np, fbond, spring_energy, sp;
61   int x_last, x_next;
62 
63   void spring_force();
64 
65   /* fictitious mass */
66 
67   double fmass, *mass;
68 
69   /* inter-partition communication */
70 
71   int max_nsend;
72   tagint *tag_send;
73   double *buf_send;
74 
75   int max_nlocal;
76   double *buf_recv, **buf_beads;
77 
78   int size_plan;
79   int *plan_send, *plan_recv;
80   double **comm_ptr;
81 
82   void comm_init();
83   void comm_exec(double **);
84 
85   /* normal-mode operations */
86 
87   double *lam, **M_x2xp, **M_xp2x, **M_f2fp, **M_fp2f;
88   int *mode_index;
89 
90   void nmpimd_init();
91   void nmpimd_fill(double **);
92   void nmpimd_transform(double **, double **, double *);
93 
94   /* Nose-hoover chain integration */
95 
96   int nhc_offset_one_1, nhc_offset_one_2;
97   int nhc_size_one_1, nhc_size_one_2;
98   int nhc_nchain;
99   bool nhc_ready;
100   double nhc_temp, dtv, dtf, t_sys;
101 
102   double **nhc_eta;        /* coordinates of NH chains for ring-polymer beads */
103   double **nhc_eta_dot;    /* velocities of NH chains                         */
104   double **nhc_eta_dotdot; /* acceleration of NH chains                       */
105   double **nhc_eta_mass;   /* mass of NH chains                               */
106 
107   void nhc_init();
108   void nhc_update_v();
109   void nhc_update_x();
110 };
111 
112 }    // namespace LAMMPS_NS
113 
114 #endif
115 #endif
116