• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

fermisurfer Git


Commit MetaInfo

Revision1fff391816c6aa58b51693ce03495dc49e7b13f2 (tree)
Zeit2020-03-13 01:08:42
AutorMitsuaki Kawamura <kawamitsuaki@gmai...>
CommiterMitsuaki Kawamura

Log Message

Use global variables again.
Output 2D Fermi lines
Display reciplocal lattice vectors
Universal design (color: RGB, CMY, MCY)

Ändern Zusammenfassung

Diff

--- a/src/bz_lines.cpp
+++ b/src/bz_lines.cpp
@@ -25,6 +25,7 @@ THE SOFTWARE.
2525 @brief Compute lines of BZ boundary
2626 */
2727 #include "basic_math.hpp"
28+#include "variable.hpp"
2829 #include <wx/wx.h>
2930 #if defined(HAVE_CONFIG_H)
3031 #include <config.h>
@@ -107,14 +108,8 @@ static int bragg_vert(
107108 /**
108109 @brief Compute real number of Bragg plane at 1st BZ
109110 */
110-static void check_bragg(
111- wxTextCtrl *terminal,
112- int nbzl,
113- GLfloat bzl[676][2][3],
114- GLfloat bragg[26][3],
115- GLfloat brnrm[26],
116- int *nbragg
117-) {
111+static void check_bragg()
112+{
118113 int ibr, ibzl, ibzc;
119114 int ii, kk, bzflag, nbzcorner, nn;
120115 GLfloat thr = (GLfloat)0.0001, prod, bzc[676][3];
@@ -144,7 +139,7 @@ static void check_bragg(
144139 Then, compute real number Bragg plane of 1st BZ (::nbragg),
145140 Re-order ::bragg and ::brnrm
146141 */
147- *nbragg = 0;
142+ nbragg = 0;
148143 for (ibr = 0; ibr < 26; ibr++) {
149144 nn = 0;
150145
@@ -153,31 +148,25 @@ static void check_bragg(
153148 if (fabsf(prod - brnrm[ibr]) < thr) nn += 1;
154149 }
155150 if (nn >= 3) {
156- for (kk = 0; kk < 3; kk++) bragg[*nbragg][kk] = bragg[ibr][kk];
157- brnrm[*nbragg] = brnrm[ibr];
158- *nbragg += 1;
151+ for (kk = 0; kk < 3; kk++) bragg[nbragg][kk] = bragg[ibr][kk];
152+ brnrm[nbragg] = brnrm[ibr];
153+ nbragg += 1;
159154 }
160155 }
161- *terminal << wxString::Format(wxT(" Number of plane of 1st BZ : %d\n"), *nbragg);
156+ *terminal << wxString::Format(wxT(" Number of plane of 1st BZ : %d\n"), nbragg);
162157 }/*static void check_bragg*/
163158 /**
164159 @brief Compute Brillouin zone boundariy lines
165160
166161 Modify : ::nbzl, ::bzl
167162 */
168-void bz_lines(
169- wxTextCtrl* terminal,
170- GLfloat bragg[26][3],
171- GLfloat brnrm[26],
172- int *nbzl,
173- GLfloat bzl[676][2][3],
174- int *nbragg
175-) {
163+void bz_lines()
164+{
176165 /**/
177166 int ibr, jbr, nbr, i, j, lvert;
178167 GLfloat vert[2][3];
179168 /**/
180- *nbzl = 0;
169+ nbzl = 0;
181170 /**/
182171 for (ibr = 0; ibr < 26; ++ibr) {
183172 for (jbr = 0; jbr < 26; ++jbr) {
@@ -191,12 +180,12 @@ void bz_lines(
191180 lvert = bragg_vert(bragg, brnrm, ibr, jbr, nbr, vert[1], vert[0]);
192181 if (lvert == 0) continue;
193182 /**/
194- for (i = 0; i < 2; ++i) for (j = 0; j < 3; ++j) bzl[*nbzl][i][j] = vert[i][j];
195- *nbzl = *nbzl + 1;
183+ for (i = 0; i < 2; ++i) for (j = 0; j < 3; ++j) bzl[nbzl][i][j] = vert[i][j];
184+ nbzl = nbzl + 1;
196185
197186 }/*for (jbr = 0; jbr < 26; ++jbr)*/
198187 }/*for (ibr = 0; ibr < 26; ++ibr)*/
199188
200- check_bragg(terminal, *nbzl, bzl, bragg, brnrm, nbragg);
189+ check_bragg();
201190
202191 }/*bz_lines*/
--- a/src/bz_lines.hpp
+++ b/src/bz_lines.hpp
@@ -22,4 +22,4 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222 THE SOFTWARE.
2323 */
2424
25-void bz_lines(wxTextCtrl* terminal, GLfloat bragg[26][3], GLfloat brnrm[26], int* nbzl, GLfloat bzl[676][2][3], int* nbragg);
25+void bz_lines();
--- a/src/calc_nodeline.cpp
+++ b/src/calc_nodeline.cpp
@@ -38,24 +38,15 @@ THE SOFTWARE.
3838 #include <cmath>
3939 #include <vector>
4040 #include "basic_math.hpp"
41-
41+#include "variable.hpp"
4242 /**
4343 @brief Compute node-line where \f$\Delta_{n k} = 0\f$
4444
4545 Modify : ::nnl, ::kvnl, ::kvnl_rot
4646
4747 */
48-void calc_nodeline(
49-int nb,
50-int *ntri,
51-GLfloat ****matp,
52-GLfloat ****kvp,
53-int nthreads,
54-wxTextCtrl *terminal,
55-int* nnl,
56-GLfloat**** kvnl,
57-GLfloat** kvnl_rot
58-) {
48+void calc_nodeline()
49+{
5950 int ib, itri, i, j, ithread, nnl0;
6051 std::vector<std::vector<std::vector<std::vector<GLfloat>>>> kvnl_v;
6152
--- a/src/calc_nodeline.hpp
+++ b/src/calc_nodeline.hpp
@@ -21,15 +21,4 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2121 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222 THE SOFTWARE.
2323 */
24-#if defined(HAVE_CONFIG_H)
25-#include <config.h>
26-#endif
27-#if defined(HAVE_GL_GL_H)
28-#include <GL/gl.h>
29-#elif defined(HAVE_OPENGL_GL_H)
30-#include <OpenGL/gl.h>
31-#endif
32-#include <wx/wx.h>
33-
34-void calc_nodeline(int nb, int* ntri, GLfloat**** matp, GLfloat**** kvp, int nthreads,
35- wxTextCtrl* terminal, int* nnl, GLfloat**** kvnl, GLfloat** kvnl_rot);
24+void calc_nodeline();
--- a/src/draw.cpp
+++ b/src/draw.cpp
@@ -53,8 +53,8 @@ static void draw_fermi() {
5353 First, rotate k-vector and normal vector
5454 */
5555 #pragma omp parallel default(none) \
56- shared(nb,draw_band,ntri,rot,nmlp,arw,nmlp_rot,kvp,kvp_rot,arw_rot,trans,side) \
57- private(ib)
56+shared(nb,draw_band,ntri,rot,nmlp,arw,nmlp_rot,kvp,kvp_rot,arw_rot,trans,side) \
57+private(ib)
5858 {
5959 int i, j, l, itri;
6060
@@ -104,12 +104,11 @@ static void draw_fermi() {
104104 /*
105105 Arrow for 3D value
106106 */
107- if (blackback == 1) glColor3fv(white);
108- else glColor3fv(black);
109107 glNormal3f(0.0f, 0.0f, 1.0f);
110108 if (color_scale == 3) {
111109 for (ib = 0; ib < nb; ib++) {
112110 if (draw_band[ib] == 1) {
111+ glColor3f(1.0 - clr[ib][0], 1.0 - clr[ib][1], 1.0 - clr[ib][2]);
113112 glVertexPointer(3, GL_FLOAT, 0, arw_rot[ib]);
114113 glDrawArrays(GL_LINES, 0, ntri[ib] * 3 * 2);
115114 }
@@ -214,10 +213,7 @@ static void draw_bz_lines() {
214213 /*
215214 Line color is oposit of BG color
216215 */
217- if (blackback == 1)
218- for (i = 0; i<4; i++) linecolor[i] = white[i];
219- else
220- for (i = 0; i<4; i++) linecolor[i] = black[i];
216+ for (i = 0; i < 4; i++) linecolor[i] = LineColor[i];
221217 /**/
222218 glLineWidth(linewidth);
223219 /*
@@ -301,20 +297,45 @@ static void draw_bz_lines() {
301297 static void draw_colorbar()
302298 {
303299 int i, j, k;
304- GLfloat mat2, vertices[366], colors[488];
305- /**/
300+ GLfloat mat2, vertices[366], colors[488], vector[18], vector_color[24],
301+ norm;
302+
306303 glEnableClientState(GL_COLOR_ARRAY);
304+ /*
305+ Reciplocal lattice vectors
306+ */
307+ for (i = 0; i < 6; i++) {
308+ vector[3 * i] = -1.2f;
309+ vector[3 * i + 1] = -1.05f;
310+ vector[3 * i + 2] = 0.0f;
311+ }
312+ for (i = 0; i < 3; i++) {
313+ norm = sqrtf(bvec[i][0] * bvec[i][0]+ bvec[i][1] * bvec[i][1]+ bvec[i][2] * bvec[i][2]);
314+ for (j = 0; j < 3; j++) {
315+ vector[j + 6 * i]
316+ += (rot[j][0] * bvec[i][0]
317+ + rot[j][1] * bvec[i][1]
318+ + rot[j][2] * bvec[i][2]) * 0.2f / norm;
319+ }
320+ for (j = 0; j < 4; j++) {
321+ vector_color[j + 8 * i] = BarColor[i * 2][j];
322+ vector_color[j + 8 * i + 4] = BarColor[i * 2][j];
323+ }
324+ }
325+ glNormal3f(0.0f, 0.0f, 1.0f);
326+ glVertexPointer(3, GL_FLOAT, 0, vector);
327+ glColorPointer(4, GL_FLOAT, 0, vector_color);
328+ glDrawArrays(GL_LINES, 0, 6);
329+ /*
330+ Color bar/circle/cube
331+ */
307332 if (color_scale == 1 || color_scale == 4) {
308333 for (i = 0; i < 5; i++) {
309334 for (j = 0; j < 2; j++) {
310335 vertices[0 + j * 3 + i * 6] = -1.0f + 0.5f*(GLfloat)i;
311336 vertices[1 + j * 3 + i * 6] = -1.0f - 0.1f*(GLfloat)j;
312337 vertices[2 + j * 3 + i * 6] = 0.0f;
313- if ( i == 0) for (k = 0; k < 4; k++) colors[k + 4 * j + 8 * i] = blue[k];
314- else if (i == 1) for (k = 0; k < 4; k++) colors[k + 4 * j + 8 * i] = cyan[k];
315- else if (i == 2) for (k = 0; k < 4; k++) colors[k + 4 * j + 8 * i] = green[k];
316- else if (i == 3) for (k = 0; k < 4; k++) colors[k + 4 * j + 8 * i] = yellow[k];
317- else if (i == 4) for (k = 0; k < 4; k++) colors[k + 4 * j + 8 * i] = red[k];
338+ for (k = 0; k < 4; k++) colors[k + 4 * j + 8 * i] = BarColor[i][k];
318339 }
319340 }/*for (i = 0; i < 10; i++)*/
320341 glNormal3f(0.0f, 0.0f, 1.0f);
@@ -329,10 +350,7 @@ static void draw_colorbar()
329350 vertices[0] = 0.0f;
330351 vertices[1] = -1.0f;
331352 vertices[2] = 0.0f;
332- if (blackback == 1)
333- for (j = 0; j < 4; j++) colors[j] = wgray[j];
334- else
335- for (j = 0; j < 4; j++) colors[j] = bgray[j];
353+ for (j = 0; j < 4; j++) colors[j] = 1.0f - BackGroundColor[j];
336354 /**/
337355 for (i = 0; i <= 60; i++) {
338356 /**/
@@ -408,8 +426,7 @@ static void draw_circles(
408426 vertices[2 + (i + 1) * 3] = 0.0f;
409427 }/*for (i = 0; i <= 20; i++)*/
410428 glNormal3f(0.0f, 0.0f, 1.0f);
411- if (blackback == 1) glColor3fv(white);
412- else glColor3fv(black);
429+ glColor3fv(LineColor);
413430 glVertexPointer(3, GL_FLOAT, 0, vertices);
414431 glDrawArrays(GL_TRIANGLE_FAN, 0, 22);
415432 /**/
@@ -431,8 +448,7 @@ static void draw_fermi_line() {
431448 for (i = 0; i < 3; i++) vertices[i + 3 * ibzl] = bzl2d_proj[ibzl][i];
432449 }/*for (ibzl = 0; ibzl < nbzl2d; ++ibzl)*/
433450 glNormal3f(0.0f, 0.0f, 1.0f);
434- if (blackback == 1)glColor3fv(white);
435- else glColor3fv(black);
451+ glColor3fv(LineColor);
436452 glVertexPointer(3, GL_FLOAT, 0, vertices);
437453 glDrawArrays(GL_LINE_LOOP, 0, nbzl2d);
438454 /*
--- a/src/equator.cpp
+++ b/src/equator.cpp
@@ -38,23 +38,13 @@ THE SOFTWARE.
3838 #include <cstdlib>
3939 #include <cmath>
4040 #include "basic_math.hpp"
41+#include "variable.hpp"
4142 /**
4243 @brief Compute equator \f$\{\bf v}_{n k} \cdot {\bf k} = 0\f$
4344
4445 Modify : ::nequator, ::kveq, ::kveq_rot
4546 */
46-void equator(
47-int nb,
48-int nthreads,
49-GLfloat eqvec[3],
50-int *ntri,
51-GLfloat ****kvp,
52-GLfloat ****nmlp,
53-wxTextCtrl* terminal,
54-int *nequator,
55-GLfloat ****kveq,
56-GLfloat **kveq_rot
57-) {
47+void equator() {
5848 int ib, itri, i, j, ithread, nequator0;
5949 std::vector<std::vector<std::vector<std::vector<GLfloat>>>> kveq_v;
6050
--- a/src/equator.hpp
+++ b/src/equator.hpp
@@ -21,14 +21,4 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2121 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222 THE SOFTWARE.
2323 */
24-#if defined(HAVE_CONFIG_H)
25-#include <config.h>
26-#endif
27-#if defined(HAVE_GL_GL_H)
28-#include <GL/gl.h>
29-#elif defined(HAVE_OPENGL_GL_H)
30-#include <OpenGL/gl.h>
31-#endif
32-#include <wx/wx.h>
33-void equator(int nb, int nthreads, GLfloat eqvec[3], int* ntri, GLfloat**** kvp,
34- GLfloat**** nmlp, wxTextCtrl* terminal, int* nequator, GLfloat**** kveq, GLfloat** kveq_rot);
24+void equator();
--- a/src/fermi_patch.cpp
+++ b/src/fermi_patch.cpp
@@ -38,6 +38,7 @@ THE SOFTWARE.
3838 #include <cstdio>
3939 #include <cmath>
4040 #include "basic_math.hpp"
41+#include "variable.hpp"
4142 /**
4243 @brief Store triangle patch
4344
@@ -77,11 +78,6 @@ static void triangle(
7778 GLfloat mat1[3][3], //!<[in] The matrix element
7879 GLfloat kvec1[3][3], //!<[in] @f$k@f$-vector of corners
7980 GLfloat vf1[3][3], //!<[in] @f$v_f@f$-vector of corners
80- int fbz,
81- int nbragg,
82- GLfloat bragg[26][3],
83- GLfloat brnrm[26],
84- GLfloat brnrm_min,
8581 std::vector<std::vector<std::vector<GLfloat> > > &kvp_v,
8682 std::vector<std::vector<std::vector<GLfloat> > > &matp_v,
8783 std::vector<std::vector<std::vector<GLfloat> > > &nmlp_v
@@ -147,8 +143,7 @@ static void triangle(
147143 vf2[i][j] = vf1[sw[i]][j];
148144 }
149145 }
150- triangle(ibr + 1, mat2, kvec2, vf2, fbz, nbragg,
151- bragg, brnrm, brnrm_min, kvp_v, matp_v, nmlp_v);
146+ triangle(ibr + 1, mat2, kvec2, vf2, kvp_v, matp_v, nmlp_v);
152147 return;
153148 }
154149 else if (brnrm[ibr] < prod[sw[1]]) {
@@ -168,8 +163,7 @@ static void triangle(
168163 vf2[1][i] = vf1[sw[0]][i] * a[0][1] + vf1[sw[1]][i] * a[1][0];
169164 vf2[2][i] = vf1[sw[0]][i] * a[0][2] + vf1[sw[2]][i] * a[2][0];
170165 }/*for (i = 0; i < 3; ++i)*/
171- triangle(ibr + 1, mat2, kvec2, vf2, fbz, nbragg,
172- bragg, brnrm, brnrm_min, kvp_v, matp_v, nmlp_v);
166+ triangle(ibr + 1, mat2, kvec2, vf2, kvp_v, matp_v, nmlp_v);
173167
174168 for (i = 0; i < 3; ++i) {
175169 kvec2[0][i] = kvec1[sw[0]][i] * a[0][1] + kvec1[sw[1]][i] * a[1][0];
@@ -186,8 +180,7 @@ static void triangle(
186180 }/*for (i = 0; i < 3; ++i)*/
187181 for (i = 0; i < 3; ++i) for (j = 0; j < 3; ++j)
188182 kvec2[i][j] += bshift * bragg[ibr][j];
189- triangle(ibr + 1, mat2, kvec2, vf2, fbz, nbragg,
190- bragg, brnrm, brnrm_min, kvp_v, matp_v, nmlp_v);
183+ triangle(ibr + 1, mat2, kvec2, vf2, kvp_v, matp_v, nmlp_v);
191184
192185 for (i = 0; i < 3; ++i) {
193186 kvec2[0][i] = kvec1[sw[2]][i];
@@ -204,8 +197,7 @@ static void triangle(
204197 }/*for (i = 0; i < 3; ++i)*/
205198 for (i = 0; i < 3; ++i) for (j = 0; j < 3; ++j)
206199 kvec2[i][j] += bshift * bragg[ibr][j];
207- triangle(ibr + 1, mat2, kvec2, vf2, fbz, nbragg,
208- bragg, brnrm, brnrm_min, kvp_v, matp_v, nmlp_v);
200+ triangle(ibr + 1, mat2, kvec2, vf2, kvp_v, matp_v, nmlp_v);
209201 return;
210202 }
211203 else if (brnrm[ibr] < prod[sw[2]]) {
@@ -227,8 +219,7 @@ static void triangle(
227219 }/*for (i = 0; i < 3; ++i)*/
228220 for (i = 0; i < 3; ++i) for (j = 0; j < 3; ++j)
229221 kvec2[i][j] += bshift * bragg[ibr][j];
230- triangle(ibr + 1, mat2, kvec2, vf2, fbz, nbragg,
231- bragg, brnrm, brnrm_min, kvp_v, matp_v, nmlp_v);
222+ triangle(ibr + 1, mat2, kvec2, vf2, kvp_v, matp_v, nmlp_v);
232223
233224 for (i = 0; i < 3; ++i) {
234225 kvec2[0][i] = kvec1[sw[0]][i];
@@ -243,8 +234,7 @@ static void triangle(
243234 vf2[1][i] = vf1[sw[1]][i];
244235 vf2[2][i] = vf1[sw[0]][i] * a[0][2] + vf1[sw[2]][i] * a[2][0];
245236 }/*for (i = 0; i < 3; ++i)*/
246- triangle(ibr + 1, mat2, kvec2, vf2, fbz, nbragg,
247- bragg, brnrm, brnrm_min, kvp_v, matp_v, nmlp_v);
237+ triangle(ibr + 1, mat2, kvec2, vf2, kvp_v, matp_v, nmlp_v);
248238
249239 for (i = 0; i < 3; ++i) {
250240 kvec2[0][i] = kvec1[sw[1]][i] * a[1][2] + kvec1[sw[2]][i] * a[2][1];
@@ -259,8 +249,7 @@ static void triangle(
259249 vf2[1][i] = vf1[sw[1]][i];
260250 vf2[2][i] = vf1[sw[0]][i] * a[0][2] + vf1[sw[2]][i] * a[2][0];
261251 }/*for (i = 0; i < 3; ++i)*/
262- triangle(ibr + 1, mat2, kvec2, vf2, fbz, nbragg,
263- bragg, brnrm, brnrm_min, kvp_v, matp_v, nmlp_v);
252+ triangle(ibr + 1, mat2, kvec2, vf2, kvp_v, matp_v, nmlp_v);
264253 return;
265254 }
266255 else {
@@ -332,13 +321,6 @@ static void tetrahedron(
332321 GLfloat mat1[8][3], //!< [in] Matrix elements @f$\Delta_{n k}@f$
333322 GLfloat kvec1[8][3], //!< [in] @f$k@f$-vectors
334323 GLfloat vf1[8][3], //!< [in] @f$v_f@f$-vectors
335- int corner[6][4],
336- GLfloat bvec[3][3],
337- int fbz,
338- int nbragg,
339- GLfloat bragg[26][3],
340- GLfloat brnrm[26],
341- GLfloat brnrm_min,
342324 std::vector<std::vector<std::vector<GLfloat> > > &kvp_v,
343325 std::vector<std::vector<std::vector<GLfloat> > > &matp_v,
344326 std::vector<std::vector<std::vector<GLfloat> > > &nmlp_v
@@ -392,8 +374,7 @@ static void tetrahedron(
392374 }
393375
394376 vol = a[1][0] * a[2][0] * a[3][0];
395- triangle(0, mat3, kvec3, vf3, fbz, nbragg,
396- bragg, brnrm, brnrm_min, kvp_v, matp_v, nmlp_v);
377+ triangle(0, mat3, kvec3, vf3, kvp_v, matp_v, nmlp_v);
397378 }
398379 else if (eig2[sw[1]] <= 0.0 && 0.0 < eig2[sw[2]]) {
399380 for (i = 0; i < 3; ++i) {
@@ -411,8 +392,7 @@ static void tetrahedron(
411392 }
412393
413394 vol = a[1][2] * a[2][0] * a[3][0];
414- triangle(0, mat3, kvec3, vf3, fbz, nbragg,
415- bragg, brnrm, brnrm_min, kvp_v, matp_v, nmlp_v);
395+ triangle(0, mat3, kvec3, vf3, kvp_v, matp_v, nmlp_v);
416396 /**/
417397 for (i = 0; i < 3; ++i) {
418398 kvec3[0][i] = kvec2[sw[1]][i] * a[1][3] + kvec2[sw[3]][i] * a[3][1];
@@ -429,8 +409,7 @@ static void tetrahedron(
429409 }
430410
431411 vol = a[1][3] * a[3][0] * a[2][1];
432- triangle(0, mat3, kvec3, vf3, fbz, nbragg,
433- bragg, brnrm, brnrm_min, kvp_v, matp_v, nmlp_v);
412+ triangle(0, mat3, kvec3, vf3, kvp_v, matp_v, nmlp_v);
434413 }
435414 else if (eig2[sw[2]] <= 0.0 && 0.0 < eig2[sw[3]]) {
436415 for (i = 0; i < 3; ++i) {
@@ -448,8 +427,7 @@ static void tetrahedron(
448427 }
449428
450429 vol = a[0][3] * a[1][3] * a[2][3];
451- triangle(0, mat3, kvec3, vf3, fbz, nbragg,
452- bragg, brnrm, brnrm_min, kvp_v, matp_v, nmlp_v);
430+ triangle(0, mat3, kvec3, vf3, kvp_v, matp_v, nmlp_v);
453431 }
454432 else {
455433 }
@@ -460,34 +438,7 @@ static void tetrahedron(
460438
461439 Modify : ::ntri, nmlp, ::matp, ::kvp, ::clr, ::nmlp_rot, ::kvp_rot
462440 */
463-void fermi_patch(
464- int nb,
465- int nthreads,
466- int ng[3],
467- int ng0[3],
468- int shiftk[3],
469- int fbz,
470- GLfloat ****eig,
471- GLfloat EF,
472- GLfloat *****mat,
473- GLfloat *****vf,
474- int corner[6][4],
475- GLfloat bvec[3][3],
476- int nbragg,
477- GLfloat bragg[26][3],
478- GLfloat brnrm[26],
479- GLfloat brnrm_min,
480- wxTextCtrl* terminal,
481- int *ntri,
482- GLfloat ****kvp,
483- GLfloat ****matp,
484- GLfloat **clr,
485- GLfloat *****arw,
486- GLfloat ****nmlp,
487- GLfloat **kvp_rot,
488- GLfloat **nmlp_rot,
489- GLfloat **arw_rot
490- )
441+void fermi_patch()
491442 {
492443 int ntri0, ib, i0, i1, j0, start[3], last[3];
493444 int ithread;
@@ -610,8 +561,7 @@ private(j0,i0,i1,ithread)
610561 vf1[7][j] = vf[ib][ii0][ii1][ii2][j];
611562 }/*for (j = 0; j < 3; j++)*/
612563 /**/
613- tetrahedron(eig1, mat1, kvec1, vf1, corner,
614- bvec, fbz, nbragg, bragg, brnrm, brnrm_min,
564+ tetrahedron(eig1, mat1, kvec1, vf1,
615565 kvp_v.at(ithread), matp_v.at(ithread), nmlp_v.at(ithread));
616566 }/*for (j0 = start[0]; j0 < ng[0]; ++j0)*/
617567 }/*for (j1 = start[1]; j1 < ng[1]; ++j1)*/
--- a/src/fermi_patch.hpp
+++ b/src/fermi_patch.hpp
@@ -21,17 +21,4 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2121 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222 THE SOFTWARE.
2323 */
24-#if defined(HAVE_CONFIG_H)
25-#include <config.h>
26-#endif
27-#if defined(HAVE_GL_GL_H)
28-#include <GL/gl.h>
29-#elif defined(HAVE_OPENGL_GL_H)
30-#include <OpenGL/gl.h>
31-#endif
32-#include <wx/wx.h>
33-
34-void fermi_patch(int nb, int nthreads, int ng[3], int ng0[3], int shiftk[3],
35- int fbz, GLfloat**** eig, GLfloat EF, GLfloat***** mat, GLfloat***** vf, int corner[6][4], GLfloat bvec[3][3], int nbragg,
36- GLfloat bragg[26][3], GLfloat brnrm[26], GLfloat brnrm_min, wxTextCtrl* terminal, int* ntri, GLfloat**** kvp, GLfloat**** matp,
37- GLfloat** clr, GLfloat***** arw, GLfloat**** nmlp, GLfloat** kvp_rot, GLfloat** nmlp_rot, GLfloat** arw_rot);
24+void fermi_patch();
--- a/src/fermisurfer.cpp
+++ b/src/fermisurfer.cpp
@@ -112,7 +112,6 @@ int interpol = 1; //!< Ratio of interpolation
112112 /*
113113 Switch for some modes
114114 */
115-int blackback = 1; //!< Switch for black background
116115 int color_scale = 1; //!< Switch for full color scale mode
117116 int fbz = 1; //!< Switch for 1st Brillouin zone mode
118117 int nodeline = 0; //!< Switch for node lines
@@ -204,6 +203,10 @@ GLfloat yellow[4] = { 1.0, 1.0, 0.0, 1.0 }; //!< Yellow color code
204203 GLfloat red[4] = { 1.0, 0.0, 0.0, 1.0 }; //!< Red color code
205204 GLfloat green[4] = { 0.0, 1.0, 0.0, 1.0 }; //!< Green color code
206205 GLfloat blue[4] = { 0.0, 0.0, 1.0, 1.0 }; //!< Blue color code
206+GLfloat BackGroundColor[4] = { 0.0, 0.0, 0.0, 1.0 };//!< BackGround color code
207+GLfloat LineColor[4] = { 1.0, 1.0, 1.0, 1.0 };//!< Line color code
208+GLfloat BarColor[5][4] = { { 0.0, 0.0, 1.0, 1.0 } , { 0.0, 1.0, 1.0, 1.0 } ,
209+{ 0.0, 1.0, 0.0, 1.0 } ,{ 1.0, 1.0, 0.0, 1.0 } ,{ 1.0, 0.0, 0.0, 1.0 } };
207210 /*
208211 Others
209212 */
@@ -311,19 +314,17 @@ bool MyApp::OnInit()
311314 kveq = new GLfloat *** [nb];
312315 kveq_rot = new GLfloat *[nb];
313316 /**/
314- interpol_energy(avec, nb, interpol, ng0, ng,
315- terminal, eig, vf, mat, eig0, mat0);
316- init_corner(itet, corner);
317- bragg_vector(terminal, bvec, bragg, brnrm, &brnrm_min);
317+ interpol_energy();
318+ init_corner();
319+ bragg_vector();
318320 myf->modify_band();
319321 /*
320322 Brillouin zone
321323 */
322- bz_lines(terminal, bragg, brnrm, &nbzl, bzl, &nbragg);
323- calc_2dbz(fbz, secvec, secscale, axis2d,
324- &nbzl2d, nbragg, bragg, brnrm, bzl2d, bzl2d_proj);
324+ bz_lines();
325+ calc_2dbz();
325326 /**/
326- max_and_min_bz(terminal, nb, ng0, eig0, mat0);
327+ max_and_min_bz();
327328 /**/
328329 compute_patch_segment();
329330 /*
--- a/src/free_patch.cpp
+++ b/src/free_patch.cpp
@@ -44,36 +44,15 @@ THE SOFTWARE.
4444 #include <cstdio>
4545 #include "basic_math.hpp"
4646 #include "menu.hpp"
47+#include "variable.hpp"
4748 /**
4849 @brief Free variables for patch before new patch is computed
4950
5051 Free : ::nmlp, ::matp, ::clr, ::kvp, ::nmlp_rot, ::kvp_rot,
5152 ::kvnl, ::kvnl_rot, ::kv2d, ::clr2d
5253 */
53-void free_patch(
54- int nb,
55- int refresh_patch,
56- int *ntri,
57- GLfloat ****kvp,
58- GLfloat **kvp_rot,
59- GLfloat ****matp,
60- GLfloat** clr,
61- GLfloat ****nmlp,
62- GLfloat **nmlp_rot,
63- GLfloat *****arw,
64- GLfloat **arw_rot,
65- int refresh_nodeline,
66- int *nnl,
67- GLfloat ****kvnl,
68- GLfloat **kvnl_rot,
69- int refresh_section,
70- GLfloat **kv2d,
71- GLfloat **clr2d,
72- int refresh_equator,
73- int *nequator,
74- GLfloat ****kveq,
75- GLfloat **kveq_rot
76-) {
54+void free_patch()
55+{
7756 int ib, i0, i1, i2;
7857 /*
7958 Fermi patch
@@ -150,18 +129,7 @@ void free_patch(
150129
151130 Modify : ::clr
152131 */
153-void max_and_min(
154- int nb,
155- int nthreads,
156- wxTextCtrl *terminal,
157- MyFrame *myf,
158- int color_scale,
159- int *ntri,
160- GLfloat ****matp,
161- GLfloat *patch_min,
162- GLfloat *patch_max,
163- GLfloat ****nmlp
164-)
132+void max_and_min()
165133 {
166134 int itri, ithread;
167135 GLfloat *max_th, *min_th;
@@ -201,11 +169,11 @@ shared(nb,ntri,matp,max_th,min_th) private(itri,ithread)
201169 }/*for (ib = 0; ib < nb; ib++)*/
202170 }/*End of parallel region*/
203171 /**/
204- *patch_max = max_th[0];
205- *patch_min = min_th[0];
172+ patch_max = max_th[0];
173+ patch_min = min_th[0];
206174 for (ithread = 1; ithread < nthreads; ithread++) {
207- if (max_th[ithread] > *patch_max) *patch_max = max_th[ithread];
208- if (min_th[ithread] < *patch_min) *patch_min = min_th[ithread];
175+ if (max_th[ithread] > patch_max) patch_max = max_th[ithread];
176+ if (min_th[ithread] < patch_min) patch_min = min_th[ithread];
209177 }
210178 }/*if (color_scale == 0 || color_scale == 4)*/
211179 else if (color_scale == 2) {
@@ -232,11 +200,11 @@ shared(nb,ntri,matp,max_th,min_th) private(itri,ithread)
232200 }/*for (ib = 0; ib < nb; ib++)*/
233201 }/*End of parallel region*/
234202 /**/
235- *patch_min = min_th[0];
236- *patch_max = max_th[0];
203+ patch_min = min_th[0];
204+ patch_max = max_th[0];
237205 for (ithread = 1; ithread < nthreads; ithread++) {
238- if (max_th[ithread] < *patch_min) *patch_min = max_th[ithread];
239- if (max_th[ithread] > *patch_max) *patch_max = max_th[ithread];
206+ if (max_th[ithread] < patch_min) patch_min = max_th[ithread];
207+ if (max_th[ithread] > patch_max) patch_max = max_th[ithread];
240208 }
241209 }/*if (color_scale == 2)*/
242210 else if (color_scale == 3) {
@@ -264,11 +232,11 @@ shared(nb,ntri,matp,min_th,max_th) private(itri,ithread)
264232 }/*for (ib = 0; ib < nb; ib++)*/
265233 }/*End of parallel region*/
266234 /**/
267- *patch_max = max_th[0];
268- *patch_min = min_th[0];
235+ patch_max = max_th[0];
236+ patch_min = min_th[0];
269237 for (ithread = 1; ithread < nthreads; ithread++) {
270- if (max_th[ithread] > *patch_max) *patch_max = max_th[ithread];
271- if (min_th[ithread] < *patch_min) *patch_min = min_th[ithread];
238+ if (max_th[ithread] > patch_max) patch_max = max_th[ithread];
239+ if (min_th[ithread] < patch_min) patch_min = min_th[ithread];
272240 }
273241 }/*if (color_scale == 3)*/
274242 else if (color_scale == 4 || color_scale == 7) {
@@ -297,19 +265,19 @@ shared(nb,ntri,nmlp,max_th,min_th) private(itri,ithread)
297265 }/*for (ib = 0; ib < nb; ib++)*/
298266 }/*End of parallel region*/
299267 /**/
300- *patch_max = max_th[0];
301- *patch_min = min_th[0];
268+ patch_max = max_th[0];
269+ patch_min = min_th[0];
302270 for (ithread = 1; ithread < nthreads; ithread++) {
303- if (max_th[ithread] > *patch_max) *patch_max = max_th[ithread];
304- if (min_th[ithread] < *patch_min) *patch_min = min_th[ithread];
271+ if (max_th[ithread] > patch_max) patch_max = max_th[ithread];
272+ if (min_th[ithread] < patch_min) patch_min = min_th[ithread];
305273 }
306274 }/*if (color_scale == 5 || color_scale == 6)*/
307275
308276 delete[] max_th;
309277 delete[] min_th;
310278
311- myf->textbox_min->ChangeValue(wxString::Format(wxT("%f"), *patch_min));
312- myf->textbox_max->ChangeValue(wxString::Format(wxT("%f"), *patch_max));
279+ myf->textbox_min->ChangeValue(wxString::Format(wxT("%f"), patch_min));
280+ myf->textbox_max->ChangeValue(wxString::Format(wxT("%f"), patch_max));
313281 }/* max_and_min */
314282 /**
315283 @brief Compute Max. & Min. of matrix elements.
@@ -317,34 +285,14 @@ shared(nb,ntri,nmlp,max_th,min_th) private(itri,ithread)
317285
318286 Modify : ::clr
319287 */
320-void paint(
321- int nb,
322- int color_scale,
323- int blackback,
324- int *ntri,
325- GLfloat patch_min,
326- GLfloat patch_max,
327- GLfloat ****kvp,
328- GLfloat ****matp,
329- GLfloat **clr,
330- GLfloat ****nmlp,
331- GLfloat *****arw,
332- GLfloat red[4],
333- GLfloat green[4],
334- GLfloat blue[4],
335- GLfloat cyan[4],
336- GLfloat magenta[4],
337- GLfloat yellow[4],
338- GLfloat wgray[4],
339- GLfloat bgray[4]
340-)
288+void paint()
341289 {
342290 int itri, j;
343291 GLfloat origin[4];
344292
345293 if (color_scale == 1) {
346294 #pragma omp parallel default(none) \
347-shared(nb,ntri,matp,clr,cyan,blue,green,yellow,red,patch_max,patch_min) \
295+shared(nb,ntri,matp,clr,BarColor,patch_max,patch_min) \
348296 private(itri, j)
349297 {
350298 int i, ib;
@@ -359,19 +307,23 @@ private(itri, j)
359307 mat2 = mat2 * 4.0f;
360308 /**/
361309 if (mat2 <= 1.0) {
362- for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] = cyan[j] * mat2 + blue[j] * (1.0f - mat2);
310+ for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri]
311+ = BarColor[1][j] * mat2 + BarColor[0][j] * (1.0f - mat2);
363312 }
364313 else if (mat2 <= 2.0) {
365314 mat2 = mat2 - 1.0f;
366- for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] = green[j] * mat2 + cyan[j] * (1.0f - mat2);
315+ for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri]
316+ = BarColor[2][j] * mat2 + BarColor[1][j] * (1.0f - mat2);
367317 }
368318 else if (mat2 <= 3.0) {
369319 mat2 = mat2 - 2.0f;
370- for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] = yellow[j] * mat2 + green[j] * (1.0f - mat2);
320+ for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri]
321+ = BarColor[3][j] * mat2 + BarColor[2][j] * (1.0f - mat2);
371322 }
372323 else {
373324 mat2 = mat2 - 3.0f;
374- for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] = red[j] * mat2 + yellow[j] * (1.0f - mat2);
325+ for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri]
326+ = BarColor[4][j] * mat2 + BarColor[3][j] * (1.0f - mat2);
375327 }
376328 }/*for (i = 0; i < 3; ++i)*/
377329 }/*for (itri = 0; itri < ntri[ib]; ++itri)*/
@@ -380,11 +332,10 @@ private(itri, j)
380332 }/*if (color_scale == 1 || color_scale == 2)*/
381333 else if (color_scale == 2) {
382334
383- if (blackback == 1) for (j = 0; j < 4; ++j) origin[j] = wgray[j];
384- else for (j = 0; j < 4; ++j) origin[j] = bgray[j];
335+ for (j = 0; j < 4; ++j) origin[j] = 1.0f - BackGroundColor[j];
385336
386337 #pragma omp parallel default(none) \
387-shared(nb,ntri,matp,clr,cyan,blue,green,yellow,red,magenta,bgray,wgray,blackback,patch_max,origin) \
338+shared(nb,ntri,matp,clr,cyan,blue,green,yellow,red,magenta,bgray,wgray,patch_max,origin) \
388339 private(itri, j)
389340 {
390341 int i, ib;
@@ -441,7 +392,7 @@ private(itri, j)
441392 }/*if (color_scale == 2)*/
442393 else if (color_scale == 4) {
443394 #pragma omp parallel default(none) \
444-shared(nb,ntri,nmlp,clr,cyan,blue,green,yellow,red,patch_max,patch_min) \
395+shared(nb,ntri,nmlp,clr,BarColor,patch_max,patch_min) \
445396 private(itri, j)
446397 {
447398 int i, ib;
@@ -459,19 +410,23 @@ private(itri, j)
459410 mat2 = mat2 * 4.0f;
460411 /**/
461412 if (mat2 <= 1.0) {
462- for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] = cyan[j] * mat2 + blue[j] * (1.0f - mat2);
413+ for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri]
414+ = BarColor[1][j] * mat2 + BarColor[0][j] * (1.0f - mat2);
463415 }
464416 else if (mat2 <= 2.0) {
465417 mat2 = mat2 - 1.0f;
466- for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] = green[j] * mat2 + cyan[j] * (1.0f - mat2);
418+ for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri]
419+ = BarColor[2][j] * mat2 + BarColor[1][j] * (1.0f - mat2);
467420 }
468421 else if (mat2 <= 3.0) {
469422 mat2 = mat2 - 2.0f;
470- for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] = yellow[j] * mat2 + green[j] * (1.0f - mat2);
423+ for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri]
424+ = BarColor[3][j] * mat2 + BarColor[2][j] * (1.0f - mat2);
471425 }
472426 else {
473427 mat2 = mat2 - 3.0f;
474- for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] = red[j] * mat2 + yellow[j] * (1.0f - mat2);
428+ for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri]
429+ = BarColor[4][j] * mat2 + BarColor[3][j] * (1.0f - mat2);
475430 }
476431 }/*for (i = 0; i < 3; ++i)*/
477432 }/*for (itri = 0; itri < ntri[ib]; ++itri)*/
@@ -480,7 +435,7 @@ private(itri, j)
480435 }/*if (color_scale == 4)*/
481436 else if (color_scale == 3 || color_scale == 5) {
482437 #pragma omp parallel default(none) \
483-shared(nb,ntri,matp,clr,cyan,blue,green,yellow,red,color_scale,kvp,arw,patch_max) \
438+shared(nb,ntri,matp,clr,BarColor,color_scale,kvp,arw,patch_max) \
484439 private(itri, j)
485440 {
486441 int i, ib;
@@ -496,7 +451,8 @@ private(itri, j)
496451 #pragma omp for nowait
497452 for (itri = 0; itri < ntri[ib]; ++itri) {
498453 for (i = 0; i < 3; ++i) {
499- for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] = cyan[j] * mat2 + blue[j] * (1.0f - mat2);
454+ for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri]
455+ = BarColor[1][j] * mat2 + BarColor[0][j] * (1.0f - mat2);
500456 }
501457 }
502458 }
@@ -505,7 +461,8 @@ private(itri, j)
505461 #pragma omp for nowait
506462 for (itri = 0; itri < ntri[ib]; ++itri) {
507463 for (i = 0; i < 3; ++i) {
508- for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] = green[j] * mat2 + cyan[j] * (1.0f - mat2);
464+ for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri]
465+ = BarColor[2][j] * mat2 + BarColor[1][j] * (1.0f - mat2);
509466 }
510467 }
511468 }
@@ -514,7 +471,8 @@ private(itri, j)
514471 #pragma omp for nowait
515472 for (itri = 0; itri < ntri[ib]; ++itri) {
516473 for (i = 0; i < 3; ++i) {
517- for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] = yellow[j] * mat2 + green[j] * (1.0f - mat2);
474+ for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri]
475+ = BarColor[3][j] * mat2 + BarColor[2][j] * (1.0f - mat2);
518476 }
519477 }
520478 }
@@ -523,7 +481,8 @@ private(itri, j)
523481 #pragma omp for nowait
524482 for (itri = 0; itri < ntri[ib]; ++itri) {
525483 for (i = 0; i < 3; ++i) {
526- for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri] = red[j] * mat2 + yellow[j] * (1.0f - mat2);
484+ for (j = 0; j < 4; ++j) clr[ib][j + 4 * i + 12 * itri]
485+ = BarColor[4][j] * mat2 + BarColor[3][j] * (1.0f - mat2);
527486 }
528487 }
529488 }
--- a/src/free_patch.hpp
+++ b/src/free_patch.hpp
@@ -21,29 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2121 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222 THE SOFTWARE.
2323 */
24-#if defined(HAVE_CONFIG_H)
25-#include <config.h>
26-#endif
27-#if defined(HAVE_GL_GL_H)
28-#include <GL/gl.h>
29-#elif defined(HAVE_OPENGL_GL_H)
30-#include <OpenGL/gl.h>
31-#endif
32-#include "menu.hpp"
33-void free_patch(int nb, int refresh_patch,
34- int* ntri, GLfloat**** kvp, GLfloat** kvp_rot, GLfloat**** matp,
35- GLfloat** clr, GLfloat**** nmlp, GLfloat** nmlp_rot, GLfloat***** arw,
36- GLfloat** arw_rot, int refresh_nodeline, int* nnl, GLfloat**** kvnl,
37- GLfloat** kvnl_rot, int refresh_section, GLfloat** kv2d, GLfloat** clr2d,
38- int refresh_equator, int* nequator, GLfloat**** kveq, GLfloat** kveq_rot);
39-void max_and_min(int nb, int nthreads, wxTextCtrl* terminal,
40- MyFrame* myf, int color_scale, int* ntri, GLfloat**** matp,
41- GLfloat *patch_min, GLfloat *patch_max, GLfloat**** nmlp);
42-void paint(int nb, int color_scale, int blackback,
43- int* ntri, GLfloat patch_min, GLfloat patch_max,
44- GLfloat**** kvp, GLfloat**** matp, GLfloat** clr,
45- GLfloat**** nmlp, GLfloat***** arw,
46- GLfloat red[4], GLfloat green[4], GLfloat blue[4],
47- GLfloat cyan[4], GLfloat magenta[4], GLfloat yellow[4],
48- GLfloat wgray[4], GLfloat bgray[4]);
24+void free_patch();
25+void max_and_min();
26+void paint();
4927
--- a/src/initialize.cpp
+++ b/src/initialize.cpp
@@ -33,16 +33,14 @@ THE SOFTWARE.
3333 #elif defined(HAVE_OPENGL_GL_H)
3434 #include <OpenGL/gl.h>
3535 #endif
36-
36+#include "variable.hpp"
3737 /**
3838 @brief Specify corners of tetrahedron
3939
4040 Modify : ::corner
4141 */
42-void init_corner(
43- int itet,
44- int corner[6][4]
45-) {
42+void init_corner()
43+{
4644 int i, j;
4745 int corner1[16][6][4] = {
4846 /*
@@ -202,13 +200,8 @@ void init_corner(
202200
203201 Modify : ::bragg, ::brnrm
204202 */
205-void bragg_vector(
206- wxTextCtrl *terminal,
207- GLfloat bvec[3][3],
208- GLfloat bragg[26][3],
209- GLfloat brnrm[26],
210- GLfloat *brnrm_min
211-) {
203+void bragg_vector()
204+{
212205 int i0, i1, i2, i, ibr;
213206 /**/
214207 ibr = 0;
@@ -241,23 +234,18 @@ void bragg_vector(
241234 /*
242235 Search min. of brnrm
243236 */
244- *brnrm_min = brnrm[0];
237+ brnrm_min = brnrm[0];
245238 for (ibr = 1; ibr < 26; ibr++) {
246- if (*brnrm_min > brnrm[ibr]) *brnrm_min = brnrm[ibr];
239+ if (brnrm_min > brnrm[ibr]) brnrm_min = brnrm[ibr];
247240 }
248- *terminal << wxString::Format(wxT(" Minimum Bragg norm : %f\n"), *brnrm_min);
241+ *terminal << wxString::Format(wxT(" Minimum Bragg norm : %f\n"), brnrm_min);
249242 }/* bragg_vector */
250243 /**
251244 @brief Print max and minimum @f$\varepsilon_{n k}, \Delta_{n k}@f$
252245 in the whole Brillouine zone
253246 */
254-void max_and_min_bz(
255- wxTextCtrl* terminal,
256- int nb,
257- int ng0[3],
258- GLfloat**** eig0,
259- GLfloat***** mat0
260-) {
247+void max_and_min_bz()
248+{
261249 int ib, i0, i1, i2;
262250 GLfloat eigmin, eigmax, matmin, matmax;
263251 /**/
--- a/src/initialize.hpp
+++ b/src/initialize.hpp
@@ -21,16 +21,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2121 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222 THE SOFTWARE.
2323 */
24-#include <wx/wx.h>
25-#if defined(HAVE_CONFIG_H)
26-#include <config.h>
27-#endif
28-#if defined(HAVE_GL_GL_H)
29-#include <GL/gl.h>
30-#elif defined(HAVE_OPENGL_GL_H)
31-#include <OpenGL/gl.h>
32-#endif
33-
34-void init_corner(int itet, int corner[6][4]);
35-void bragg_vector(wxTextCtrl* terminal, GLfloat bvec[3][3], GLfloat bragg[26][3], GLfloat brnrm[26], GLfloat *brnrm_min);
36-void max_and_min_bz(wxTextCtrl* terminal, int nb, int ng0[3], GLfloat ****eig0, GLfloat *****mat0);
24+void init_corner();
25+void bragg_vector();
26+void max_and_min_bz();
--- a/src/kumo.cpp
+++ b/src/kumo.cpp
@@ -37,6 +37,7 @@ denser @f$k@f$-grid with French-curve (Kumo) interpolation
3737 #include <cstdlib>
3838 #include <cstdio>
3939 #include "basic_math.hpp"
40+#include "variable.hpp"
4041 /**
4142 @brief Compute coefficient for the French-curve (Kumo) interpolation
4243 @f[
@@ -62,19 +63,8 @@ static void kumo_coef(
6263
6364 Modify : ::eig, ::mat
6465 */
65-void interpol_energy(
66- GLfloat avec[3][3],
67- int nb,
68- int interpol,
69- int ng0[3],
70- int ng[3],
71- wxTextCtrl *terminal,
72- GLfloat ****eig,
73- GLfloat *****vf,
74- GLfloat *****mat,
75- GLfloat**** eig0,
76- GLfloat***** mat0
77-) {
66+void interpol_energy()
67+{
7868 int ib, i0, i1, i2, ii;
7969
8070 *terminal << wxT(" Interpolating ... ");
--- a/src/kumo.hpp
+++ b/src/kumo.hpp
@@ -21,15 +21,4 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2121 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222 THE SOFTWARE.
2323 */
24-#if defined(HAVE_CONFIG_H)
25-#include <config.h>
26-#endif
27-#if defined(HAVE_GL_GL_H)
28-#include <GL/gl.h>
29-#elif defined(HAVE_OPENGL_GL_H)
30-#include <OpenGL/gl.h>
31-#endif
32-#include <wx/wx.h>
33-
34-void interpol_energy(GLfloat avec[3][3], int nb, int interpol, int ng0[3], int ng[3], wxTextCtrl* terminal,
35- GLfloat**** eig, GLfloat***** vf, GLfloat***** mat, GLfloat**** eig0, GLfloat***** mat0);
24+void interpol_energy();
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -52,16 +52,12 @@ THE SOFTWARE.
5252
5353 void compute_patch_segment() {
5454 if (refresh_interpol == 1){
55- interpol_energy(avec, nb, interpol, ng0, ng,
56- terminal, eig, vf, mat, eig0, mat0);
55+ interpol_energy();
5756 refresh_patch = 1;
5857 refresh_interpol = 0;
5958 }
6059 if (refresh_patch == 1) {
61- fermi_patch(nb, nthreads, ng, ng0, shiftk,
62- fbz, eig, EF, mat, vf, corner, bvec, nbragg,
63- bragg, brnrm, brnrm_min, terminal, ntri, kvp, matp,
64- clr, arw, nmlp, kvp_rot, nmlp_rot, arw_rot);
60+ fermi_patch();
6561 refresh_color = 1;
6662 refresh_section = 1;
6763 refresh_equator = 1;
@@ -70,37 +66,28 @@ void compute_patch_segment() {
7066 }
7167 if (refresh_color == 1) {
7268 if (skip_minmax == 1) skip_minmax = 0;
73- else max_and_min(nb, nthreads, terminal, myf, color_scale, ntri, matp,
74- &patch_min, &patch_max, nmlp);
75- paint(nb, color_scale, blackback, ntri, patch_min, patch_max,
76- kvp, matp, clr, nmlp, arw, red, green, blue,
77- cyan, magenta, yellow, wgray, bgray);
69+ else max_and_min();
70+ paint();
7871 refresh_section = 1;
7972 refresh_color = 0;
8073 }
8174 if (refresh_nodeline == 1) {
82- calc_nodeline(nb, ntri, matp, kvp, nthreads, terminal, nnl, kvnl, kvnl_rot);
75+ calc_nodeline();
8376 refresh_nodeline = 0;
8477 }
8578 if (refresh_section == 1) {
86- calc_2dbz(fbz, secvec, secscale, axis2d,
87- &nbzl2d, nbragg, bragg, brnrm, bzl2d, bzl2d_proj);
88- calc_section(fbz, nb, nthreads, secvec, secscale,
89- axis2d, ntri, kvp, clr, terminal, n2d, kv2d, clr2d);
79+ calc_2dbz();
80+ calc_section();
9081 refresh_section = 0;
9182 }
9283 if (refresh_equator == 1) {
93- equator(nb, nthreads, eqvec, ntri, kvp,
94- nmlp, terminal, nequator, kveq, kveq_rot);
84+ equator();
9585 refresh_equator = 0;
9686 }
9787 }
9888
9989 void refresh_patch_segment() {
100- free_patch(nb, refresh_patch, ntri, kvp, kvp_rot, matp,
101- clr, nmlp, nmlp_rot, arw, arw_rot, refresh_nodeline, nnl, kvnl,
102- kvnl_rot, refresh_section, kv2d, clr2d,
103- refresh_equator, nequator, kveq, kveq_rot);
90+ free_patch();
10491 compute_patch_segment();
10592 }
10693
@@ -138,7 +125,15 @@ enum
138125 itext_roty,
139126 itext_rotz,
140127 ibutton_rotate,
141- icheck_band
128+ icheck_band,
129+ itext_BackGroundR,
130+ itext_BackGroundG,
131+ itext_BackGroundB,
132+ itext_LineColorR,
133+ itext_LineColorG,
134+ itext_LineColorB,
135+ iradio_BarColor,
136+ ibutton_section
142137 };
143138
144139 void MyFrame::button_refresh(
@@ -150,32 +145,105 @@ void MyFrame::button_refresh(
150145 void MyFrame::button_compute(
151146 wxCommandEvent& event//!<[in] Selected menu
152147 ) {
153- free_patch(nb, refresh_patch, ntri, kvp, kvp_rot, matp,
154- clr, nmlp, nmlp_rot, arw, arw_rot, refresh_nodeline, nnl, kvnl,
155- kvnl_rot, refresh_section, kv2d, clr2d,
156- refresh_equator, nequator, kveq, kveq_rot);
148+ free_patch();
157149 compute_patch_segment();
158150 Refresh(false);
159151 }
152+void MyFrame::button_section(
153+ wxCommandEvent& event//!<[in] Selected menu
154+) {
155+ int ib, i2d, i, j;
156+ FILE *fp;
157+ fp = fopen("fermi_line.dat", "w");
158+ for (ib = 0; ib < nb; ib++) {
159+ if (draw_band[ib] == 1) {
160+ for (i2d = 0; i2d < n2d[ib]; i2d++) {
161+ for (i = 0; i < 2; i++) {
162+ fprintf(fp, "%15.5e %15.5e\n",
163+ kv2d[ib][i * 3 + 6 * i2d],
164+ kv2d[ib][1 + i * 3 + 6 * i2d]);
165+ }
166+ fprintf(fp, "\n\n");
167+ }
168+ }/*if (draw_band[ib] == 1)*/
169+ }/* for (ib = 0; ib < nb; ib++)*/
170+ fclose(fp);
171+ *terminal << wxT(" fermi_line.dat was written.\n");
172+
173+ fp = fopen("bz_line.dat", "w");
174+ for (i2d = 0; i2d < nbzl2d; i2d++) {
175+ fprintf(fp, "%15.5e %15.5e\n",
176+ bzl2d_proj[i2d][0], bzl2d_proj[i2d][1]);
177+ }
178+ fprintf(fp, "%15.5e %15.5e\n",
179+ bzl2d_proj[0][0], bzl2d_proj[0][1]);
180+ fclose(fp);
181+ *terminal << wxT(" bz_line.dat was written.\n");
182+}
183+/**
184+@brief Change Line color color (::blackback)
185+*/
186+void MyFrame::textctrl_LineColor(
187+ wxCommandEvent& event //!<[in] Selected menu
188+)
189+{
190+ int ierr;
191+ double dvalue;
192+
193+ if (event.GetId() == itext_LineColorR) {
194+ if (event.GetString().ToDouble(&dvalue)) {
195+ LineColor[0] = (GLfloat)dvalue;
196+ Refresh(false);
197+ }
198+ }
199+ else if (event.GetId() == itext_LineColorG) {
200+ if (event.GetString().ToDouble(&dvalue)) {
201+ LineColor[1] = (GLfloat)dvalue;
202+ Refresh(false);
203+ }
204+ }
205+ else if (event.GetId() == itext_LineColorB) {
206+ if (event.GetString().ToDouble(&dvalue)) {
207+ LineColor[2] = (GLfloat)dvalue;
208+ Refresh(false);
209+ }
210+ }
211+}
160212 /**
161213 @brief Change background color (::blackback)
162214 */
163-void MyFrame::radio_background(
215+void MyFrame::textctrl_BackGround(
164216 wxCommandEvent& event //!<[in] Selected menu
165217 )
166218 {
167- if (event.GetString().Cmp(wxT("Black")) == 0 && blackback != 1) {
168- glClearColor(0.0, 0.0, 0.0, 0.0);
169- blackback = 1;
170- // debug if (color_scale == 2 || color_scale == 3) paint();
219+ int ierr;
220+ double dvalue;
221+
222+ if (event.GetId() == itext_BackGroundR) {
223+ if (event.GetString().ToDouble(&dvalue)) {
224+ BackGroundColor[0] = (GLfloat)dvalue;
225+ glClearColor(BackGroundColor[0], BackGroundColor[1],
226+ BackGroundColor[2], BackGroundColor[3]);
227+ Refresh(false);
228+ }
229+ }
230+ else if (event.GetId() == itext_BackGroundG) {
231+ if (event.GetString().ToDouble(&dvalue)) {
232+ BackGroundColor[1] = (GLfloat)dvalue;
233+ glClearColor(BackGroundColor[0], BackGroundColor[1],
234+ BackGroundColor[2], BackGroundColor[3]);
235+ Refresh(false);
236+ }
171237 }
172- else if (event.GetString().Cmp(wxT("White")) == 0 && blackback != 0) {
173- glClearColor(1.0, 1.0, 1.0, 0.0);
174- blackback = 0;
175- // debug if (color_scale == 2 || color_scale == 3) paint();
238+ else if (event.GetId() == itext_BackGroundB) {
239+ if (event.GetString().ToDouble(&dvalue)) {
240+ BackGroundColor[2] = (GLfloat)dvalue;
241+ glClearColor(BackGroundColor[0], BackGroundColor[1],
242+ BackGroundColor[2], BackGroundColor[3]);
243+ Refresh(false);
244+ }
176245 }
177- Refresh(false);
178-}/* bgcolor change*/
246+}
179247 /**
180248 @brief Toggle the appearance of each band (::draw_band)
181249 */
@@ -208,6 +276,44 @@ void MyFrame::radio_brillouinzone(
208276 refresh_patch = 1;
209277 } /* menu_brillouinzone */
210278 /**
279+ @brief Change Brillouin zone (::fbz)
280+*/
281+void MyFrame::radio_BarColor(
282+ wxCommandEvent& event //!<[in] Selected menu
283+)
284+{
285+ int ii;
286+ if (event.GetString().Cmp(wxT("BGR")) == 0) {
287+ for (ii = 0; ii < 4; ii++) {
288+ BarColor[0][ii] = blue[ii];
289+ BarColor[1][ii] = cyan[ii];
290+ BarColor[2][ii] = green[ii];
291+ BarColor[3][ii] = yellow[ii];
292+ BarColor[4][ii] = red[ii];
293+ }
294+ }
295+ else if (event.GetString().Cmp(wxT("CMY")) == 0) {
296+ for (ii = 0; ii < 4; ii++) {
297+ BarColor[0][ii] = cyan[ii];
298+ BarColor[1][ii] = blue[ii];
299+ BarColor[2][ii] = magenta[ii];
300+ BarColor[3][ii] = red[ii];
301+ BarColor[4][ii] = yellow[ii];
302+ }
303+ }
304+ else if (event.GetString().Cmp(wxT("MCY")) == 0) {
305+ for (ii = 0; ii < 4; ii++) {
306+ BarColor[0][ii] = magenta[ii];
307+ BarColor[1][ii] = blue[ii];
308+ BarColor[2][ii] = cyan[ii];
309+ BarColor[3][ii] = green[ii];
310+ BarColor[4][ii] = yellow[ii];
311+ }
312+ }
313+ paint();
314+ Refresh(false);
315+} /* menu_brillouinzone */
316+/**
211317 @brief Toggle Colorbar (::lcolorbar)
212318 */
213319 void MyFrame::check_colorbar(
@@ -440,7 +546,7 @@ void MyFrame::radio_tetra(
440546 )
441547 {
442548 itet = wxAtoi(event.GetString()) - 1;
443- init_corner(itet, corner);
549+ init_corner();
444550 refresh_patch = 1;
445551 }/*menu_tetra*/
446552 /**
@@ -659,7 +765,7 @@ wxT("8"), wxT("9"), wxT("10"), wxT("11"), wxT("12"), wxT("13"), wxT("14"),
659765 gbsizer->Add(new wxRadioBox(panel, iradio_tetra, wxT("Tetrahedron"),
660766 wxDefaultPosition, wxDefaultSize,
661767 WXSIZEOF(choices_tetra), choices_tetra,
662- 4, wxRA_SPECIFY_COLS), wxGBPosition(3,2), wxGBSpan(4, 2));
768+ 4, wxRA_SPECIFY_COLS), wxGBPosition(3,2), wxGBSpan(5, 2));
663769
664770 wxString choices_colorscale[] = { wxT("Input (1D)"), wxT("Input (2D)"),
665771 wxT("Input (3D)"), wxT("Fermi Velocity"), wxT("Band Index"),
@@ -670,91 +776,125 @@ wxT("8"), wxT("9"), wxT("10"), wxT("11"), wxT("12"), wxT("13"), wxT("14"),
670776 WXSIZEOF(choices_colorscale), choices_colorscale,
671777 1, wxRA_SPECIFY_COLS);
672778 Bind(wxEVT_COMMAND_RADIOBOX_SELECTED, &MyFrame::radiovalue_colorscale, this, iradio_colorscale);
673- gbsizer->Add(radiobox_color, wxGBPosition(7, 0), wxGBSpan(2, 2));
779+ gbsizer->Add(radiobox_color, wxGBPosition(7, 0), wxGBSpan(3, 2));
674780
675781 wxString choices_bz[] = { wxT("First Brillouin zone"), wxT("Primitive Brillouin zone") };
676782 Bind(wxEVT_COMMAND_RADIOBOX_SELECTED, &MyFrame::radio_brillouinzone, this, iradio_brillouinzone);
677783 gbsizer->Add(new wxRadioBox(panel, iradio_brillouinzone, wxT("Brillouin zone"),
678784 wxDefaultPosition, wxDefaultSize,
679785 WXSIZEOF(choices_bz), choices_bz,
680- 1, wxRA_SPECIFY_COLS), wxGBPosition(7, 2), wxGBSpan(1, 2));
786+ 1, wxRA_SPECIFY_COLS), wxGBPosition(8, 2), wxGBSpan(1, 2));
681787
682788 wxString choices_stereo[] = { wxT("None"), wxT("Parallel"), wxT("Cross") };
683789 Bind(wxEVT_COMMAND_RADIOBOX_SELECTED, &MyFrame::radio_stereo, this, iradio_stereo);
684790 gbsizer->Add(new wxRadioBox(panel, iradio_stereo, wxT("Stereogram"),
685791 wxDefaultPosition, wxDefaultSize,
686792 WXSIZEOF(choices_stereo), choices_stereo,
687- 1, wxRA_SPECIFY_COLS), wxGBPosition(8, 2), wxGBSpan(1, 1));
793+ 1, wxRA_SPECIFY_COLS), wxGBPosition(9, 2), wxGBSpan(1, 1));
688794
689795 wxString choices_mouse[] = { wxT("Rotate"), wxT("Scale"), wxT("Translate") };
690796 Bind(wxEVT_COMMAND_RADIOBOX_SELECTED, &MyFrame::radio_mouse, this, iradio_mouse);
691797 gbsizer->Add(new wxRadioBox(panel, iradio_mouse, wxT("Mouse Drag"),
692798 wxDefaultPosition, wxDefaultSize,
693799 WXSIZEOF(choices_mouse), choices_mouse,
694- 1, wxRA_SPECIFY_COLS), wxGBPosition(8, 3), wxGBSpan(1, 1));
800+ 1, wxRA_SPECIFY_COLS), wxGBPosition(9, 3), wxGBSpan(1, 1));
801+
802+ gbsizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Background (RGB) : ")),
803+ wxGBPosition(10, 0), wxGBSpan(1, 1), wxALIGN_RIGHT);
804+ Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_BackGround, this, itext_BackGroundR);
805+ textbox_BackGroundR = new wxTextCtrl(panel, itext_BackGroundR, wxT(""));
806+ gbsizer->Add(textbox_BackGroundR, wxGBPosition(10, 1), wxGBSpan(1, 1));
807+ Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_BackGround, this, itext_BackGroundG);
808+ textbox_BackGroundG = new wxTextCtrl(panel, itext_BackGroundG, wxT(""));
809+ gbsizer->Add(textbox_BackGroundG, wxGBPosition(10, 2), wxGBSpan(1, 1));
810+ Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_BackGround, this, itext_BackGroundB);
811+ textbox_BackGroundB = new wxTextCtrl(panel, itext_BackGroundB, wxT(""));
812+ gbsizer->Add(textbox_BackGroundB, wxGBPosition(10, 3), wxGBSpan(1, 1));
813+ textbox_BackGroundR->ChangeValue(wxT("0"));
814+ textbox_BackGroundG->ChangeValue(wxT("0"));
815+ textbox_BackGroundB->ChangeValue(wxT("0"));
816+
817+ gbsizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Line color (RGB) : ")),
818+ wxGBPosition(11, 0), wxGBSpan(1, 1), wxALIGN_RIGHT);
819+ Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_LineColor, this, itext_LineColorR);
820+ textbox_LineColorR = new wxTextCtrl(panel, itext_LineColorR, wxT(""));
821+ gbsizer->Add(textbox_LineColorR, wxGBPosition(11, 1), wxGBSpan(1, 1));
822+ Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_LineColor, this, itext_LineColorG);
823+ textbox_LineColorG = new wxTextCtrl(panel, itext_LineColorG, wxT(""));
824+ gbsizer->Add(textbox_LineColorG, wxGBPosition(11, 2), wxGBSpan(1, 1));
825+ Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_LineColor, this, itext_LineColorB);
826+ textbox_LineColorB = new wxTextCtrl(panel, itext_LineColorB, wxT(""));
827+ gbsizer->Add(textbox_LineColorB, wxGBPosition(11, 3), wxGBSpan(1, 1));
828+ textbox_LineColorR->ChangeValue(wxT("1"));
829+ textbox_LineColorG->ChangeValue(wxT("1"));
830+ textbox_LineColorB->ChangeValue(wxT("1"));
695831
696832 Bind(wxEVT_COMMAND_BUTTON_CLICKED, &MyFrame::textctrl_view, this, ibutton_rotate);
697833 gbsizer->Add(new wxButton(panel, ibutton_rotate, wxT("Rotate")),
698- wxGBPosition(9, 0), wxGBSpan(1, 1));
834+ wxGBPosition(12, 0), wxGBSpan(1, 1));
699835 Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_view, this, itext_rotx);
700836 textbox_rotatex = new wxTextCtrl(panel, itext_rotx, wxT(""));
701- gbsizer->Add(textbox_rotatex, wxGBPosition(9, 1), wxGBSpan(1, 1));
837+ gbsizer->Add(textbox_rotatex, wxGBPosition(12, 1), wxGBSpan(1, 1));
702838 Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_view, this, itext_roty);
703839 textbox_rotatey = new wxTextCtrl(panel, itext_roty, wxT(""));
704- gbsizer->Add(textbox_rotatey, wxGBPosition(9, 2), wxGBSpan(1, 1));
840+ gbsizer->Add(textbox_rotatey, wxGBPosition(12, 2), wxGBSpan(1, 1));
705841 Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_view, this, itext_rotz);
706842 textbox_rotatez = new wxTextCtrl(panel, itext_rotz, wxT(""));
707- gbsizer->Add(textbox_rotatez, wxGBPosition(9, 3), wxGBSpan(1, 1));
843+ gbsizer->Add(textbox_rotatez, wxGBPosition(12, 3), wxGBSpan(1, 1));
708844 textbox_rotatex->ChangeValue(wxT("0"));
709845 textbox_rotatey->ChangeValue(wxT("0"));
710846 textbox_rotatez->ChangeValue(wxT("0"));
711847
712848 gbsizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Position : ")),
713- wxGBPosition(10, 1), wxGBSpan(1, 1), wxALIGN_RIGHT);
849+ wxGBPosition(13, 1), wxGBSpan(1, 1), wxALIGN_RIGHT);
714850 Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_view, this, itext_positionx);
715851 textbox_positionx = new wxTextCtrl(panel, itext_positionx, wxT(""));
716- gbsizer->Add(textbox_positionx, wxGBPosition(10, 2), wxGBSpan(1, 1));
852+ gbsizer->Add(textbox_positionx, wxGBPosition(13, 2), wxGBSpan(1, 1));
717853 Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_view, this, itext_positiony);
718854 textbox_positiony = new wxTextCtrl(panel, itext_positiony, wxT(""));
719- gbsizer->Add(textbox_positiony, wxGBPosition(10, 3), wxGBSpan(1, 1));
855+ gbsizer->Add(textbox_positiony, wxGBPosition(13, 3), wxGBSpan(1, 1));
720856 textbox_positionx->ChangeValue(wxT("0"));
721857 textbox_positiony->ChangeValue(wxT("0"));
722858
723859 gbsizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Scale : ")),
724- wxGBPosition(11, 2), wxGBSpan(1, 1), wxALIGN_RIGHT);
860+ wxGBPosition(14, 2), wxGBSpan(1, 1), wxALIGN_RIGHT);
725861 Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_view, this, itext_scale);
726862 textbox_scale = new wxTextCtrl(panel, itext_scale, wxT(""));
727- gbsizer->Add(textbox_scale, wxGBPosition(11, 3), wxGBSpan(1, 1));
863+ gbsizer->Add(textbox_scale, wxGBPosition(14, 3), wxGBSpan(1, 1));
728864 textbox_scale->ChangeValue(wxString::Format(wxT("%f"), scl));
729865
730866 Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &MyFrame::check_colorbar, this, icheck_colorbar);
731867 wxCheckBox* check = new wxCheckBox(panel, icheck_colorbar, wxT("Color bar"));
732- gbsizer->Add(check, wxGBPosition(11, 1), wxGBSpan(1, 1));
868+ gbsizer->Add(check, wxGBPosition(14, 1), wxGBSpan(1, 1));
733869 check->SetValue(true);
734870 // debug fileMenu->Check(menu_colorbar_check, true);
735871
736872 Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &MyFrame::checkvalue_equator, this, icheck_equator);
737- gbsizer->Add(new wxCheckBox(panel, icheck_equator, wxT("Equator")), wxGBPosition(12, 1), wxGBSpan(1, 1));
873+ gbsizer->Add(new wxCheckBox(panel, icheck_equator, wxT("Equator")), wxGBPosition(15, 1), wxGBSpan(1, 1));
738874
739875 Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &MyFrame::check_nodeline, this, icheck_nodeline);
740- gbsizer->Add(new wxCheckBox(panel, icheck_nodeline, wxT("Nodal line")), wxGBPosition(13, 1), wxGBSpan(1, 1));
876+ gbsizer->Add(new wxCheckBox(panel, icheck_nodeline, wxT("Nodal line")), wxGBPosition(16, 1), wxGBSpan(1, 1));
741877
742878 Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &MyFrame::radiovalue_section, this, icheck_section);
743- gbsizer->Add(new wxCheckBox(panel, icheck_section, wxT("Section")), wxGBPosition(14, 1), wxGBSpan(1, 1));
879+ gbsizer->Add(new wxCheckBox(panel, icheck_section, wxT("Section")), wxGBPosition(17, 1), wxGBSpan(1, 1));
880+
881+ Bind(wxEVT_COMMAND_BUTTON_CLICKED, &MyFrame::button_section, this, ibutton_section);
882+ gbsizer->Add(new wxButton(panel, ibutton_section, wxT("Section file")),
883+ wxGBPosition(18, 1), wxGBSpan(1, 1));
744884
745885 wxString choices_light[] = { wxT("Both"), wxT("Unoccupy"), wxT("Occupy") };
746886 Bind(wxEVT_COMMAND_RADIOBOX_SELECTED, &MyFrame::radio_lighting, this, iradio_lighting);
747887 gbsizer->Add(new wxRadioBox(panel, iradio_lighting, wxT("Lighting"),
748888 wxDefaultPosition, wxDefaultSize,
749889 WXSIZEOF(choices_light), choices_light,
750- 1, wxRA_SPECIFY_COLS), wxGBPosition(12, 2), wxGBSpan(3, 1));
890+ 1, wxRA_SPECIFY_COLS), wxGBPosition(15, 2), wxGBSpan(4, 1));
751891
752- wxString choices_bg[] = { wxT("Black"), wxT("White") };
753- Bind(wxEVT_COMMAND_RADIOBOX_SELECTED, &MyFrame::radio_background, this, iradio_background);
754- gbsizer->Add(new wxRadioBox(panel, iradio_background, wxT("Background color"),
892+ wxString choices_BarColor[] = { wxT("BGR"), wxT("CMY"), wxT("MCY")};
893+ Bind(wxEVT_COMMAND_RADIOBOX_SELECTED, &MyFrame::radio_BarColor, this, iradio_BarColor);
894+ gbsizer->Add(new wxRadioBox(panel, iradio_BarColor, wxT("Bar Color"),
755895 wxDefaultPosition, wxDefaultSize,
756- WXSIZEOF(choices_bg), choices_bg,
757- 1, wxRA_SPECIFY_COLS), wxGBPosition(12, 3), wxGBSpan(3, 1));
896+ WXSIZEOF(choices_BarColor), choices_BarColor,
897+ 1, wxRA_SPECIFY_COLS), wxGBPosition(15, 3), wxGBSpan(4, 1));
758898
759899 SetSizer(sizermain);
760900 SetAutoLayout(true);
@@ -790,7 +930,7 @@ void MyFrame::modify_band() {
790930 Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &MyFrame::check_band, this, icheck_band + ib);
791931 check[ib] = new wxCheckBox(panel, icheck_band + ib,
792932 wxString::Format(wxT("Band %d"), ib));
793- gbsizer->Add(check[ib], wxGBPosition(10 + ib, 0), wxGBSpan(1, 1));
933+ gbsizer->Add(check[ib], wxGBPosition(13 + ib, 0), wxGBSpan(1, 1));
794934 check[ib]->SetValue(true);
795935 }
796936 gbsizer->Layout();
--- a/src/menu.hpp
+++ b/src/menu.hpp
@@ -62,12 +62,19 @@ public:
6262 wxTextCtrl* textbox_min;
6363 wxTextCtrl* textbox_max;
6464 wxTextCtrl* textbox_linewidth;
65+ wxTextCtrl* textbox_BackGroundR;
66+ wxTextCtrl* textbox_BackGroundG;
67+ wxTextCtrl* textbox_BackGroundB;
68+ wxTextCtrl* textbox_LineColorR;
69+ wxTextCtrl* textbox_LineColorG;
70+ wxTextCtrl* textbox_LineColorB;
6571
6672 private:
6773 void OnExit(wxCommandEvent& event);
6874 void check_band(wxCommandEvent& event);
6975 void radio_brillouinzone(wxCommandEvent& event);
70- void radio_background(wxCommandEvent& event);
76+ void textctrl_BackGround(wxCommandEvent& event);
77+ void textctrl_LineColor(wxCommandEvent& event);
7178 void check_colorbar(wxCommandEvent& event);
7279 void radiovalue_colorscale(wxCommandEvent& event);
7380 void checkvalue_equator(wxCommandEvent& event);
@@ -83,6 +90,8 @@ private:
8390 void textctrl_view(wxCommandEvent& event);
8491 void button_refresh(wxCommandEvent& event);
8592 void button_compute(wxCommandEvent& event);
93+ void radio_BarColor(wxCommandEvent& event);
94+ void button_section(wxCommandEvent& event);
8695 //wxDECLARE_EVENT_TABLE();
8796 };
8897
--- a/src/read_file.cpp
+++ b/src/read_file.cpp
@@ -268,15 +268,8 @@ void read_batch()
268268 continue;
269269 }
270270
271- if (strcmp(keyword, "background") == 0) {
272- ierr = fscanf(fp, "%s", value);
273- Text2Lower(value);
274- if (strcmp(value, "black") == 0) blackback = 1;
275- else if (strcmp(value, "white") == 0) blackback = 0;
276- else {
277- printf("Error! %s = %s", keyword, value);
278- exit(-1);
279- }
271+ if (strcmp(keyword, "backgroundcolor") == 0) {
272+ ierr = fscanf(fp, "%f%f%f", &BackGroundColor[0], &BackGroundColor[1], &BackGroundColor[2]);
280273 }
281274 else if (strcmp(keyword, "band") == 0) {
282275 for (ib = 0; ib < nb; ib++)
@@ -321,6 +314,9 @@ void read_batch()
321314 else if (strcmp(keyword, "interpol") == 0) {
322315 ierr = fscanf(fp, "%d", &interpol);
323316 }
317+ else if (strcmp(keyword, "linecolor") == 0) {
318+ ierr = fscanf(fp, "%f%f%f", &LineColor[0], &LineColor[1], &LineColor[2]);
319+ }
324320 else if (strcmp(keyword, "linewidth") == 0) {
325321 ierr = fscanf(fp, "%f", &linewidth);
326322 }
@@ -388,8 +384,7 @@ void read_batch()
388384 }
389385 fclose(fp);
390386
391- if (blackback == 1) glClearColor(0.0, 0.0, 0.0, 0.0);
392- else glClearColor(1.0, 1.0, 1.0, 0.0);
387+ glClearColor(BackGroundColor[0], BackGroundColor[1], BackGroundColor[2], BackGroundColor[2]);
393388
394389 thetax = 3.14159265f / 180.0f * thetax;
395390 thetay = 3.14159265f / 180.0f * thetay;
--- a/src/read_file.hpp
+++ b/src/read_file.hpp
@@ -21,16 +21,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2121 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222 THE SOFTWARE.
2323 */
24-#if defined(HAVE_CONFIG_H)
25-#include <config.h>
26-#endif
27-#if defined(HAVE_GL_GL_H)
28-#include <GL/gl.h>
29-#elif defined(HAVE_OPENGL_GL_H)
30-#include <OpenGL/gl.h>
31-#endif
32-#include <wx/wx.h>
33-
3424 int read_file();
3525 void read_batch();
3626 void read_bxsf();
--- a/src/section.cpp
+++ b/src/section.cpp
@@ -39,6 +39,7 @@ THE SOFTWARE.
3939 #include <cstdlib>
4040 #include <cmath>
4141 #include "basic_math.hpp"
42+#include "variable.hpp"
4243 /**
4344 @brief Project 3D \f$k\f$-vector into 2D plane.
4445
@@ -177,18 +178,7 @@ int bragg_vert2d(
177178
178179 Modify : ::nbzl2d, ::bzl2d_proj
179180 */
180-void calc_2dbz(
181-int fbz,
182-GLfloat secvec[3],
183-GLfloat secscale,
184-GLfloat axis2d[2][3],
185-int *nbzl2d,
186-int nbragg,
187-GLfloat bragg[26][3],
188-GLfloat brnrm[26],
189-GLfloat bzl2d[26][3],
190-GLfloat bzl2d_proj[26][3]
191-) {
181+void calc_2dbz() {
192182 int jbr, nbr, i, j, lvert, ibzl;
193183 GLfloat vert[2][3], vec[26][2][3], prod, thr;
194184
@@ -198,7 +188,7 @@ GLfloat bzl2d_proj[26][3]
198188 */
199189 set2daxis(secvec, axis2d);
200190
201- *nbzl2d = 0;
191+ nbzl2d = 0;
202192
203193 for (jbr = 0; jbr < nbragg; ++jbr) {
204194 /**/
@@ -211,15 +201,15 @@ GLfloat bzl2d_proj[26][3]
211201 lvert = bragg_vert2d(nbragg, bragg, brnrm, secvec, secscale, jbr, nbr, vert[1], vert[0]);
212202 if (lvert == 0) continue;
213203 /**/
214- for (i = 0; i < 2; ++i) for (j = 0; j < 3; ++j) vec[*nbzl2d][i][j] = vert[i][j];
215- *nbzl2d += 1;
204+ for (i = 0; i < 2; ++i) for (j = 0; j < 3; ++j) vec[nbzl2d][i][j] = vert[i][j];
205+ nbzl2d += 1;
216206 }/*for (jbr = 0; jbr < nbragg; ++jbr)*/
217207 /*
218208 Order bz lines
219209 */
220210 for (i = 0; i < 3; i++) bzl2d[0][i] = vec[0][0][i];
221211 for (i = 0; i < 3; i++) bzl2d[1][i] = vec[0][1][i];
222- for (ibzl = 0; ibzl < *nbzl2d; ibzl++) {
212+ for (ibzl = 0; ibzl < nbzl2d; ibzl++) {
223213
224214 thr = 0.0f;
225215 for (j = 0; j < 2; j++) for (i = 0; i < 3; i++) thr += bzl2d[j][i] * bzl2d[j][i];
@@ -238,21 +228,21 @@ GLfloat bzl2d_proj[26][3]
238228 for (j = 0; j < 2; j++) for (i = 0; i < 3; i++) vec[ibzl][j][i] = 0.0;
239229 }/*for (ibzl = 1; ibzl < *nbzl2d; ibzl++)*/
240230
241- for (jbr = 1; jbr < *nbzl2d - 1; jbr++) {
231+ for (jbr = 1; jbr < nbzl2d - 1; jbr++) {
242232
243233 thr = 0.0f;
244234 for (j = 0; j < 2; j++) for (i = 0; i < 3; i++) thr += bzl2d[jbr][i] * bzl2d[jbr][i];
245235 thr *= 0.001f;
246236
247237 prod = 0.0;
248- for (ibzl = 0; ibzl < *nbzl2d; ibzl++) for (i = 0; i < 3; i++)
238+ for (ibzl = 0; ibzl < nbzl2d; ibzl++) for (i = 0; i < 3; i++)
249239 prod += vec[ibzl][0][i] * vec[ibzl][0][i];
250240 if (prod < thr) {
251- *nbzl2d = jbr + 1;
241+ nbzl2d = jbr + 1;
252242 break;
253243 }
254244
255- for (ibzl = 1; ibzl < *nbzl2d; ibzl++) {
245+ for (ibzl = 1; ibzl < nbzl2d; ibzl++) {
256246 prod = (bzl2d[jbr][0] - vec[ibzl][0][0]) * (bzl2d[jbr][0] - vec[ibzl][0][0])
257247 + (bzl2d[jbr][1] - vec[ibzl][0][1]) * (bzl2d[jbr][1] - vec[ibzl][0][1])
258248 + (bzl2d[jbr][2] - vec[ibzl][0][2]) * (bzl2d[jbr][2] - vec[ibzl][0][2]);
@@ -273,7 +263,7 @@ GLfloat bzl2d_proj[26][3]
273263 /*
274264 Project into 2D plane
275265 */
276- for (ibzl = 0; ibzl < *nbzl2d; ibzl++) {
266+ for (ibzl = 0; ibzl < nbzl2d; ibzl++) {
277267 for (i = 0; i < 3; i++) bzl2d_proj[ibzl][i] = bzl2d[ibzl][i];
278268 proj_2d(axis2d, bzl2d_proj[ibzl]);
279269 }/*for (ibzl = 0; ibzl < *nbzl2d; ibzl++)*/
@@ -283,21 +273,7 @@ GLfloat bzl2d_proj[26][3]
283273
284274 Modify : ::n2d, ::clr2d, ::kv2d
285275 */
286-void calc_section(
287-int fbz,
288-int nb,
289-int nthreads,
290-GLfloat secvec[3],
291-GLfloat secscale,
292-GLfloat axis2d[2][3],
293-int *ntri,
294-GLfloat ****kvp,
295-GLfloat ** clr,
296-wxTextCtrl *terminal,
297-int *n2d,
298-GLfloat **kv2d,
299-GLfloat **clr2d
300-) {
276+void calc_section() {
301277 int i, j, ib, itri, ithread, n2d0;
302278 std::vector<std::vector<std::vector<std::vector<GLfloat>>>> kv2d_v, clr2d_v;
303279
--- a/src/section.hpp
+++ b/src/section.hpp
@@ -21,19 +21,5 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2121 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222 THE SOFTWARE.
2323 */
24-#if defined(HAVE_CONFIG_H)
25-#include <config.h>
26-#endif
27-#if defined(HAVE_GL_GL_H)
28-#include <GL/gl.h>
29-#elif defined(HAVE_OPENGL_GL_H)
30-#include <OpenGL/gl.h>
31-#endif
32-#include <wx/wx.h>
33-
34-void calc_2dbz(int fbz, GLfloat secvec[3], GLfloat secscale, GLfloat axis2d[2][3],
35- int *nbzl2d, int nbragg, GLfloat bragg[26][3], GLfloat brnrm[26], GLfloat bzl2d[26][3],
36- GLfloat bzl2d_proj[26][3]);
37-void calc_section(int fbz, int nb, int nthreads, GLfloat secvec[3], GLfloat secscale,
38- GLfloat axis2d[2][3], int* ntri, GLfloat**** kvp, GLfloat** clr, wxTextCtrl* terminal,
39- int* n2d, GLfloat** kv2d, GLfloat** clr2d);
24+void calc_2dbz();
25+void calc_section();
--- a/src/variable.hpp
+++ b/src/variable.hpp
@@ -60,7 +60,6 @@ extern int interpol; //!< Ratio of interpolation
6060 /*
6161 Switch for some modes
6262 */
63-extern int blackback; //!< Switch for black background
6463 extern int color_scale; //!< Switch for full color scale mode
6564 extern int fbz; //!< Switch for 1st Brillouin zone mode
6665 extern int nodeline; //!< Switch for node lines
@@ -150,6 +149,9 @@ extern GLfloat yellow[4]; //!< Yellow color code
150149 extern GLfloat red[4]; //!< Red color code
151150 extern GLfloat green[4]; //!< Green color code
152151 extern GLfloat blue[4]; //!< Blue color code
152+extern GLfloat BackGroundColor[4];//!< Background color code
153+extern GLfloat LineColor[4];//!< Line color code
154+extern GLfloat BarColor[5][4];
153155 /*
154156 Others
155157 */