diff --git a/notebook/band-theory/density_of_states.ipynb b/notebook/band-theory/density_of_states.ipynb index da657ed..8cc3ba6 100644 --- a/notebook/band-theory/density_of_states.ipynb +++ b/notebook/band-theory/density_of_states.ipynb @@ -64,19 +64,7 @@ " solution. The histogram method is a simple statistical representation of the eigenvalues (one simply represents the frequency with which a given range of eigenenergies occur). This latter approach is typically the fastest of those discussed, but shall also generally give results with the poorest level of resolution.\n", " \n", "\n", - "3. Why do the calculated results start to diverge when the energy level is higher than a certain value? Could you explain it with the k-space plot?\n", - "\n", - "
\n", - " Solution\n", - " In the free electron model, the energy isosurface is a sphere shown in \n", - " the left panel. The k-points grid must be larger than the energy \n", - " isosurface to obtain the correct DOS at the energy level. Here, we \n", - " have a fixed length of the k-points grid. When the energy is larger than \n", - " about 0.31, the k-points grid cannot include the whole sphere (check it by \n", - " clicking on the right panel to move the isovalue above and below 0.31). \n", - "
\n", - " \n", - "4. Set the number of k-points to the maximum value and consider Gaussian smearing with a reasonable value for the smearing parameter (say $\\sigma=0.07$). Looking at the calculated DOS with the G-vector range set to $0$, how does it compare with the analytical result? Can you explain any discrepancies you notice? Increasing the G-vector range to $1$, how does the calculated DOS now compare?\n", + "3. Set the number of k-points to the maximum value and consider Gaussian smearing with a reasonable value for the smearing parameter (say $\\sigma=0.07$). Looking at the calculated DOS with the G-vector range set to $0$, how does it compare with the analytical result? Can you explain any discrepancies you notice? Increasing the G-vector range to $1$, how does the calculated DOS now compare?\n", "\n", "
\n", " Solution\n", @@ -96,7 +84,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 54, "metadata": {}, "outputs": [], "source": [ @@ -115,54 +103,13 @@ "import matplotlib.pyplot as plt\n", "from ipywidgets import Button, RadioButtons, Layout, IntSlider, HBox, Text, VBox, Checkbox, Label, FloatSlider, Output, HTML\n", "from datetime import datetime\n", - "import logging\n", - "logger = logging.getLogger()\n", - "logger.setLevel(logging.DEBUG)\n", + "\n", "%matplotlib widget" ] }, { "cell_type": "code", - "execution_count": 20, - "metadata": {}, - "outputs": [], - "source": [ - "def get_kernel_id():\n", - " \"\"\"Get the current kernel ID, to distinguish different users.\n", - " \n", - " Call this only from within python jupyter notebooks.\n", - " \"\"\"\n", - " from IPython.lib import kernel\n", - " connection_file_path = kernel.get_connection_file()\n", - " connection_file = os.path.basename(connection_file_path)\n", - " kernel_id = connection_file.split('-', 1)[1].split('.')[0]\n", - " return kernel_id" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": {}, - "outputs": [], - "source": [ - "def log_button(name):\n", - " try:\n", - " allow_datacollection\n", - " except:\n", - " pass\n", - " else:\n", - " if allow_datacollection:\n", - " log_file = open('../log.dat', 'a+');\n", - " log_file.write(datetime.now().strftime(\"%Y-%m-%d %H:%M:%S\") + ' ')\n", - " log_file.write(get_kernel_id() + ' ')\n", - " log_file.write(name + ' ')\n", - " log_file.write(str(nkpt.value) + '\\n')\n", - " log_file.close()" - ] - }, - { - "cell_type": "code", - "execution_count": 22, + "execution_count": 55, "metadata": {}, "outputs": [], "source": [ @@ -204,8 +151,6 @@ " \n", " shape = (nkpt.value, nkpt.value, nkpt.value)\n", " kpts = np.dot(monkhorst_pack(shape), G).reshape(shape + (3,))\n", - " # with output:\n", - " # print(kpts)\n", " kpts = kpts.reshape(nkpt.value**3, 3)\n", "\n", " for i in range(-n, n+1):\n", @@ -219,25 +164,20 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 56, "metadata": {}, "outputs": [], "source": [ "alat_bohr = 7.72\n", - "\n", - "lattices = np.zeros((3, 3, 3));\n", - "\n", - "lattices[0] = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]) * alat_bohr / 2.0;\n", - "lattices[1] = np.array([[0, 1, 1], [1, 0, 1], [1, 1, 0]]) * alat_bohr / 2.0;\n", - "lattices[2] = np.array([[-1, 1, 1], [1, -1, 1], [1, 1, -1]]) * alat_bohr / 2.0;\n", + "emax=1.5 # consider DOS up to 1.5 eV\n", "\n", "#Choose the cubic lattice for using the linear tetrahadron method (ASE)\n", - "real_lattice_bohr = lattices[0]" + "real_lattice_bohr = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]) * alat_bohr / 2.0;" ] }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 57, "metadata": {}, "outputs": [], "source": [ @@ -246,7 +186,6 @@ "style = {'description_width': 'initial'}\n", "\n", "output_bs = Output()\n", - "cell_type = RadioButtons(options=['Simple cubic', 'FCC', 'BCC'], value='Simple cubic', description=\"Cell type:\")\n", "\n", "line1 = Label(\n", " value=r'Number of k-points per dimension, $N_k$'\n", @@ -255,12 +194,9 @@ "line2 = Label(\n", " value=r'(total number $=N_k^3$)'\n", ")\n", - "nkpt = IntSlider(value=4, min=4, max=15, description=\"\", style={'description_width': 'initial'}, continuous_update=False)\n", - "nkpt_box = HBox([VBox([line1, line2]), nkpt])\n", + "nkpt = IntSlider(value=10, min=5, max=40, description=\"\", style={'description_width': 'initial'}, continuous_update=False)\n", "\n", - "# nkpt = IntSlider(value=4, min=4, max=15,description=\"Number of kpoik-pointsnts per dimension\\n, $N_k$\" , display='flex',\n", - "# flex_flow='row', continuous_update=False)\n", - "grange = IntSlider(value=0, min=0, max=3, description=\"G-vector range:\", style=style)\n", + "grange = IntSlider(value=1, min=0, max=1, description=\"G-vector range:\", style=style)\n", "grange_hint =HTML(value=f\"Note that there may be a delay while the DOS is computed for G-vectors > 0.\")\n", "gcov = FloatSlider(value=0.5, min=0.1, max=1.0, description=\"Guassian covariance:\", style=style)\n", "\n", @@ -334,45 +270,6 @@ " })\n", "\n", " return segments_data\n", - "def get_bands(real_lattice_bohr, reference_distance = 0.025, g_vectors_range = 3):\n", - "\n", - " # Simple way to get automatically the band path:\n", - " # I go back to real space, just put a single atom at the origin,\n", - " # then go back with seekpath.\n", - " # NOTE! This might not give the most general path, as e.g. there are two\n", - " # options for cubic FCC (cF1 and cF2 in seekpath).\n", - " # But this should be general enough for this tool.\n", - "\n", - " structure = (real_lattice_bohr, [[0., 0., 0.]], [1])\n", - " # Use a H atom at the origin\n", - " seekpath_path = seekpath.get_explicit_k_path(structure, reference_distance=reference_distance)\n", - " b1, b2, b3 = np.array(seekpath_path['reciprocal_primitive_lattice'])\n", - "\n", - " all_kpoints_x = np.array(seekpath_path['explicit_kpoints_linearcoord'])\n", - " all_kpoints_list = np.array(seekpath_path['explicit_kpoints_abs'])\n", - "\n", - " segments_data = []\n", - " for segment_indices in seekpath_path['explicit_segments']:\n", - " start_label = seekpath_path['explicit_kpoints_labels'][segment_indices[0]]\n", - " end_label = seekpath_path['explicit_kpoints_labels'][segment_indices[1]-1]\n", - "\n", - " kpoints_x = all_kpoints_x[slice(*segment_indices)]\n", - " kpoints_list = all_kpoints_list[slice(*segment_indices)]\n", - "\n", - " energy_bands = _get_band_energies(kpoints_list, b1, b2, b3, g_vectors_range)\n", - "\n", - " segments_data.append({\n", - " 'start_label': start_label,\n", - " 'end_label': end_label,\n", - " 'kpoints_list': kpoints_list,\n", - " 'kpoints_x': kpoints_x,\n", - " 'energy_bands': energy_bands,\n", - " 'b1': b1,\n", - " 'b2': b2,\n", - " 'b3': b3,\n", - " })\n", - "\n", - " return segments_data\n", "\n", "\n", "def plot_bandstructure(c):\n", @@ -399,7 +296,7 @@ " line, = ax_bs.plot(segment_data['kpoints_x'], energy_band, 'k')\n", " lbands.append(line)\n", "\n", - " ax_bs.set_ylim([0, 0.5])\n", + " ax_bs.set_ylim([0, 1.0])\n", " ax_bs.yaxis.tick_right()\n", " ax_bs.yaxis.set_label_position(\"right\")\n", " ax_bs.set_ylabel('Free-electron energy (eV)')\n", @@ -430,17 +327,7 @@ " lbands[index].set_color('k')\n", " index+=1\n", "\n", - "grange.observe(update_bands_color, names=\"value\")\n", - "\n", - " \n", - "# with output_bs:\n", - "# global fig, ax\n", - "# fig, ax = plt.subplots()\n", - "# fig.set_size_inches(3.7, 5.0)\n", - "# fig.canvas.header_visible = False\n", - "# fig.canvas.layout.width = \"430px\"\n", - "# plot_bandstructure('bands')\n", - "# plt.show()" + "grange.observe(update_bands_color, names=\"value\")\n" ] }, { @@ -452,7 +339,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 58, "metadata": { "tags": [] }, @@ -460,7 +347,6 @@ "source": [ "style = {'description_width': 'initial'}\n", "\n", - "nkpt = IntSlider(value=4, min=4, max=15, description=\"\", style={'description_width': 'initial'}, continuous_update=False)\n", "line1 = Label(\n", " value=r'Number of kpoints per dimension, $N_k$'\n", ")\n", @@ -468,9 +354,8 @@ "line2 = Label(\n", " value=r'(total number $=N_k^3$)'\n", ")\n", - "nkpt = IntSlider(value=4, min=4, max=15, description=\"\", style={'description_width': 'initial'}, continuous_update=False)\n", "nkpt_box = HBox([VBox([line1, line2]), nkpt])\n", - "nbin = IntSlider(value=30, min=30, max=500, description=\"Number of bins:\", layout=Layout(width=\"400px\"), style={'description_width': 'initial'})\n", + "nbin = IntSlider(value=50, min=20, max=100, description=\"Number of bins:\", layout=Layout(width=\"400px\"), style={'description_width': 'initial'})\n", "gstd = FloatSlider(value=0.01, min=0.01, max=0.1, step=0.01, description=\"Gaussian $\\sigma$ (eV):\", layout=Layout(width=\"300px\"), style={'description_width': 'initial'})\n", "\n", "#All buttons\n", @@ -494,7 +379,6 @@ " btlti.style = {'button_color':'red'}\n", " btlti.description = \"Running\"\n", " \n", - " log_button('Tetrahedra')\n", " \n", " try:\n", " llti.remove()\n", @@ -507,8 +391,19 @@ "\n", " eigs = _compute_dos(kpts, G, grange.value)\n", "\n", - " dosx = np.linspace(0, 10, 500)\n", + " dosx = np.linspace(0, emax, 500)\n", " dosy = lti(real_lattice_bohr, eigs, dosx)\n", + "\n", + " # normalize lti dos for comparison with analytical result\n", + "\n", + " norm_lti=(dosx[1]-dosx[0])*np.sum(dosy)\n", + " \n", + " vol=(alat_bohr/2.)**3\n", + " norm_an=(2./3.)*(vol/np.pi**2)*2**(1./2)*emax**(3./2) # analytical value of integrated DOS\n", + "\n", + " dosy/=norm_lti\n", + " dosy*=norm_an\n", + " \n", " \n", " llti, = ax_dos.plot(dosy, dosx, 'r-', label='LTI')\n", " ax_dos.legend(loc=1, bbox_to_anchor=(1.3, 1.0))\n", @@ -532,9 +427,7 @@ " btgas.disabled = True\n", " btclear.disabled = True\n", " bthist.style = {'button_color':'green'}\n", - " \n", - " log_button('Histogram')\n", - " \n", + " \n", " try:\n", " lhist.remove()\n", " except:\n", @@ -546,19 +439,23 @@ " eigs = _compute_dos(kpts, G, grange.value)\n", " num_bins=nbin.value\n", "\n", - " # num_bins=int(nbin.value/(eigs.max()-eigs.min()))\n", - " # with output:\n", - " # print(\"num_bins={}\".format(num_bins))\n", + " vol=(alat_bohr/2.)**3\n", + "\n", + " analy_x = np.linspace(0, emax, 500);\n", + " analy_y = (1.0/(2.0*np.pi**2))*(2.0)**(3./2.)*analy_x**0.5*(alat_bohr / 2.0)**3.0;\n", "\n", - " hy, hx = np.histogram(eigs.ravel(),bins=num_bins )\n", + " norm=np.sum(analy_y*(analy_x[1]-analy_x[0]))\n", + " norm_an=(2./3.)*(vol/np.pi**2)*2**(1./2)*emax**(3./2) # analytical value of integrated DOS\n", + " \n", "\n", - " hy = hy/np.sum(hy*np.diff(hx))*np.shape(eigs)[-1]\n", - " # with output:\n", - " # print(\"hx={}\".format(hx))\n", - " # print(\"hy={}\".format(hy))\n", + " hy, hx = np.histogram(eigs.ravel(),range=[0,emax],bins=num_bins )\n", + " \n", + " hy = hy/np.sum(hy*np.diff(hx)) # normalize histogram to make total area 1\n", + " hy*=norm_an # renormalize histogram for comparison with analytical DOS (norm gives integrated DOS of analytical curve)\n", + " \n", "\n", " lhist = ax_dos.barh(hx[:-1]+np.diff(hx)[0], hy, color='yellow', edgecolor='black', \n", - " height=np.diff(hx), label=\"Add plot\")\n", + " height=np.diff(hx), label=\"Histogram\")\n", " ax_dos.legend(loc=1, bbox_to_anchor=(1.3, 1.0))\n", "\n", " btlti.disabled = False\n", @@ -580,9 +477,7 @@ " btclear.disabled = True\n", " btgas.style = {'button_color':'red'}\n", " btgas.description = \"Running\"\n", - " \n", - " log_button('Smearing')\n", - " \n", + " \n", " try:\n", " lgas.remove()\n", " except:\n", @@ -592,34 +487,39 @@ " G = Cell(real_lattice_bohr).reciprocal()*2*np.pi\n", " kpts = np.dot(monkhorst_pack(shape), G).reshape(shape + (3,))\n", " eigs = _compute_dos(kpts, G, grange.value)\n", - "\n", - " # gx = np.linspace(-0.03, 1.5, 70)\n", - " gx = np.linspace(-0.03, 0.5, 70)\n", - "\n", - " gy = 0.0*gx\n", + " num_bins=nbin.value\n", " \n", " knum=nkpt.value\n", " Gnum=grange.value\n", " \n", - " # start = time.time()\n", - "\n", - " # pdf_vals = norm(eigs.ravel().reshape(-1,1), scale=gstd).pdf(gx)\n", - " # gy = np.sum(pdf_vals, axis=0)\n", - " # pdf_vals = norm(eigs.ravel(), scale=gstd).pdf(gx)\n", - " # gy = np.einsum('ijkg,i->j', pdf_vals.reshape(nkpt.value, nkpt.value, nkpt.value, grange.value, -1), np.ones(len(gx)))\n", - "\n", - " for eig in eigs.ravel():\n", - " gy += norm(eig, gstd.value).pdf(gx)\n", - " # pdf_vals = np.array([norm(eigs.ravel(), scale=gstd).pdf(x) for x in gx])\n", - " # gy = np.sum(pdf_vals, axis=-1)\n", - " # end = time.time()\n", - "# with output:\n", - "# print(\"(eigs.shape)={}. gy.shape={}\".format(eigs.shape,gy.shape))\n", - "\n", - "# print(\"time taken =\")\n", - "# print(end - start)\n", - " \n", - " gy = gy/np.size(eigs)*np.shape(eigs)[-1]\n", + " # Accelerated approach to smearing: we smear out a histogram of evals instead of deltas centered on each eval\n", + " # instead of summing smeared gaussians centered on eigs, histogram and then smear\n", + "\n", + " vol=(alat_bohr/2.)**3\n", + " norm_an=(2./3.)*(vol/np.pi**2)*2**(1./2)*emax**(3./2) # analytical value of integrated DOS\n", + "\n", + " \n", + " hy, hx = np.histogram(eigs.ravel(),range=[0,emax],bins=num_bins ) # further right bin edge included in hx\n", + " hx=hx[:-1]\n", + " gx=hx\n", + " gy=0.0*hx\n", + "\n", + " for i,Ei in enumerate(hx):\n", + " gy += hy*norm(Ei, gstd.value).pdf(hx)\n", + "\n", + " gy = gy/np.sum(gy*(hx[1]-hx[0])) # normalize histogram to make total area 1\n", + " gy*=norm_an # renormalize histogram for comparison with analytical DOS (norm gives integrated DOS of analytical curve)\n", + " \n", + " \n", + " \n", + " # Standard approach to Gaussian smearing\n", + "# for eig in eigs.ravel():\n", + "# gy += norm(eig, gstd.value).pdf(gx)\n", + "\n", + "# norm_g=np.sum((gx[1]-gx[0])*gy)\n", + "# gy = norm_an*gy/norm_g\n", + "\n", + "\n", " lgas, = ax_dos.plot(gy, gx, 'k--', label=\"Gaussian smearing\")\n", " ax_dos.legend(loc=1, bbox_to_anchor=(1.3, 1.0))\n", " \n", @@ -641,59 +541,22 @@ " bthist.disabled = True\n", " btgas.disabled = True\n", " \n", - " analy_x = np.linspace(0, 1.5, 500);\n", - " analy_y = 1.0/(2.0*np.pi**2)*2.0**0.5*analy_x**0.5*(alat_bohr / 2.0)**3.0;\n", + " analy_x = np.linspace(0, emax, 500);\n", + " analy_y = (1.0/(2.0*np.pi**2))*(2.0)**(3./2.)*analy_x**0.5*(alat_bohr / 2.0)**3.0;\n", " lanaly, = ax_dos.plot(analy_y,analy_x, 'b', label='Analytical solution')\n", " \n", - " # ax_dos.set_ylim([-0.03, 1.5])\n", - " # ax_dos.set_xlim([0, analy_y.max() + 3.1])\n", " ax_dos.legend(loc=1, bbox_to_anchor=(1.3, 1.0))\n", " ax_dos.yaxis.tick_right()\n", " ax_dos.yaxis.set_label_position(\"right\")\n", " ax_dos.set_xlabel('Density of States')\n", "\n", " ax_dos.set_ylabel('Energy (eV)')\n", - " hline = ax_dos.axhline(0.3, color=\"red\")\n", - " ann = ax_dos.annotate(r\"$\\frac{\\hbar^2k^2}{2m}$ isosurf. (click to move)\", xy=(0.2, 0.31), fontsize=10)\n", " fig.tight_layout()\n", " \n", " btlti.disabled = False\n", " bthist.disabled = False\n", " btgas.disabled = False\n", - "\n", - "def onclick(event):\n", - " \"\"\"Click to move the isovalue line (red horizontal line) and update the kpoints plot.\n", - " \"\"\"\n", - " hline.set_ydata(event.ydata)\n", - " # figkpts.data[0].isomin = event.ydata\n", - " # figkpts.data[0].isomax = event.ydata\n", - " ann.set_position((0.5, event.ydata + 0.01))\n", - " \n", - " \n", - " \n", - "# with output_bs:\n", - "# global fig, ax\n", - "# fig, ax = plt.subplots()\n", - "# fig.set_size_inches(3.7, 5.0)\n", - "# fig.canvas.header_visible = False\n", - "# fig.canvas.layout.width = \"430px\"\n", - "# plot_bandstructure('bands')\n", - "# plt.show() \n", - " \n", - " \n", - "# with output:\n", - "# \"\"\"Set the figure for the DOS\n", - "# \"\"\"\n", - "# global fig, ax\n", - "# fig, ax = plt.subplots()\n", - "# fig.set_size_inches(3.2, 5.0)\n", - "# fig.canvas.header_visible = False\n", - "# fig.canvas.layout.width = \"380px\"\n", - "# fig.tight_layout()\n", - "# init_dos_plot()\n", - "# cid = fig.canvas.mpl_connect('button_press_event', onclick)\n", - "# plt.show()\n", - " \n", + " \n", " \n", "with output:\n", " \"\"\"Set the figure for the DOS\n", @@ -706,7 +569,6 @@ " fig.tight_layout()\n", " init_dos_plot()\n", " plot_bandstructure('bands')\n", - " cid = fig.canvas.mpl_connect('button_press_event', onclick)\n", " plt.show() \n", " \n", "def clear_plot(c):\n", @@ -720,7 +582,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 59, "metadata": {}, "outputs": [], "source": [ @@ -734,88 +596,15 @@ "G = Cell(real_lattice_bohr).reciprocal()*2*np.pi\n", "kpts = _compute_total_kpts(G)\n", "\n", - "#Init the kpoints plot with the plotly package\n", - "# figkpts = go.FigureWidget(data=[go.Isosurface(\n", - "# x=X.flatten(),\n", - "# y=Y.flatten(),\n", - "# z=Z.flatten(),\n", - "# value=values.flatten(),\n", - "# opacity=0.5,\n", - "# isomin=0.3,\n", - "# isomax=0.3,\n", - "# surface_count=1,\n", - "# caps=dict(x_show=False, y_show=False)),\n", - "# go.Scatter3d(x=kpts[:,0], y=kpts[:,1], z=kpts[:,2], mode='markers',\n", - "# marker=dict(size=1.5, color='red'))],\n", - "# layout=go.Layout(width=450, title='Kpoints (red dots) in reciprocal space and'\n", - "# +'
energy isosurface (isovalue can be set by
clicking on the left figure)',\n", - "# scene=dict(bgcolor = 'rgb(20, 24, 54)',\n", - "# xaxis = dict(title=r'kx', titlefont_color='white'),\n", - "# yaxis = dict(title=r'ky', titlefont_color='white'),\n", - "# zaxis = dict(title=r'kz', titlefont_color='white'))))\n", - "\n", - "\n", "def update_kpts_fig(c):\n", " \"\"\"Update the k-points plot when tuning the k-points slider.\n", " \"\"\"\n", " kpts = _compute_total_kpts(G)\n", " \n", - "# with figkpts.batch_update():\n", - "# figkpts.data[1].x = kpts[:, 0]\n", - "# figkpts.data[1].y = kpts[:, 1]\n", - "# figkpts.data[1].z = kpts[:, 2]\n", - " \n", - "# if nkpt.value >= 8:\n", - "# figkpts.data[1].marker['size'] = 1.0\n", - "# else:\n", - "# figkpts.data[1].marker['size'] = 1.5\n", - "\n", - "def half_sphere():\n", - " \"\"\"Only show half of the isosurface.\n", - " \"\"\"\n", - " X, Y, Z = np.mgrid[-6:6:40j, 0:6:40j, -6:6:40j]\n", - " values = 0.5*(X * X + Y * Y + Z * Z)\n", - " figkpts.data[0].x = X.flatten()\n", - " figkpts.data[0].y = Y.flatten()\n", - " figkpts.data[0].z = Z.flatten()\n", - " figkpts.data[0].value = values.flatten()\n", - " \n", "\n", "nkpt.observe(update_kpts_fig, names=\"value\")" ] }, - { - "cell_type": "code", - "execution_count": 27, - "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "8aff3533264641ada75d55a7b3735e85", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "VBox(children=(Output(), VBox(children=(HBox(children=(VBox(children=(Label(value='Number of kpoints per dimen…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#Group buttons with descriptions as labels\n", - "method1 = HBox([HBox([HTML(value=f\"Simple histogram of the eigenvalues\"), nbin]), bthist])\n", - "method2 = HBox([HBox([HTML(value=f\"Gaussian smearing method\"), gstd]),btgas ])\n", - "method3 = HBox([HTML(value=\"Linear tetrahedron interpolation method\"),btlti ])\n", - "method4 = HBox([btclear, Label(value=\"(Clear the calculated results)\")])\n", - "\n", - "label1 = HTML(value = f\"Choose a method to calculate the DOS:\")\n", - "display(VBox([output,VBox([ nkpt_box,VBox([grange,grange_hint]), label1, method1, method2, method3])]))\n", - "# display(HBox([VBox([output_bs, nkpt_box, label1, method1, method2, method3]), VBox([output, method4])]))" - ] - }, { "cell_type": "markdown", "metadata": {}, @@ -842,17 +631,35 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 60, "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "1aa24536267f4797a17fa74d49d024cb", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "VBox(children=(Output(), VBox(children=(HBox(children=(VBox(children=(Label(value='Number of kpoints per dimen…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#Group buttons with descriptions as labels\n", + "method1 = HBox([HBox([HTML(value=f\"Simple histogram of the eigenvalues\"), nbin]), bthist])\n", + "method2 = HBox([HBox([HTML(value=f\"Gaussian smearing method\"), gstd]),btgas ])\n", + "method3 = HBox([HTML(value=\"Linear tetrahedron interpolation method\"),btlti ])\n", + "method4 = HBox([btclear, Label(value=\"(Clear the calculated results)\")])\n", + "nkpt_box = HBox([VBox([line1, line2]), nkpt,method4])\n", + "\n", + "label1 = HTML(value = f\"Choose a method to calculate the DOS:\")\n", + "display(VBox([output,VBox([ nkpt_box,VBox([grange,grange_hint]), label1, method1, method2, method3])]))" + ] } ], "metadata": {