<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Dear Developer,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
                             I am trying to get the phase diagram of the Kane-Mele model as described in Fig. 1 of  (<span style="color: rgb(34, 34, 34); font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif; font-size: 14px; background-color: rgb(255, 255, 255); display: inline !important;"><a href="https://doi.org/10.1103/PhysRevLett.95.146802" id="LPlnk">https://doi.org/10.1103/PhysRevLett.95.146802</a></span>).
 The Z2 invariant is 1 inside the curve while it vanishes outside. So I tried to get the Z2 invariant for several values of lambda_R and lambda_v. The code is giving correct results for some values of <span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); display: inline !important;"><span> </span>lambda_R
 and lambda_v, but for some other values it is showing some errors as follows:</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); display: inline !important;"><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); display: inline !important;">WARNING: Iterator stopped before the calculation could converge.
<div>WARNING: Iterator stopped before the calculation could converge.</div>
<div>WARNING: 'min_neighbour_dist' reached: cannot add line at t = 0.6562500000000001</div>
<div>WARNING: Iterator stopped before the calculation could converge.</div>
<div>WARNING: Iterator stopped before the calculation could converge.</div>
<div>WARNING: 'min_neighbour_dist' reached: cannot add line at t = 0.6562500000000001</div>
<div>WARNING: Iterator stopped before the calculation could converge.</div>
<div>WARNING: Iterator stopped before the calculation could converge.</div>
WARNING: 'min_neighbour_dist' reached: cannot add line at t = 0.6562500000000001<br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); display: inline !important;"><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
My code is attached below:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
*************************************</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
import logging
<div><br>
</div>
<div>import z2pack</div>
<div>import numpy as np</div>
<div>from numpy import cos, sin, kron, sqrt</div>
<div>import matplotlib.pyplot as plt</div>
<div><br>
</div>
<div><br>
</div>
<div>logging.getLogger('z2pack').setLevel(logging.WARNING)</div>
<div><br>
</div>
<div># defining pauli matrices</div>
<div>identity = np.identity(2, dtype=complex)</div>
<div>pauli_x = np.array([[0, 1], [1, 0]], dtype=complex)</div>
<div>pauli_y = np.array([[0, -1j], [1j, 0]], dtype=complex)</div>
<div>pauli_z = np.array([[1, 0], [0, -1]], dtype=complex)</div>
<div><br>
</div>
<div><br>
</div>
<div>def get_kane_mele_hamiltonian(t, lambda_v, lambda_R, lambda_SO):</div>
<div>    def inner(k):</div>
<div>        k = np.array(k) * 2 * np.pi</div>
<div>        kx, ky = k</div>
<div>        # change to reduced coordinates</div>
<div>        x = (kx - ky) / 2</div>
<div>        y = (kx + ky) / 2</div>
<div>        return (</div>
<div>            t * (1 + 2 * cos(x) * cos(y)) * kron(pauli_x, identity) +</div>
<div>            lambda_v * kron(pauli_z, identity) + lambda_R *</div>
<div>            (1 - cos(x) * cos(y)) * kron(pauli_y, pauli_x) +</div>
<div>            -sqrt(3) * lambda_R * sin(x) * sin(y) * kron(pauli_y, pauli_y) +</div>
<div>            2 * t * cos(x) * sin(y) * kron(pauli_y, identity) + lambda_SO *</div>
<div>            (2 * sin(2 * x) - 4 * sin(x) * cos(y)) * kron(pauli_z, pauli_z) +</div>
<div>            lambda_R * cos(x) * sin(y) * kron(pauli_x, pauli_x) +</div>
<div>            -sqrt(3) * lambda_R * sin(x) * cos(y) * kron(pauli_x, pauli_y)</div>
<div>        )</div>
<div><br>
</div>
<div>    return inner</div>
<div><br>
</div>
<div><br>
</div>
<div>if __name__ == '__main__':</div>
<div>    arr = []</div>
<div>    lambda_R_list = np.linspace(0, 0.31, 20)</div>
<div>    lambda_v_list = np.linspace(0, 0.24, 20)</div>
<div>    for lR in lambda_R_list:</div>
<div>        for lv in lambda_v_list:</div>
<div>            system = z2pack.hm.System(</div>
<div>                get_kane_mele_hamiltonian(</div>
<div>                    t=1, lambda_v = lv, lambda_R=lR, lambda_SO=0.06</div>
<div>                ),</div>
<div>                dim=2,</div>
<div>                check_periodic=True</div>
<div>            )</div>
<div>            res = z2pack.surface.run(system=system, surface=lambda s, t: [s / 2, t])</div>
<div>        #    print('Z2 invariant: {}'.format(z2pack.invariant.z2(res)))</div>
<div>            val = z2pack.invariant.z2(res)</div>
<div>            arr.append([lR, lv, val])</div>
<div>    </div>
<div>    arr = np.asarray(arr)</div>
<div>    np.savetxt('pd.txt', arr)</div>
<div>    print(arr)</div>
<div>    </div>
<div>#    z2pack.plot.wcc(res, axis=ax)</div>
<div>#    ax.set_xticks([0, 1])</div>
<div>#    ax.set_xticklabels(['0', '0.5'])</div>
<div>#    ax.set_xlabel(r'$k_y$')</div>
<div>#    ax.set_yticks([0, 1])</div>
<div>#    ax.set_ylabel(r'$\bar{y}$', rotation='horizontal')</div>
#    plt.savefig('plot.pdf', bbox_inches='tight')<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div class="_Entity _EType_OWALinkPreview _EId_OWALinkPreview _EReadonly_1"></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
**************************************************</div>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Is there any way to correct those errors? I shall look forward to your kind cooperation.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thank you</div>
<div id="Signature">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: "Times New Roman", Times, serif; color: rgb(0, 0, 0); font-size: 12pt;"><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Best Regards,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: "Times New Roman", Times, serif; color: rgb(0, 0, 0); font-size: 12pt;">Sayan Mondal,</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: "Times New Roman", Times, serif; color: rgb(0, 0, 0); font-size: 12pt;">Research Scholar,</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: "Times New Roman", Times, serif; color: rgb(0, 0, 0); font-size: 12pt;">Dept. of Physics,</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: "Times New Roman", Times, serif; color: rgb(0, 0, 0); font-size: 12pt;">Roll No. -   186121022,</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: Cambria, Georgia, serif; color: rgb(12, 100, 192); font-size: 10pt;"><span style="text-align: start; background-color: rgb(255, 255, 255); font-family: "Times New Roman", Times, serif; color: rgb(0, 0, 0); font-size: 12pt;">E-mail: 
      mondal18@iitg.ac.in</span></span><span style="font-family: "Century Gothic", sans-serif; color: rgb(12, 100, 192); font-size: 10pt;"><br>
</span></div>
<span style="font-family: "Times New Roman", Times, serif; color: rgb(0, 0, 0); font-size: 12pt;"></span>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: "Times New Roman", Times, serif; color: rgb(0, 0, 0); font-size: 12pt;">Indian Institute of Technology Guwahati</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: "Times New Roman", Times, serif; color: rgb(0, 0, 0); font-size: 12pt;">Guwahati - 781039</span></div>
</div>
</div>
</body>
</html>