From 8559a997198db028aa2456a7e950cc079dceb3ca Mon Sep 17 00:00:00 2001
From: Anton Akhmerov <anton.akhmerov@gmail.com>
Date: Tue, 24 Apr 2018 11:45:53 +0200
Subject: [PATCH] migrate one more figure to code

---
 code/band_structures.py   |  21 ++++++
 docs/figures/phonons7.svg | 131 --------------------------------------
 2 files changed, 21 insertions(+), 131 deletions(-)
 delete mode 100644 docs/figures/phonons7.svg

diff --git a/code/band_structures.py b/code/band_structures.py
index 47e0c489..3ca35f93 100644
--- a/code/band_structures.py
+++ b/code/band_structures.py
@@ -147,6 +147,26 @@ def DOS_2masses():
     pyplot.savefig('phonons8.svg')
 
 
+def consistency_1_2_masses():
+    k = np.linspace(0, 2*pi, 300)
+    k_dos = np.linspace(0, pi, 20)
+    fig, ax = pyplot.subplots()
+    ax.plot(k, dispersion_2m(k, acoustic=False), label='optical')
+    ax.plot(k, dispersion_2m(k), label='acoustic')
+    omega_max = dispersion_2m(0, acoustic=False)
+    ax.plot(k, omega_max * np.sin(k/4), label='equal masses')
+    ax.set_xlabel('$ka$')
+    ax.set_ylabel(r'$\omega$')
+    ax.set_xticks([0, pi, 2*pi])
+    ax.set_xticklabels(['$0$', r'$\pi/2a$', r'$\pi/a$'])
+    ax.set_yticks([], [])
+    ax.set_xlim(-pi/8, 2*pi+.4)
+    ax.set_ylim((0, dispersion_2m(0, acoustic=False) + .2))
+    ax.legend(loc='lower right')
+    pyplot.vlines([pi, 2*pi], 0, 2.2, linestyles='dashed')
+    draw_classic_axes(ax, xlabeloffset=.2)
+    pyplot.savefig('phonons7.svg')
+
 
 def DOS_finite_phonon_chain(n, output_name):
     rhs = 2 * np.eye(n) - np.eye(n, k=1) - np.eye(n, k=-1)
@@ -173,6 +193,7 @@ def main():
     fermi_dirac()
     phonons_1d()
     phonons_1d_2masses()
+    consistency_1_2_masses()
     DOS_2masses()   
     meff_1d_tb()
     tight_binding_1d()
diff --git a/docs/figures/phonons7.svg b/docs/figures/phonons7.svg
deleted file mode 100644
index 61dc5b32..00000000
--- a/docs/figures/phonons7.svg
+++ /dev/null
@@ -1,131 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
-<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
-	 viewBox="0 0 425.2 105.3" style="enable-background:new 0 0 425.2 105.3;" xml:space="preserve">
-<style type="text/css">
-	.st0{fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:10;}
-	.st1{fill:none;stroke:#F7941D;stroke-width:0.5;stroke-miterlimit:10;}
-	.st2{fill:#FFFFFF;}
-	.st3{fill:none;stroke:#000000;stroke-width:0.5;stroke-miterlimit:10;stroke-dasharray:2;}
-	.st4{clip-path:url(#SVGID_2_);}
-	.st5{clip-path:url(#SVGID_4_);}
-	.st6{clip-path:url(#SVGID_6_);}
-	.st7{clip-path:url(#SVGID_8_);fill:#F7941D;}
-</style>
-<g>
-	<path class="st0" d="M212.3,27.1c6.4-13,16.8-13,23.2,0"/>
-	<path class="st0" d="M258.7,27.1c-6.4,13-16.8,13-23.2,0"/>
-	<path class="st0" d="M258.7,27.1c6.4-13,16.8-13,23.2,0"/>
-	<path class="st0" d="M305.2,27.1c-6.4,13-16.8,13-23.2,0"/>
-	<path class="st0" d="M165.8,27.1c6.4-13,16.8-13,23.2,0"/>
-	<path class="st0" d="M212.3,27.1c-6.4,13-16.8,13-23.2,0"/>
-	<path class="st0" d="M119.3,27.1c6.4-13,16.8-13,23.2,0"/>
-	<path class="st0" d="M165.8,27.1c-6.4,13-16.8,13-23.2,0"/>
-	<path class="st0" d="M305.2,27.1c6.4-13,16.8-13,23.2,0"/>
-</g>
-<path class="st0" d="M176.8,84c0,0,14.8-34,23.2-34c8.4,0,23.2,34,23.2,34"/>
-<path class="st1" d="M176.8,84c0,0,29.4-66.4,45.7-66.5c16.3-0.1,44.6,65.7,44.6,65.7"/>
-<path class="st0" d="M223.3,84c0,0,14.8-34,23.2-34c8.4,0,23.2,34,23.2,34"/>
-<path class="st0" d="M130.3,84c0,0,14.8-34,23.2-34c8.4,0,23.2,34,23.2,34"/>
-<rect x="223.3" y="3.3" class="st2" width="114.7" height="86.2"/>
-<rect x="61.7" y="3.3" class="st2" width="115.1" height="86.2"/>
-<g>
-	<g>
-		<line class="st0" x1="176.8" y1="84" x2="176.8" y2="9.7"/>
-		<g>
-			<polygon points="178.3,10.7 176.8,5.3 175.4,10.7 			"/>
-		</g>
-	</g>
-</g>
-<line class="st3" x1="223.3" y1="84" x2="223.3" y2="5.3"/>
-<line class="st3" x1="200" y1="84" x2="200" y2="5.3"/>
-<g>
-	<defs>
-		<rect id="SVGID_1_" x="168" y="5.7" width="4.8" height="3.7"/>
-	</defs>
-	<clipPath id="SVGID_2_">
-		<use xlink:href="#SVGID_1_"  style="overflow:visible;"/>
-	</clipPath>
-	<path class="st4" d="M172.9,6.4c0-0.4-0.1-0.6-0.3-0.6c-0.2,0-0.4,0.2-0.4,0.4c0,0.1,0,0.2,0.1,0.2c0.1,0.1,0.3,0.3,0.3,0.7
-		c0,0.3-0.2,0.8-0.4,1.1c-0.2,0.3-0.5,0.6-0.9,0.6c-0.5,0-0.7-0.3-0.8-0.7c0.1-0.2,0.3-0.7,0.3-0.9c0-0.1,0-0.2-0.1-0.2
-		c-0.1,0-0.2,0-0.2,0.1c-0.1,0.2-0.2,0.7-0.2,1c-0.3,0.4-0.6,0.7-1.1,0.7c-0.5,0-0.7-0.5-0.7-0.9c0-1,0.8-1.8,0.8-1.9
-		c0-0.1-0.1-0.1-0.1-0.1c-0.1,0-0.2,0.1-0.2,0.2c-0.4,0.6-0.7,1.5-0.7,2.2c0,0.5,0.2,1.1,0.8,1.1c0.6,0,0.9-0.4,1.2-0.8
-		c0.1,0.5,0.4,0.8,0.9,0.8c0.6,0,1-0.5,1.3-1.1C172.6,7.9,172.9,6.9,172.9,6.4"/>
-</g>
-<g>
-	<defs>
-		<rect id="SVGID_3_" x="245.2" y="89.5" width="3.7" height="5.7"/>
-	</defs>
-	<clipPath id="SVGID_4_">
-		<use xlink:href="#SVGID_3_"  style="overflow:visible;"/>
-	</clipPath>
-	<path class="st5" d="M247.2,89.7c0,0,0-0.1-0.1-0.1c-0.2,0-0.8,0.1-1,0.1c-0.1,0-0.2,0-0.2,0.2c0,0.1,0.1,0.1,0.2,0.1
-		c0.4,0,0.4,0.1,0.4,0.1l0,0.2l-1.1,4.6c0,0.1,0,0.1,0,0.2c0,0.2,0.2,0.2,0.2,0.2c0.1,0,0.2-0.1,0.3-0.2c0-0.1,0.4-1.5,0.4-1.7
-		c0.3,0,0.9,0.2,0.9,0.7c0,0.1,0,0.1,0,0.2c0,0.1,0,0.2,0,0.3c0,0.5,0.3,0.8,0.7,0.8c0.2,0,0.5-0.1,0.6-0.4c0.2-0.3,0.3-0.8,0.3-0.8
-		c0-0.1-0.1-0.1-0.1-0.1c-0.1,0-0.1,0-0.1,0.1c-0.2,0.6-0.3,1-0.7,1c-0.1,0-0.3-0.1-0.3-0.4c0-0.1,0-0.3,0.1-0.4c0-0.1,0-0.2,0-0.2
-		c0-0.5-0.5-0.7-1.2-0.8c0.2-0.1,0.5-0.4,0.7-0.6c0.4-0.4,0.7-0.8,1.1-0.8c0.1,0,0.1,0,0.1,0c0.1,0,0.1,0,0.2,0.1c0,0,0,0,0,0
-		c-0.4,0-0.5,0.3-0.5,0.4c0,0.1,0.1,0.3,0.3,0.3c0.2,0,0.4-0.2,0.4-0.5c0-0.2-0.2-0.5-0.5-0.5c-0.2,0-0.6,0.1-1.2,0.7
-		c-0.3,0.3-0.6,0.6-0.9,0.7L247.2,89.7"/>
-</g>
-<g>
-	<defs>
-		<rect id="SVGID_5_" x="197.6" y="87.5" width="4.8" height="14.5"/>
-	</defs>
-	<clipPath id="SVGID_6_">
-		<use xlink:href="#SVGID_5_"  style="overflow:visible;"/>
-	</clipPath>
-	<path class="st6" d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.3c0-0.1-0.1-0.2-0.2-0.2
-		C201,98.4,200.9,98.6,200.9,98.8z"/>
-</g>
-<g>
-	<g>
-		<line class="st0" x1="176.8" y1="84" x2="244.8" y2="84"/>
-		<g>
-			<polygon points="243.8,85.4 249.2,84 243.8,82.5 			"/>
-		</g>
-	</g>
-</g>
-<g>
-	<defs>
-		<rect id="SVGID_7_" x="220.8" y="87.5" width="4.8" height="14.5"/>
-	</defs>
-	<clipPath id="SVGID_8_">
-		<use xlink:href="#SVGID_7_"  style="overflow:visible;"/>
-	</clipPath>
-	<path class="st7" d="M223,88.1h0.9c-0.3,1.2-0.3,1.5-0.3,2c0,0.1,0,0.3,0.1,0.6c0.1,0.4,0.2,0.4,0.3,0.4c0.2,0,0.3-0.1,0.3-0.3
-		c0,0,0-0.1-0.1-0.2c-0.2-0.6-0.2-1.1-0.2-1.3c0-0.4,0.1-0.8,0.1-1.3h0.9c0.1,0,0.4,0,0.4-0.3c0-0.2-0.2-0.2-0.3-0.2h-2.7
-		c-0.2,0-0.5,0-0.8,0.4c-0.3,0.3-0.5,0.7-0.5,0.7c0,0,0,0.1,0.1,0.1c0.1,0,0.1,0,0.1-0.1c0.4-0.6,0.8-0.6,1-0.6h0.5
-		c-0.3,1-0.7,1.9-1,2.6c-0.1,0.1-0.1,0.1-0.1,0.2c0,0.2,0.1,0.2,0.2,0.2c0.2,0,0.3-0.2,0.4-0.5c0.1-0.4,0.1-0.4,0.2-0.8L223,88.1"/>
-	<rect x="220.9" y="94.2" class="st7" width="4.8" height="0.3"/>
-	<path class="st7" d="M223.6,100.8c0,0.1,0,0.2-0.2,0.3c-0.4,0.4-0.7,0.6-0.9,0.6c-0.4,0-0.5-0.4-0.5-0.7c0-0.4,0.3-1.4,0.4-1.7
-		c0.2-0.5,0.6-0.8,0.9-0.8c0.5,0,0.6,0.6,0.6,0.7c0,0.1,0,0.1,0,0.1L223.6,100.8 M224.1,98.8c-0.1-0.3-0.4-0.5-0.7-0.5
-		c-0.9,0-1.9,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