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