34 #if defined(HAVE_CONFIG_H)
37 #if defined(HAVE_GL_GL_H)
39 #elif defined(HAVE_OPENGL_GL_H)
40 #include <OpenGL/gl.h>
51 int i, j, ib, i0, i1, i2;
53 for (i = 0; i < 3; i++)
ng[i] =
ng0[i];
61 for (ib = 0; ib <
nb; ib++) {
73 for (i = 0; i < 3; ++i) {
74 for (j = 0; j < 3; ++j)
avec[i][j] = 0.0f;
77 *
terminal << wxString::Format(wxT(
" avec %d : %f %f %f \n"),
80 for (i = 0; i < 3; ++i) {
90 eig0 =
new GLfloat * **[
nb];
91 eig =
new GLfloat * **[
nb];
92 mat0 =
new GLfloat * ***[
nb];
93 mat =
new GLfloat * ***[
nb];
94 vf =
new GLfloat * ***[
nb];
95 for (ib = 0; ib <
nb; ib++) {
96 eig0[ib] =
new GLfloat * *[
ng0[0]];
97 eig[ib] =
new GLfloat * *[
ng0[0]];
98 mat0[ib] =
new GLfloat * **[
ng0[0]];
99 mat[ib] =
new GLfloat * **[
ng0[0]];
100 vf[ib] =
new GLfloat * **[
ng0[0]];
101 for (i0 = 0; i0 <
ng0[0]; i0++) {
102 eig0[ib][i0] =
new GLfloat * [
ng0[1]];
103 eig[ib][i0] =
new GLfloat * [
ng0[1]];
104 mat0[ib][i0] =
new GLfloat * *[
ng0[1]];
105 mat[ib][i0] =
new GLfloat * *[
ng0[1]];
106 vf[ib][i0] =
new GLfloat * *[
ng0[1]];
107 for (i1 = 0; i1 <
ng0[1]; i1++) {
108 eig0[ib][i0][i1] =
new GLfloat[
ng0[2]];
109 eig[ib][i0][i1] =
new GLfloat[
ng0[2]];
110 mat0[ib][i0][i1] =
new GLfloat * [
ng0[2]];
111 mat[ib][i0][i1] =
new GLfloat * [
ng0[2]];
112 vf[ib][i0][i1] =
new GLfloat * [
ng0[2]];
113 for (i2 = 0; i2 <
ng0[2]; ++i2) {
114 mat0[ib][i0][i1][i2] =
new GLfloat[3];
115 mat[ib][i0][i1][i2] =
new GLfloat[3];
116 vf[ib][i0][i1][i2] =
new GLfloat[3];
127 int ib, i, j, i0, i1, i2, ii0, ii1, ii2, ierr, iaxis;
137 *
terminal << wxT(
"file open error!!\n");
138 *
terminal << wxT(
" Press any key to exit.\n");
143 *
terminal << wxT(
" ## Brillouin zone informations ###########\n");
148 ctemp1 = fgets(ctemp2, 256, fp);
149 ierr = sscanf(ctemp2,
"%d%d%d", &
ng0[0], &
ng0[1], &
ng0[2]);
151 if (ierr == 0) *
terminal << wxT(
"error ! reading ng\n");
152 *
terminal << wxString::Format(wxT(
" k point grid : %d %d %d\n"),
157 ierr = fscanf(fp,
"%d", &lshift);
158 if (ierr == 0) *
terminal << wxT(
"error ! reading lshift\n");
161 *
terminal << wxT(
" k point grid is the Monkhorst-Pack grid.\n");
162 for (i = 0; i < 3; i++)
shiftk[i] = (
ng0[i] + 1) % 2;
164 else if (lshift == 1) {
165 *
terminal << wxT(
" k point grid starts from Gamma.\n");
166 for (i = 0; i < 3; i++)
shiftk[i] = 0;
168 else if (lshift == 2) {
169 *
terminal << wxT(
" k point grid starts from Gamma + a half grid.\n");
170 for (i = 0; i < 3; i++)
shiftk[i] = 1;
178 ierr = fscanf(fp,
"%d", &
nb);
179 if (ierr == 0) *
terminal << wxT(
"error ! reading nb\n");
180 *
terminal << wxString::Format(wxT(
" # of bands : %d\n"),
nb);
184 for (i = 0; i < 3; ++i) {
185 ierr = fscanf(fp,
"%e%e%e", &
bvec[i][0], &
bvec[i][1], &
bvec[i][2]);
186 if (ierr == 0) *
terminal << wxT(
"error ! reading bvec\n");
187 *
terminal << wxString::Format(wxT(
" bvec %d : %f %f %f \n"), i + 1,
bvec[i][0],
bvec[i][1],
bvec[i][2]);
193 for (ib = 0; ib <
nb; ++ib) {
194 for (i0 = 0; i0 <
ng0[0]; ++i0) {
195 if (lshift != 0) ii0 = i0;
197 for (i1 = 0; i1 <
ng0[1]; ++i1) {
198 if (lshift != 0) ii1 = i1;
200 for (i2 = 0; i2 <
ng0[2]; ++i2) {
201 if (lshift != 0) ii2 = i2;
203 ierr = fscanf(fp,
"%e", &
eig0[ib][ii0][ii1][ii2]);
211 for (iaxis = 0; iaxis < 3; iaxis++) {
212 for (ib = 0; ib <
nb; ++ib) {
213 for (i0 = 0; i0 <
ng0[0]; ++i0) {
214 if (lshift != 0) ii0 = i0;
216 for (i1 = 0; i1 <
ng0[1]; ++i1) {
217 if (lshift != 0) ii1 = i1;
219 for (i2 = 0; i2 <
ng0[2]; ++i2) {
220 if (lshift != 0) ii2 = i2;
222 ierr = fscanf(fp,
"%e", &
mat0[ib][ii0][ii1][ii2][iaxis]);
243 valuelen = strlen(value);
244 for (ii = 0; ii < valuelen; ii++) {
245 value2 = tolower(value[ii]);
251 char keyword[256], value[256];
254 int ierr, ib, iminmax;
257 if ((fp = fopen(
batch_name.mb_str(),
"r")) == NULL) {
258 printf(
"file open error!!\n");
259 printf(
" Press any key to exit.\n");
266 while (fscanf(fp,
"%s", keyword) != EOF) {
269 *
terminal << wxString::Format(wxT(
"%s\n"), keyword);
270 if (keyword[0] ==
'#') {
271 ctmp = fgets(keyword, 256, fp);
275 if (strcmp(keyword,
"backgroundcolor") == 0) {
278 else if (strcmp(keyword,
"band") == 0) {
279 for (ib = 0; ib <
nb; ib++)
282 else if (strcmp(keyword,
"brillouinzone") == 0) {
283 ierr = fscanf(fp,
"%s", value);
285 if (strcmp(value,
"first") == 0)
fbz = 1;
286 else if (strcmp(value,
"primitive") == 0)
fbz = -1;
288 printf(
"Error! %s = %s", keyword, value);
292 else if (strcmp(keyword,
"colorbar") == 0) {
295 else if (strcmp(keyword,
"colorscale") == 0) {
296 ierr = fscanf(fp,
"%s", value);
298 if (strcmp(value,
"input1d") == 0)
color_scale = 1;
299 else if (strcmp(value,
"input2d") == 0)
color_scale = 2;
300 else if (strcmp(value,
"input3d") == 0)
color_scale = 3;
301 else if (strcmp(value,
"fermivelocity") == 0)
color_scale = 4;
302 else if (strcmp(value,
"bandindex") == 0)
color_scale = 5;
303 else if (strcmp(value,
"inputgray") == 0)
color_scale = 6;
304 else if (strcmp(value,
"fermivelocitygray") == 0)
color_scale = 7;
306 printf(
"Error! %s = %s", keyword, value);
310 else if (strcmp(keyword,
"minmax") == 0) {
314 else if (strcmp(keyword,
"equator") == 0) {
318 else if (strcmp(keyword,
"interpol") == 0) {
321 else if (strcmp(keyword,
"linecolor") == 0) {
324 else if (strcmp(keyword,
"linewidth") == 0) {
327 else if (strcmp(keyword,
"lighting") == 0) {
328 ierr = fscanf(fp,
"%s", value);
330 if (strcmp(value,
"both") == 0) {
331 glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
334 else if (strcmp(value,
"unoccupied") == 0) {
335 glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
338 else if (strcmp(value,
"occupied") == 0) {
339 glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
343 printf(
"Error! %s = %s", keyword, value);
347 else if (strcmp(keyword,
"nodalline") == 0) {
350 else if (strcmp(keyword,
"section") == 0) {
354 else if (strcmp(keyword,
"acrossgamma") == 0) {
358 else if (strcmp(keyword,
"position") == 0) {
361 else if (strcmp(keyword,
"scale") == 0) {
362 ierr = fscanf(fp,
"%f", &
scl);
364 else if (strcmp(keyword,
"rotation") == 0) {
367 else if (strcmp(keyword,
"fermienergy") == 0) {
368 ierr = fscanf(fp,
"%f", &
EF);
370 else if (strcmp(keyword,
"stereogram") == 0) {
371 ierr = fscanf(fp,
"%s", value);
373 if (strcmp(value,
"none") == 0)
lstereo = 1;
374 else if (strcmp(value,
"parallel") == 0)
lstereo = 2;
375 else if (strcmp(value,
"cross") == 0)
lstereo = 3;
377 printf(
"Error! %s = %s", keyword, value);
381 else if (strcmp(keyword,
"tetrahedron") == 0) {
382 ierr = fscanf(fp,
"%d", &
itet);
385 printf(
"Error! %s", keyword);
411 char ctmp[256], ctmpEF1[16], ctmpEF2[16];
412 int ierr, ii, ib, i0, i1, i2, ii0, ii1, ii2;
417 printf(
"file open error!!\n");
418 printf(
" Press any key to exit.\n");
422 *
terminal << wxT(
"\n##### Reading BXSF file ")
425 cerr = fgets(ctmp, 256, fp);
426 while (strstr(ctmp,
"Fermi Energy:") == NULL) {
427 cerr = fgets(ctmp, 256, fp);
429 ierr = sscanf(ctmp,
"%s %s %lf", ctmpEF1, ctmpEF2, &
EF);
430 *
terminal << wxString::Format(wxT(
" Fermi energy : %le\n"),
EF);
432 cerr = fgets(ctmp, 256, fp);
433 while (strstr(ctmp,
"BEGIN_BLOCK_BANDGRID_3D") == NULL) {
434 cerr = fgets(ctmp, 256, fp);
436 while (strstr(ctmp,
"BEGIN_BANDGRID_3D") == NULL) {
437 cerr = fgets(ctmp, 256, fp);
439 cerr = fgets(ctmp, 256, fp);
440 ierr = sscanf(ctmp,
"%d", &
nb);
441 *
terminal << wxString::Format(wxT(
" Number of bands : %d\n"),
nb);
442 cerr = fgets(ctmp, 256, fp);
443 ierr = sscanf(ctmp,
"%d%d%d", &
ng0[0], &
ng0[1], &
ng0[2]);
444 for (ii = 0; ii < 3; ii++)
ng0[ii] -= 1;
445 *
terminal << wxString::Format(wxT(
" k point grid : %d %d %d\n"),
448 cerr = fgets(ctmp, 256, fp);
449 for (ii = 0; ii < 3; ++ii) {
450 cerr = fgets(ctmp, 256, fp);
451 ierr = sscanf(ctmp,
"%e%e%e", &
bvec[ii][0], &
bvec[ii][1], &
bvec[ii][2]);
452 *
terminal << wxString::Format(wxT(
" Bvec %d : %f %f %f\n"),
457 for (ib = 0; ib <
nb; ib++) {
458 cerr = fgets(ctmp, 256, fp);
459 while (strstr(ctmp,
"BAND:") == NULL) {
460 cerr = fgets(ctmp, 256, fp);
462 *
terminal << wxString::Format(wxT(
" Reading %s"), ctmp);
464 for (i0 = 0; i0 <=
ng0[0]; i0++) {
465 if (i0 ==
ng0[0]) ii0 = 0;
467 for (i1 = 0; i1 <=
ng0[1]; i1++) {
468 if (i1 ==
ng0[1]) ii1 = 0;
470 for (i2 = 0; i2 <=
ng0[2]; i2++) {
471 if (i2 ==
ng0[2]) ii2 = 0;
474 ierr = fscanf(fp,
"%e", &
eig0[ib][ii0][ii1][ii2]);
475 eig0[ib][ii0][ii1][ii2] -=
EF;
480 cerr = fgets(ctmp, 256, fp);
483 for (ii = 0; ii < 3; ii++)
shiftk[ii] = 0;