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(ttm/mod,FixTTMMod);
17 // clang-format on
18 #else
19 
20 #ifndef LMP_FIX_TTM_MOD_H
21 #define LMP_FIX_TTM_MOD_H
22 
23 #include "fix.h"
24 #include <exception>
25 
26 namespace LAMMPS_NS {
27 
28 struct el_heat_capacity_thermal_conductivity {
29   double el_heat_capacity;
30   double el_thermal_conductivity;
31 };
32 
33 class FixTTMMod : public Fix {
34  public:
35   FixTTMMod(class LAMMPS *, int, char **);
36   ~FixTTMMod();
37   int setmask();
38   void init();
39   void setup(int);
40   void post_force(int);
41   void post_force_respa(int, int, int);
42   void post_force_setup(int);
43   void post_force_respa_setup(int, int, int);
44   void end_of_step();
45   void reset_dt();
46   void write_restart(FILE *);
47   void restart(char *);
48   int pack_restart(int, double *);
49   void unpack_restart(int, int);
50   int size_restart(int);
51   int maxsize_restart();
52   double memory_usage();
53   void grow_arrays(int);
54   double compute_vector(int);
55 
56  private:
57   int nlevels_respa;
58   int seed;
59   int outevery;
60   double shift;
61   char *infile, *outfile;
62 
63   class RanMars *random;
64 
65   int nxgrid, nygrid, nzgrid;
66   int ngridtotal;
67 
68   int ***nsum, ***nsum_all;
69   double *gfactor1, *gfactor2, *ratio, **flangevin;
70   double ***T_electron, ***T_electron_old, ***T_electron_first;
71   double ***sum_vsq, ***sum_mass_vsq;
72   double ***sum_vsq_all, ***sum_mass_vsq_all;
73   double ***net_energy_transfer, ***net_energy_transfer_all;
74 
75   double gamma_p, gamma_s, v_0, v_0_sq;
76   int skin_layer, surface_l, surface_r, t_surface_l, t_surface_r;
77   int movsur;
78   double esheat_0, esheat_1, esheat_2, esheat_3, esheat_4, C_limit, electronic_density;
79   double el_th_diff, T_damp;
80   double intensity, width, duration, surface_double;
81   double mult_factor, ttm_dt;
82   double pres_factor, free_path, ionic_density;
83   double electron_temperature_min;
84   el_heat_capacity_thermal_conductivity el_properties(double);
85   double el_sp_heat_integral(double);
86 
87   void read_parameters(const std::string &);
88   void read_electron_temperatures(const std::string &);
89   void write_electron_temperatures(const std::string &);
90 
91   class parser_error : public std::exception {
92     std::string message;
93 
94    public:
parser_error(const std::string & mesg)95     parser_error(const std::string &mesg) { message = mesg; }
what()96     const char *what() const noexcept { return message.c_str(); }
97   };
98 };
99 
100 }    // namespace LAMMPS_NS
101 
102 #endif
103 #endif
104