• R/O
  • HTTP
  • SSH
  • HTTPS

fermisurfer: Commit

fermisurfer Git


Commit MetaInfo

Revision034cbe696a33bd51f6aabd6c7e3b2f56f99c68ff (tree)
Zeit2022-03-09 16:35:20
AutorMitsuaki Kawamura <kawamitsuaki@gmai...>
CommiterMitsuaki Kawamura

Log Message

Port resize, automatic detection ob tetra, band on/off

Ändern Zusammenfassung

Diff

--- a/javascript/fermisurfer.html
+++ b/javascript/fermisurfer.html
@@ -1,5 +1,5 @@
11 <!DOCTYPE html>
2-<html>
2+<html lang="en">
33 <head>
44 <title>FermiSurfer on Web</title>
55 <link rel="shortcut icon" href="../figs/fermisurfer.ico" type="image/vnd.microsoft.icon">
@@ -17,162 +17,181 @@
1717 <script type="text/javascript" src="./fermisurfer.js" defer></script>
1818 </head>
1919 <body>
20- <img src="ads.png" height="200">
20+ <img src="ads.png" height="200" alt="ADVERTISE HERE">
2121 <br>
2222 File: <input type="file" id="inputfile" name="inputfile" onchange="read_file();">
2323 <a href="../ja/_build/html/onweb.html" target="_blank">日本語マニュアル</a> / <a href="../en/_build/html/onweb.html" target="_blank">Manual in English</a>
2424 <a href="https://fermisurfer.osdn.jp/index.html" target="_blank">FermiSurfer Web page</a>
2525 <a href="https://doi.org/10.1016/j.cpc.2019.01.017" target="_blank">CPC paper</a>
2626 <a href="https://arxiv.org/abs/1811.06177" target="_blank">arXiv paper</a>
27- <table border="0">
28- <tr align="left">
27+ <table style="border:0;">
28+ <tr style="text-align: left;">
2929 <td><canvas id="glcanvas" width="600" height="600" style="border:solid black 1px;"></canvas></td>
3030 <td>
31- <table border="0">
32- <tr align="left">
31+ <table style="border:0;">
32+ <tr style="text-align: left;">
33+ <td><label>Width: <input type="text" id="width" value="600"></label></td>
34+ <td><label>Height: <input type="text" id="height" value="600"></label></td>
35+ <td><input type="button" value="resize" onclick="resizeCanvas();"></td>
36+ </tr>
37+ <tr style="text-align: left;">
3338 <td><input type="button" value="update" onclick="update_delay();"></td>
3439 <td>Line width :</td>
35- <td><input type="number" name="linewidth" id="linewidth" value="1" onchange="update_now();" step="0.1" min="0"></td>
36- <td><input type="checkbox" name="ongamma" id="ongamma" value="ongamma" checked="checked">On Gamma</td>
40+ <td><label><input type="number" name="linewidth" id="linewidth" value="1" onchange="update_now();" step="0.1" min="0"></label></td>
41+ <td><label><input type="checkbox" name="ongamma" id="ongamma" value="ongamma" checked="checked">On Gamma</label></td>
3742 </tr>
38- <tr align="left">
43+ <tr style="text-align: left;">
3944 <td>Section-v : </td>
40- <td><input type="number" name="sectionv0" id="sectionv0" value="0"></td>
41- <td><input type="number" name="sectionv1" id="sectionv1" value="0"></td>
42- <td><input type="number" name="sectionv2" id="sectionv2" value="1"></td>
45+ <td><label><input type="number" name="sectionv0" id="sectionv0" value="0"></label></td>
46+ <td><label><input type="number" name="sectionv1" id="sectionv1" value="0"></label></td>
47+ <td><label><input type="number" name="sectionv2" id="sectionv2" value="1"></label></td>
4348 </tr>
44- <tr align="left">
49+ <tr style="text-align: left;">
4550 <td>Equator-v : </td>
46- <td><input type="number" name="equatorv0" id="equatorv0" value="0"></td>
47- <td><input type="number" name="equatorv1" id="equatorv1" value="0"></td>
48- <td><input type="number" name="equatorv2" id="equatorv2" value="1"></td>
49- </tr>
50- <tr align="left">
51- <td>Interpol ratio : </td>
52- <td><input type="number" name="interpol" id="interpol" value="1" step="1" min="1" onchange="update_interpol();"></td>
51+ <td><label><input type="number" name="equatorv0" id="equatorv0" value="0"></label></td>
52+ <td><label><input type="number" name="equatorv1" id="equatorv1" value="0"></label></td>
53+ <td><label><input type="number" name="equatorv2" id="equatorv2" value="1"></label></td>
54+ </tr>
55+ <tr style="text-align: left;">
56+ <td>Interpol ratio : </td>
57+ <td>
58+ <label>
59+ <input type="number" name="interpol" id="interpol" value="1" step="1" min="1" onchange="update_interpol();">
60+ </label>
61+ </td>
5362 <td>Fermi energy : </td>
54- <td><input type="number" name="fermienergy" id="fermienergy" value="0.0" onchange="update_efermi();"></td>
63+ <td>
64+ <label>
65+ <input type="number" name="fermienergy" id="fermienergy" value="0.0" onchange="update_efermi();">
66+ </label>
67+ </td>
5568 </tr>
56- <tr align="left">
69+ <tr style="text-align: left;">
5770 <td>Min. of Scale : </td>
58- <td><input type="number" name="scalemin" id="scalemin" value="" onchange="update_minmax();"></td>
71+ <td><label><input type="number" name="scalemin" id="scalemin" value="" onchange="update_minmax();"></label></td>
5972 <td>Max. of Scale : </td>
60- <td><input type="number" name="scalemax" id="scalemax" value="" onchange="update_minmax();"></td>
73+ <td><label><input type="number" name="scalemax" id="scalemax" value="" onchange="update_minmax();"></label></td>
6174 </tr>
62- <tr align="left">
75+ <tr style="text-align: left;">
6376 <td>Tetrahedron : </td>
6477 <td></td>
6578 <td></td>
6679 <td></td>
6780 </tr>
68- <tr align="left">
81+ <tr style="text-align: left;">
6982 <form id="tetrahedron">
70- <td><input type="radio" name="tetrahedron" value="0" checked="checked" onchange="update_tetra();">0
71- <input type="radio" name="tetrahedron" value="1" onchange="update_tetra();">1
72- <input type="radio" name="tetrahedron" value="2" onchange="update_tetra();">2</td>
73- <td><input type="radio" name="tetrahedron" value="3" onchange="update_tetra();">3
74- <input type="radio" name="tetrahedron" value="4" onchange="update_tetra();">4
75- <input type="radio" name="tetrahedron" value="5" onchange="update_tetra();">5</td>
76- <td><input type="radio" name="tetrahedron" value="6" onchange="update_tetra();">6
77- <input type="radio" name="tetrahedron" value="7" onchange="update_tetra();">7</td>
78- <td><input type="radio" name="tetrahedron" value="8" onchange="update_tetra();">8
79- <input type="radio" name="tetrahedron" value="9" onchange="update_tetra();">9</td>
83+ <td>
84+ <label><input type="radio" name="tetrahedron" value="0" checked="checked" onchange="update_tetra();">0</label>
85+ <label><input type="radio" name="tetrahedron" value="1" onchange="update_tetra();">1</label>
86+ <label><input type="radio" name="tetrahedron" value="2" onchange="update_tetra();">2</label>
87+ </td>
88+ <td>
89+ <label><input type="radio" name="tetrahedron" value="3" onchange="update_tetra();">3</label>
90+ <label><input type="radio" name="tetrahedron" value="4" onchange="update_tetra();">4</label>
91+ <label><input type="radio" name="tetrahedron" value="5" onchange="update_tetra();">5</label>
92+ </td>
93+ <td>
94+ <label><input type="radio" name="tetrahedron" value="6" onchange="update_tetra();">6</label>
95+ <label><input type="radio" name="tetrahedron" value="7" onchange="update_tetra();">7</label>
96+ </td>
97+ <td>
98+ <label><input type="radio" name="tetrahedron" value="8" onchange="update_tetra();">8</label>
99+ <label><input type="radio" name="tetrahedron" value="9" onchange="update_tetra();">9</label>
100+ </td>
80101 </form>
81102 </tr>
82- <tr align="left">
103+ <tr style="text-align: left;">
83104 <td>Color-scale mode : </td>
84105 <td></td>
85106 <td></td>
86107 <td></td>
87108 </tr>
88- <tr align="left">
109+ <tr style="text-align: left;">
89110 <form id="colorscalemode">
90- <td><input type="radio" name="colorscalemode" value="1" checked="checked" onchange="update_color();">Input(1D)</td>
91- <td><input type="radio" name="colorscalemode" value="2" onchange="update_color();">Input(2D)</td>
92- <td><input type="radio" name="colorscalemode" value="3" onchange="update_color();">Input(3D)</td>
93- <td><input type="radio" name="colorscalemode" value="4" onchange="update_color();">Fermi velocity</td>
111+ <td><label><input type="radio" name="colorscalemode" value="1" checked="checked" onchange="update_color();">Input(1D)</label></td>
112+ <td><label><input type="radio" name="colorscalemode" value="2" onchange="update_color();">Input(2D)</label></td>
113+ <td><label><input type="radio" name="colorscalemode" value="3" onchange="update_color();">Input(3D)</label></td>
114+ <td><label><input type="radio" name="colorscalemode" value="4" onchange="update_color();">Fermi velocity</label></td>
94115 </form>
95116 </tr>
96- <tr align="left">
117+ <tr style="text-align: left;">
97118 <td>Brillouin zone : </td>
98119 <form id="brillouinzone">
99- <td><input type="radio" name="brillouinzone" value="1" checked="checked">First</td>
100- <td><input type="radio" name="brillouinzone" value="-1">Premitive</td>
120+ <td><label><input type="radio" name="brillouinzone" value="1" checked="checked">First</label></td>
121+ <td><label><input type="radio" name="brillouinzone" value="-1">Primitive</label></td>
101122 </form>
102123 <td></td>
103124 </tr>
104- <tr align="left">
125+ <tr style="text-align: left;">
105126 <td>Stereogram : </td>
106127 <form id="stereogram">
107- <td><input type="radio" name="stereogram" value="1" checked="checked">None</td>
108- <td><input type="radio" name="stereogram" value="2">Parallel</td>
109- <td><input type="radio" name="stereogram" value="3">Cross</td>
128+ <td><label><input type="radio" name="stereogram" value="1" checked="checked">None</label></td>
129+ <td><label><input type="radio" name="stereogram" value="2">Parallel</label></td>
130+ <td><label><input type="radio" name="stereogram" value="3">Cross</label></td>
110131 </form>
111132 </tr>
112- <tr align="left">
133+ <tr style="text-align: left;">
113134 <td>Mouse drag : </td>
114135 <form id="mousedrag">
115- <td><input type="radio" name="mousedrag" value="1" checked="checked">Rotate</td>
116- <td><input type="radio" name="mousedrag" value="2">Scale</td>
117- <td><input type="radio" name="mousedrag" value="3">Translate</td>
136+ <td><label><input type="radio" name="mousedrag" value="1" checked="checked">Rotate</label></td>
137+ <td><label><input type="radio" name="mousedrag" value="2">Scale</label></td>
138+ <td><label><input type="radio" name="mousedrag" value="3">Translate</label></td>
118139 </form>
119140 </tr>
120- <tr align="left">
141+ <tr style="text-align: left;">
121142 <td>BZ number : </td>
122- <td><input type="number" name="bznumber1" id="bznumber0" value="1"></td>
123- <td><input type="number" name="bznumber2" id="bznumber1" value="1"></td>
124- <td><input type="number" name="bznumber3" id="bznumber2" value="1"></td>
143+ <td><label><input type="number" name="bznumber1" id="bznumber0" value="1"></label></td>
144+ <td><label><input type="number" name="bznumber2" id="bznumber1" value="1"></label></td>
145+ <td><label><input type="number" name="bznumber3" id="bznumber2" value="1"></label></td>
125146 </tr>
126- <tr align="left">
147+ <tr style="text-align: left;">
127148 <td>Backgraound (RGB) : </td>
128- <td><input type="number" name="backgraoundr" id="backgraoundr" value="0" onchange="update_now();" step="0.1" min="0" max="1"></td>
129- <td><input type="number" name="backgraoundg" id="backgraoundg" value="0" onchange="update_now();" step="0.1" min="0" max="1"></td>
130- <td><input type="number" name="backgraoundb" id="backgraoundb" value="0" onchange="update_now();" step="0.1" min="0" max="1"></td>
149+ <td><label><input type="number" name="backgraoundr" id="backgraoundr" value="0" onchange="update_now();" step="0.1" min="0" max="1"></label></td>
150+ <td><label><input type="number" name="backgraoundg" id="backgraoundg" value="0" onchange="update_now();" step="0.1" min="0" max="1"></label></td>
151+ <td><label><input type="number" name="backgraoundb" id="backgraoundb" value="0" onchange="update_now();" step="0.1" min="0" max="1"></label></td>
131152 </tr>
132- <tr align="left">
153+ <tr style="text-align: left;">
133154 <td>Line color (RGB) : </td>
134- <td><input type="number" name="linecolorr" id="linecolorr" value="1" onchange="update_now();" step="0.1" min="0" max="1"></td>
135- <td><input type="number" name="linecolorg" id="linecolorg" value="1" onchange="update_now();" step="0.1" min="0" max="1"></td>
136- <td><input type="number" name="linecolobr" id="linecolorb" value="1" onchange="update_now();" step="0.1" min="0" max="1"></td>
155+ <td><label><input type="number" name="linecolorr" id="linecolorr" value="1" onchange="update_now();" step="0.1" min="0" max="1"></label></td>
156+ <td><label><input type="number" name="linecolorg" id="linecolorg" value="1" onchange="update_now();" step="0.1" min="0" max="1"></label></td>
157+ <td><label><input type="number" name="linecolobr" id="linecolorb" value="1" onchange="update_now();" step="0.1" min="0" max="1"></label></td>
137158 </tr>
138- <tr align="left">
159+ <tr style="text-align: left;">
139160 <td><input type="button" value="Rotate" onclick="update_now();"></td>
140- <td><input type="number" name="rotatex" id="rotatex" value="0"></td>
141- <td><input type="number" name="rotatey" id="rotatey" value="0"></td>
142- <td><input type="number" name="rotatez" id="rotatez" value="0"></td>
161+ <td><label><input type="number" name="rotatex" id="rotatex" value="0"></label></td>
162+ <td><label><input type="number" name="rotatey" id="rotatey" value="0"></label></td>
163+ <td><label><input type="number" name="rotatez" id="rotatez" value="0"></label></td>
143164 </tr>
144- <tr align="left">
145- <td>Scale : <input type="number" name="scale" id="scale" value="1" onchange="update_now();" step="0.1" min="0"></td>
165+ <tr style="text-align: left;">
166+ <td><label>Scale : <input type="number" name="scale" id="scale" value="1" onchange="update_now();" step="0.1" min="0"></label></td>
146167 <td>Position : </td>
147- <td><input type="number" name="positionx" id="positionx" value="0" onchange="update_now();"></td>
148- <td><input type="number" name="positiony" id="positiony" value="0" onchange="update_now();"></td>
168+ <td><label><input type="number" name="positionx" id="positionx" value="0" onchange="update_now();"></label></td>
169+ <td><label><input type="number" name="positiony" id="positiony" value="0" onchange="update_now();"></label></td>
149170 </tr>
150- <tr align="left">
151- <td><input type="checkbox" name="colorbar" id="colorbar" value="colorbar" checked="checked" onchange="update_now();">Color bar</td>
152- <td><input type="checkbox" name="equator" id="equator" value="equator" onchange="update_now();">Equator</td>
153- <td><input type="checkbox" name="nodalline" id="nodalline" value="nodalline" onchange="update_now();">Nodal line</td>
154- <td><input type="checkbox" name="section" id="section" value="section" onchange="update_now();">Section</td>
171+ <tr style="text-align: left;">
172+ <td><label><input type="checkbox" name="colorbar" id="colorbar" value="colorbar" checked="checked" onchange="update_now();">Color bar</label></td>
173+ <td><label><input type="checkbox" name="equator" id="equator" value="equator" onchange="update_now();">Equator</label></td>
174+ <td><label><input type="checkbox" name="nodalline" id="nodalline" value="nodalline" onchange="update_now();">Nodal line</label></td>
175+ <td><label><input type="checkbox" name="section" id="section" value="section" onchange="update_now();">Section</label></td>
155176 </tr>
156- <tr align="left">
177+ <tr style="text-align: left;">
157178 <td>Lighting : </td>
158179 <form id="lighting">
159- <td><input type="radio" name="lighting" value="1.0" checked="checked" onchange="update_now();">Both</td>
160- <td><input type="radio" name="lighting" value="-1.0" onchange="update_now();">Occupy</td>
161- <td><input type="radio" name="lighting" value="1.0" onchange="update_now();">Unoccupy</td>
180+ <td><label><input type="radio" name="lighting" value="1.0" checked="checked" onchange="update_now();">Both</label></td>
181+ <td><label><input type="radio" name="lighting" value="-1.0" onchange="update_now();">Occupy</label></td>
182+ <td><label><input type="radio" name="lighting" value="1.0" onchange="update_now();">Empty</label></td>
162183 </form>
163184 </tr>
164- <tr align="left">
185+ <tr style="text-align: left;">
165186 <form id="barcolor">
166- <td><input type="radio" name="barcolor" value="bgr" checked="checked">BGR</td>
167- <td><input type="radio" name="barcolor" value="cmy">CMY</td>
168- <td><input type="radio" name="barcolor" value="mcy">MCY</td>
187+ <td><label><input type="radio" name="barcolor" value="bgr" checked="checked">BGR</label></td>
188+ <td><label><input type="radio" name="barcolor" value="cmy">CMY</label></td>
189+ <td><label><input type="radio" name="barcolor" value="mcy">MCY</label></td>
169190 </form>
170191 </tr>
171- <tr align="left">
192+ <tr style="text-align: left;">
172193 <td><input type="button" value="Section file"></td>
173- <td><input type="checkbox" name="band0" id="band0" value="band0" checked="checked" onchange="update_now();">Band 0</td>
174- <td><input type="checkbox" name="band1" id="band1" value="band1" checked="checked" onchange="update_now();">Band 1</td>
175- <td><input type="checkbox" name="band2" id="band2" value="band2" checked="checked" onchange="update_now();">Band 2</td>
194+ <td><label>Band: <input type="number" name="band" id="band" value="0" onchange="update_now();"></label></td>
176195 </tr>
177196 </table>
178197 </td>
--- a/javascript/fermisurfer.js
+++ b/javascript/fermisurfer.js
@@ -27,7 +27,7 @@ THE SOFTWARE.
2727 /**@mainpage FermiSurfer Main Page
2828
2929 Fermisurfer displays Fermi surfaces
30-with a color-plot of the arbitraly matrix element
30+with a color-plot of the arbitrary matrix element
3131
3232 @section Notation
3333
@@ -41,7 +41,7 @@ with a color-plot of the arbitraly matrix element
4141
4242 @section sec_file Important files
4343 - Main routine : fermisurfer.cpp
44-- Global valiable : variable.hpp
44+- Global variable : variable.hpp
4545
4646 @section sec_flow Flow
4747
@@ -56,7 +56,7 @@ with a color-plot of the arbitraly matrix element
5656 Input variables
5757 */
5858 let ng0 = [0, 0, 0]; //!< @f$k@f$-point grid in the input file
59-let shiftk = [0, 0, 0]; //!< Wherether @f$k@f$-grid is shifted or not
59+let shiftk = [0, 0, 0]; //!< Whether @f$k@f$-grid is shifted or not
6060 let nb = 0; //!< The number of Bands
6161 let avec = [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]]; //!< Direct lattice vector
6262 let bvec = [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]]; //!< Reciprocal lattice vector
@@ -92,7 +92,7 @@ let brnrm = []; //!< Norms of Bragg plane vectors
9292 let brnrm_min = 0.0; //!< Minimum scale of the reciplocal space
9393 let nbragg = 0; //!< Number of Bragg plane og 1st BZ
9494 /*
95- Variables for patchs
95+ Variables for patches
9696 */
9797 let ntri = []; //!< The number of triangle patch [::nb]
9898 let draw_band = []; //!< Switch for drawn bands [::nb]
@@ -156,7 +156,6 @@ let black = [0.0, 0.0, 0.0, 1.0]; //!< Black color code
156156 let gray = [0.5, 0.5, 0.5, 1.0]; //!< Gray color code
157157 let wgray = [0.9, 0.9, 0.9, 1.0]; //!< Gray color code
158158 let bgray = [0.1, 0.1, 0.1, 1.0]; //!< Gray color code
159-let white = [1.0, 1.0, 1.0, 1.0]; //!< White color code
160159 let cyan = [0.0, 1.0, 1.0, 1.0]; //!< Cyan color code
161160 let magenta = [1.0, 0.0, 1.0, 1.0]; //!< Magenta color code
162161 let yellow = [1.0, 1.0, 0.0, 1.0]; //!< Yellow color code
@@ -288,7 +287,7 @@ function main() {
288287 // Draw the scene.
289288 //
290289 function drawScene() {
291- let ib = 0, ii = 0, jj = 0;
290+ let ib = 0, ii = 0, jj = 0, icount = 0, itri = 0;
292291
293292 gl.clearColor(BackGroundColor[0], BackGroundColor[1], BackGroundColor[2], BackGroundColor[3]); // Clear to black, fully opaque
294293 gl.clearDepth(1.0); // Clear everything
@@ -347,22 +346,24 @@ function drawScene() {
347346 {
348347 let vertexCount = 0;
349348 for (ib = 0; ib < nb; ib++) {
350- if (draw_band[ib] == 1) vertexCount += ntri[ib] * 3;
349+ if (draw_band[ib] === 1) vertexCount += ntri[ib] * 3;
351350 }
352351
353352 let nkvp = vertexCount * 3;
354353 let positions = new Float32Array(nkvp);
355354 icount = 0;
356355 for (ib = 0; ib < nb; ib++) {
357- for (itri = 0; itri < ntri[ib]; itri++) {
358- for (ii = 0; ii < 3; ii++) {
359- for (jj = 0; jj < 3; jj++) {
360- positions[icount] = (
361- rot[jj][0] * kvp[ib][itri][ii][0]
362- + rot[jj][1] * kvp[ib][itri][ii][1]
363- + rot[jj][2] * kvp[ib][itri][ii][2]) * scl
364- + trans[jj];
365- icount += 1;
356+ if (draw_band[ib] === 1) {
357+ for (itri = 0; itri < ntri[ib]; itri++) {
358+ for (ii = 0; ii < 3; ii++) {
359+ for (jj = 0; jj < 3; jj++) {
360+ positions[icount] = (
361+ rot[jj][0] * kvp[ib][itri][ii][0]
362+ + rot[jj][1] * kvp[ib][itri][ii][1]
363+ + rot[jj][2] * kvp[ib][itri][ii][2]) * scl
364+ + trans[jj];
365+ icount += 1;
366+ }
366367 }
367368 }
368369 }
@@ -372,13 +373,15 @@ function drawScene() {
372373 let vertexNormals = new Float32Array(nnmlp);
373374 icount = 0;
374375 for (ib = 0; ib < nb; ib++) {
375- for (itri = 0; itri < ntri[ib]; itri++) {
376- for (ii = 0; ii < 3; ii++) {
377- for (jj = 0; jj < 3; jj++) {
378- vertexNormals[icount] = rot[jj][0] * nmlp[ib][itri][ii][0]
379- + rot[jj][1] * nmlp[ib][itri][ii][1]
380- + rot[jj][2] * nmlp[ib][itri][ii][2];
381- icount += 1;
376+ if (draw_band[ib] === 1) {
377+ for (itri = 0; itri < ntri[ib]; itri++) {
378+ for (ii = 0; ii < 3; ii++) {
379+ for (jj = 0; jj < 3; jj++) {
380+ vertexNormals[icount] = rot[jj][0] * nmlp[ib][itri][ii][0]
381+ + rot[jj][1] * nmlp[ib][itri][ii][1]
382+ + rot[jj][2] * nmlp[ib][itri][ii][2];
383+ icount += 1;
384+ }
382385 }
383386 }
384387 }
@@ -388,11 +391,13 @@ function drawScene() {
388391 let colors = new Float32Array(nclr);
389392 icount = 0;
390393 for (ib = 0; ib < nb; ib++) {
391- for (itri = 0; itri < ntri[ib]; itri++) {
392- for (ii = 0; ii < 3; ii++) {
393- for (jj = 0; jj < 4; jj++) {
394- colors[icount] = clr[ib][jj + 4 * ii + 12 * itri];
395- icount += 1;
394+ if (draw_band[ib] === 1) {
395+ for (itri = 0; itri < ntri[ib]; itri++) {
396+ for (ii = 0; ii < 3; ii++) {
397+ for (jj = 0; jj < 4; jj++) {
398+ colors[icount] = clr[ib][jj + 4 * ii + 12 * itri];
399+ icount += 1;
400+ }
396401 }
397402 }
398403 }
@@ -605,11 +610,11 @@ function touch_start(evt) {
605610 var touches = evt.changedTouches;
606611
607612 for (i = 0; i < touches.length; i++) {
608- if (touches[i].identifier == 0) {
613+ if (touches[i].identifier === 0) {
609614 touch0x = touches[i].clientX;
610615 touch0y = touches[i].clientY;
611616 }
612- else if (touches[i].identifier == 1) {
617+ else if (touches[i].identifier === 1) {
613618 touch1x = touches[i].clientX;
614619 touch1y = touches[i].clientY;
615620 }
@@ -621,8 +626,8 @@ function touch_move(evt) {
621626 var touches = evt.changedTouches;
622627 let dx = 0.0, dy = 0.0, dold = 0.0, dnew = 0.;
623628
624- if (touches.length == 1) {
625- if (touches[0].identifier == 0) {
629+ if (touches.length === 1) {
630+ if (touches[0].identifier === 0) {
626631 dx = 0.001 * (touches[0].clientX - touch0x);
627632 dy = 0.001 * (touches[0].clientY - touch0y);
628633 mouserotation(dx, dy)
@@ -631,7 +636,7 @@ function touch_move(evt) {
631636 touch0y = touches[0].clientY;
632637 }
633638 }
634- else if (touches.length == 2) {
639+ else if (touches.length === 2) {
635640 dold = Math.sqrt((touch1x - touch0x) * (touch1x - touch0x) + (touch1y - touch0y) * (touch1y - touch0y));
636641 touch0x = touches[0].clientX;
637642 touch0y = touches[0].clientY;
@@ -650,7 +655,7 @@ function mouse_down(evt){
650655 touch0x = evt.offsetX;
651656 touch0y = evt.offsetY;
652657 isDrawing = true;
653-};
658+}
654659
655660 function mouse_move(evt){
656661 if (isDrawing === true) {
@@ -663,7 +668,7 @@ function mouse_move(evt){
663668 touch0x = evt.offsetX;
664669 touch0y = evt.offsetY;
665670 }
666-};
671+}
667672
668673 function mouse_up(evt){
669674 if (isDrawing === true) {
@@ -677,7 +682,7 @@ function mouse_up(evt){
677682 touch0y = 0;
678683 isDrawing = false;
679684 }
680-};
685+}
681686
682687 function zoom(evt) {
683688 scl -= evt.deltaY*0.001;
@@ -691,7 +696,7 @@ function mouserotation(dx, dy) {
691696 let rot0 = [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]];
692697 let rot1 = [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]];
693698
694- if (a != 0.0) {
699+ if (a !== 0.0) {
695700 //
696701 // Compute rotational matrix from translation of mousepointer
697702 //
@@ -2761,13 +2766,14 @@ function init_corner()
27612766 }
27622767 }
27632768 /**
2764- @brief Compute Bragg vetor
2769+ @brief Compute Bragg vector
27652770
27662771 Modify : ::bragg, ::brnrm
27672772 */
27682773 function bragg_vector()
27692774 {
2770- let i0, i1, i2, i, ibr;
2775+ let i0, i1, i2, i, ibr, sw = [0, 0, 0, 0];
2776+ let ldiag = [0.0, 0.0, 0.0, 0.0], bdiag = [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]];
27712777 /**/
27722778 ibr = 0;
27732779 //
@@ -2777,11 +2783,11 @@ function bragg_vector()
27772783 for (i1 = -1; i1 <= 1; ++i1) {
27782784 for (i2 = -1; i2 <= 1; ++i2) {
27792785 /*
2780- Excepte Gamma points
2786+ Except Gamma points
27812787 */
27822788 if (i0 == 0 && i1 == 0 && i2 == 0) continue;
27832789 /*
2784- Fractional -> Cartecian
2790+ Fractional -> Cartesian
27852791 */
27862792 bragg.push([]);
27872793 for (i = 0; i < 3; ++i)
@@ -2807,6 +2813,20 @@ function bragg_vector()
28072813 if (brnrm_min > brnrm[ibr]) brnrm_min = brnrm[ibr];
28082814 }
28092815 terminal(" Minimum Bragg norm : " + String(brnrm_min) + "\n");
2816+ //
2817+ // Search the shortest diagonal line
2818+ //
2819+ for (i = 0; i < 3; i++) {
2820+ bdiag[0][i] = bvec[0][i] / ng0[0] + bvec[1][i] / ng0[1] + bvec[2][i] / ng0[2];
2821+ bdiag[1][i] = bvec[0][i] / ng0[0] + bvec[1][i] / ng0[1] - bvec[2][i] / ng0[2];
2822+ bdiag[2][i] = bvec[0][i] / ng0[0] - bvec[1][i] / ng0[1] + bvec[2][i] / ng0[2];
2823+ bdiag[3][i] = -bvec[0][i] / ng0[0] + bvec[1][i] / ng0[1] + bvec[2][i] / ng0[2];
2824+ }
2825+ for (i = 0; i < 4; i++)
2826+ ldiag[i] = bdiag[i][0] * bdiag[i][0] + bdiag[i][1] * bdiag[i][1] + bdiag[i][2] * bdiag[i][2];
2827+ eigsort(4, ldiag, sw);
2828+ itet = sw[0];
2829+ document.getElementById("tetrahedron").tetrahedron.value = String(itet);
28102830 }/* bragg_vector */
28112831 /**
28122832 @brief Print max and minimum @f$\varepsilon_{n k}, \Delta_{n k}@f$
@@ -3078,6 +3098,8 @@ function update_delay() {
30783098 drawScene();
30793099 }
30803100 function update_now() {
3101+ let ib = 0, i0 = 0, i1 =0, i2 = 0;
3102+
30813103 linewidth = Number(document.getElementById("linewidth").value);
30823104 //
30833105 // Line color
@@ -3086,7 +3108,7 @@ function update_now() {
30863108 LineColor[1] = Number(document.getElementById("linecolorg").value);
30873109 LineColor[2] = Number(document.getElementById("linecolorb").value);
30883110 //
3089- // Back ground color
3111+ // Background color
30903112 //
30913113 BackGroundColor[0] = Number(document.getElementById("backgraoundr").value);
30923114 BackGroundColor[1] = Number(document.getElementById("backgraoundg").value);
@@ -3109,6 +3131,23 @@ function update_now() {
31093131 rot[2][1] = Math.cos(thetaz) * Math.sin(thetax) + Math.cos(thetax) * Math.sin(thetay) * Math.sin(thetaz);
31103132 rot[2][2] = Math.cos(thetax) * Math.cos(thetay);
31113133 scl = Number(document.getElementById("scale").value);
3134+ //
3135+ //Band
3136+ //
3137+ i0 = Number(document.getElementById("band").value);
3138+ i1 = 10;
3139+ for (ib = 0; ib < nb; ib++) {
3140+ i2 = i0 % i1;
3141+ if (i2 === 0){
3142+ draw_band[ib] = 0;
3143+ }
3144+ else{
3145+ draw_band[ib] = 1;
3146+ }
3147+ i0 += -i2;
3148+ i1 *= 10;
3149+ }
3150+
31123151 drawScene();
31133152 }
31143153 function update_interpol() {
@@ -3131,7 +3170,7 @@ function update_minmax() {
31313170 }
31323171 function update_tetra() {
31333172 itet = Number(document.getElementById('tetrahedron').tetrahedron.value);
3134- init_corner();
3173+ init_corner();
31353174 refresh_patch = 1;
31363175 }
31373176 function button_update() {
@@ -3214,8 +3253,6 @@ function button_update() {
32143253 }
32153254 }
32163255 /**/
3217- if (document.getElementById("band0")) draw_band[0] = 1;
3218- else draw_band[0] = 0;
32193256
32203257 free_patch();
32213258 compute_patch_segment();
@@ -3372,13 +3409,18 @@ function allocate_griddata(
33723409
33733410 for (i = 0; i < 3; i++) ng[i] = ng0[i];
33743411
3412+ i0 = 0;
3413+ i1 = 1;
33753414 for (i = 0; i < nb; i++) {
33763415 ntri.push(0);
33773416 nnl.push(0);
33783417 n2d.push(0);
33793418 nequator.push(0);
33803419 draw_band.push(1);
3420+ i0 += i1;
3421+ i1 *= 10;
33813422 }
3423+ document.getElementById("band").value = String(i0);
33823424
33833425 scl /= Math.sqrt(bvec[0][0] * bvec[0][0] + bvec[0][1] * bvec[0][1] + bvec[0][2] * bvec[0][2]);
33843426 linewidth /= scl;
@@ -3534,8 +3576,8 @@ function read_from_text(datas) {
35343576 }//for (iaxis = 0; iaxis < 1; iaxis++)
35353577 //
35363578 interpol_energy();
3537- init_corner();
35383579 bragg_vector();
3580+ init_corner();
35393581 //
35403582 //Brillouin zone
35413583 //
@@ -3891,4 +3933,12 @@ function calc_section() {
38913933 if (frmsf != "") {
38923934 let datas = frmsf.replace(/\n/g, ' ').replace(/^ +/, '').split(/ +/);
38933935 read_from_text(datas);
3894-}
\ No newline at end of file
3936+}
3937+function resizeCanvas() {
3938+ let el = document.getElementById("glcanvas");
3939+ let width = document.getElementById('width').value;
3940+ let height = document.getElementById('height').value;
3941+
3942+ el.setAttribute("width", width);
3943+ el.setAttribute("height", height);
3944+}
Show on old repository browser