修訂 | 3a0ffa700908a54292b45fc0cf1394326af4dd13 (tree) |
---|---|
時間 | 2021-12-17 14:34:40 |
作者 | ![]() |
Commiter | Mitsuaki Kawamura |
Automatically detect the orientation of tetrahedra
@@ -320,8 +320,8 @@ bool MyApp::OnInit() | ||
320 | 320 | kveq_rot = new GLfloat *[nb]; |
321 | 321 | /**/ |
322 | 322 | interpol_energy(); |
323 | - init_corner(); | |
324 | 323 | bragg_vector(); |
324 | + init_corner(); | |
325 | 325 | myf->modify_band(); |
326 | 326 | /* |
327 | 327 | Brillouin zone |
@@ -34,6 +34,7 @@ THE SOFTWARE. | ||
34 | 34 | #include <OpenGL/gl.h> |
35 | 35 | #endif |
36 | 36 | #include "variable.hpp" |
37 | +#include "basic_math.hpp" | |
37 | 38 | /** |
38 | 39 | @brief Specify corners of tetrahedron |
39 | 40 |
@@ -202,7 +203,8 @@ void init_corner() | ||
202 | 203 | */ |
203 | 204 | void bragg_vector() |
204 | 205 | { |
205 | - int i0, i1, i2, i, ibr; | |
206 | + int i0, i1, i2, i, ibr, sw[4]; | |
207 | + float ldiag[4], bdiag[4][3]; | |
206 | 208 | /**/ |
207 | 209 | ibr = 0; |
208 | 210 | /**/ |
@@ -239,6 +241,19 @@ void bragg_vector() | ||
239 | 241 | if (brnrm_min > brnrm[ibr]) brnrm_min = brnrm[ibr]; |
240 | 242 | } |
241 | 243 | *terminal << wxString::Format(wxT(" Minimum Bragg norm : %f\n"), brnrm_min); |
244 | + // | |
245 | + // Serch shortest diagonal line | |
246 | + // | |
247 | + for (i = 0; i < 3; i++) { | |
248 | + bdiag[0][i] = bvec[0][i] / (float)ng0[0] + bvec[1][i] / (float)ng0[1] + bvec[2][i] / (float)ng0[2]; | |
249 | + bdiag[1][i] = bvec[0][i] / (float)ng0[0] + bvec[1][i] / (float)ng0[1] - bvec[2][i] / (float)ng0[2]; | |
250 | + bdiag[2][i] = bvec[0][i] / (float)ng0[0] - bvec[1][i] / (float)ng0[1] + bvec[2][i] / (float)ng0[2]; | |
251 | + bdiag[3][i] = -bvec[0][i] / (float)ng0[0] + bvec[1][i] / (float)ng0[1] + bvec[2][i] / (float)ng0[2]; | |
252 | + } | |
253 | + for (i = 0; i < 4; i++) | |
254 | + ldiag[i] = bdiag[i][0] * bdiag[i][0] + bdiag[i][1] * bdiag[i][1] + bdiag[i][2] * bdiag[i][2]; | |
255 | + eigsort(4, ldiag, sw); | |
256 | + itet = sw[0]; | |
242 | 257 | }/* bragg_vector */ |
243 | 258 | /** |
244 | 259 | @brief Print max and minimum @f$\varepsilon_{n k}, \Delta_{n k}@f$ |
@@ -946,11 +946,12 @@ MyFrame::MyFrame(wxFrame* frame, const wxString& title, const wxPoint& pos, | ||
946 | 946 | wxString choices_tetra[] = { wxT("1"), wxT("2"), wxT("3"), wxT("4"), wxT("5"), wxT("6"), wxT("7") , |
947 | 947 | wxT("8"), wxT("9"), wxT("10"), wxT("11"), wxT("12"), wxT("13"), wxT("14"), |
948 | 948 | wxT("15"), wxT("16") }; |
949 | - Bind(wxEVT_COMMAND_RADIOBOX_SELECTED, &MyFrame::radio_tetra, this, iradio_tetra); | |
950 | - gbsizer->Add(new wxRadioBox(panel, iradio_tetra, wxT("Tetrahedron"), | |
949 | + radiobox_tetra = new wxRadioBox(panel, iradio_tetra, wxT("Tetrahedron"), | |
951 | 950 | wxDefaultPosition, wxDefaultSize, |
952 | 951 | WXSIZEOF(choices_tetra), choices_tetra, |
953 | - 4, wxRA_SPECIFY_COLS), wxGBPosition(3,2), wxGBSpan(5, 2)); | |
952 | + 4, wxRA_SPECIFY_COLS); | |
953 | + Bind(wxEVT_COMMAND_RADIOBOX_SELECTED, &MyFrame::radio_tetra, this, iradio_tetra); | |
954 | + gbsizer->Add(radiobox_tetra, wxGBPosition(3,2), wxGBSpan(5, 2)); | |
954 | 955 | |
955 | 956 | wxString choices_colorscale[] = { wxT("Input (1D)"), wxT("Input (2D)"), |
956 | 957 | wxT("Input (3D)"), wxT("Fermi Velocity"), wxT("Band Index"), |
@@ -1193,6 +1194,7 @@ void MyFrame::modify_band() { | ||
1193 | 1194 | GLfloat mat2; |
1194 | 1195 | |
1195 | 1196 | radiobox_color->SetSelection(color_scale - 1); |
1197 | + radiobox_tetra->SetSelection(itet); | |
1196 | 1198 | |
1197 | 1199 | check = new wxCheckBox * [nb]; |
1198 | 1200 | textbox_BandR = new wxTextCtrl * [nb]; |
@@ -48,6 +48,7 @@ public: | ||
48 | 48 | wxGridBagSizer* gbsizer; |
49 | 49 | wxPanel* panel; |
50 | 50 | wxRadioBox* radiobox_color; |
51 | + wxRadioBox* radiobox_tetra; | |
51 | 52 | wxSplitterWindow* splitterV; |
52 | 53 | wxSplitterWindow* splitterH; |
53 | 54 | /* |