• R/O
  • HTTP
  • SSH
  • HTTPS

fermisurfer: Commit

fermisurfer Git


Commit MetaInfo

Revision3a0ffa700908a54292b45fc0cf1394326af4dd13 (tree)
Zeit2021-12-17 14:34:40
AutorMitsuaki Kawamura <kawamitsuaki@gmai...>
CommiterMitsuaki Kawamura

Log Message

Automatically detect the orientation of tetrahedra

Ändern Zusammenfassung

Diff

--- a/src/fermisurfer.cpp
+++ b/src/fermisurfer.cpp
@@ -320,8 +320,8 @@ bool MyApp::OnInit()
320320 kveq_rot = new GLfloat *[nb];
321321 /**/
322322 interpol_energy();
323- init_corner();
324323 bragg_vector();
324+ init_corner();
325325 myf->modify_band();
326326 /*
327327 Brillouin zone
--- a/src/initialize.cpp
+++ b/src/initialize.cpp
@@ -34,6 +34,7 @@ THE SOFTWARE.
3434 #include <OpenGL/gl.h>
3535 #endif
3636 #include "variable.hpp"
37+#include "basic_math.hpp"
3738 /**
3839 @brief Specify corners of tetrahedron
3940
@@ -202,7 +203,8 @@ void init_corner()
202203 */
203204 void bragg_vector()
204205 {
205- int i0, i1, i2, i, ibr;
206+ int i0, i1, i2, i, ibr, sw[4];
207+ float ldiag[4], bdiag[4][3];
206208 /**/
207209 ibr = 0;
208210 /**/
@@ -239,6 +241,19 @@ void bragg_vector()
239241 if (brnrm_min > brnrm[ibr]) brnrm_min = brnrm[ibr];
240242 }
241243 *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];
242257 }/* bragg_vector */
243258 /**
244259 @brief Print max and minimum @f$\varepsilon_{n k}, \Delta_{n k}@f$
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -946,11 +946,12 @@ MyFrame::MyFrame(wxFrame* frame, const wxString& title, const wxPoint& pos,
946946 wxString choices_tetra[] = { wxT("1"), wxT("2"), wxT("3"), wxT("4"), wxT("5"), wxT("6"), wxT("7") ,
947947 wxT("8"), wxT("9"), wxT("10"), wxT("11"), wxT("12"), wxT("13"), wxT("14"),
948948 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"),
951950 wxDefaultPosition, wxDefaultSize,
952951 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));
954955
955956 wxString choices_colorscale[] = { wxT("Input (1D)"), wxT("Input (2D)"),
956957 wxT("Input (3D)"), wxT("Fermi Velocity"), wxT("Band Index"),
@@ -1193,6 +1194,7 @@ void MyFrame::modify_band() {
11931194 GLfloat mat2;
11941195
11951196 radiobox_color->SetSelection(color_scale - 1);
1197+ radiobox_tetra->SetSelection(itet);
11961198
11971199 check = new wxCheckBox * [nb];
11981200 textbox_BandR = new wxTextCtrl * [nb];
--- a/src/menu.hpp
+++ b/src/menu.hpp
@@ -48,6 +48,7 @@ public:
4848 wxGridBagSizer* gbsizer;
4949 wxPanel* panel;
5050 wxRadioBox* radiobox_color;
51+ wxRadioBox* radiobox_tetra;
5152 wxSplitterWindow* splitterV;
5253 wxSplitterWindow* splitterH;
5354 /*
Show on old repository browser