DFT-FE 1.1.0-pre
Density Functional Theory With Finite-Elements
Loading...
Searching...
No Matches
MDIEngine.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (c) 2017-2025 The Regents of the University of Michigan and DFT-FE
4// authors.
5//
6// This file is part of the DFT-FE code.
7//
8// The DFT-FE code is free software; you can use it, redistribute
9// it, and/or modify it under the terms of the GNU Lesser General
10// Public License as published by the Free Software Foundation; either
11// version 2.1 of the License, or (at your option) any later version.
12// The full text of the license can be found in the file LICENSE at
13// the top level of the DFT-FE distribution.
14//
15// ---------------------------------------------------------------------
16//
17
18#if defined(DFTFE_WITH_MDI)
19# ifndef dftfeMDIEngine_H_
20# define dftfeMDIEngine_H_
21# include "dftfeWrapper.h"
22# include <mdi.h>
23# include <mpi.h>
24# include <string>
25# include <vector>
26
27namespace dftfe
28{
29 /**
30 * @brief MDIEngine interface class for dftfe
31 *
32 * @author Sambit Das
33 */
34 class MDIEngine
35 {
36 public:
37 /**
38 * @brief constructor
39 */
40 MDIEngine(MPI_Comm &dftfeMPIComm, int argc, char *argv[]);
41
42 int
43 execute_command(const char *command, MDI_Comm &mdicomm);
44
45 void
46 engine_node(const char *node);
47
48
49 private:
50 /// 1 for proc 0, otherwise 0
51 int d_root;
52
53 /// MDI communicator
54 MDI_Comm d_mdicomm;
55
56 /// MDI communicator
57 MPI_Comm d_dftfeMPIComm;
58
59 /// DFT-FE object
60 dftfeWrapper d_dftfeWrapper;
61
62 // state of MDI engine
63
64 /// which mode engine is in ()
65 int d_mode;
66 /// current MDI command being processed
67 char *d_mdicmd;
68 /// which node engine is at
69 char *d_node_engine;
70 /// which node driver has requested
71 char *d_node_driver;
72 /// true if driver and engine node currently match
73 bool d_node_match;
74 /// true if EXIT command received from driver
75 bool d_exit_command;
76
77 // flags for data received by engine
78 // not acted on until a request to send <ENERGY,<FORCES,<PE,<STRESS
79 int d_actionflag;
80 int d_flag_natoms, d_flag_elements;
81 int d_flag_cell, d_flag_dimensions, d_flag_cell_displ;
82 int d_flag_charges, d_flag_coords;
83 int d_flag_mpGrid, d_flag_mpShift;
84 int d_flag_spin;
85
86 int d_sys_natoms;
87 int d_sys_dimensions[3];
88 std::vector<int> d_sys_elements;
89 std::vector<double> d_sys_coords;
90 double d_sys_cell[9], d_sys_cell_displ[3];
91 int d_mpGrid[3];
92 double d_mpShift[3];
93 int d_spinPolarization;
94
95 // class methods
96 void
97 mdi_commands();
98
99 void
100 evaluate();
101 void
102 create_system();
103 void
104 adjust_box();
105 void
106 adjust_coords();
107
108 void
109 receive_cell();
110 void
111 receive_cell_displ();
112 void
113 receive_coords();
114 void
115 receive_natoms();
116 void
117 receive_elements();
118 void
119 receive_dimensions();
120 void
121 receive_mpGrid();
122 void
123 receive_mpShift();
124 void
125 receive_spinPolarization();
126
127 void
128 send_name();
129 void
130 send_cell();
131 void
132 send_coords();
133 void
134 send_natoms();
135 void
136 send_elements();
137 void
138 send_spinPolarization();
139
140 void
141 send_energy();
142 void
143 send_forces();
144 void
145 send_stress();
146 };
147} // namespace dftfe
148# endif
149#endif
Definition pseudoPotentialToDftfeConverter.cc:34