Dear Sayan Mondal,


I would suspect that the values for which you are seeing these errors are those that are close to a topological phase transition. In these cases, the hybrid Wannier charge center evolution changes more abruptly, and the calculation would take longer to converge.


To increase the number of steps the calculation will perform before aborting, you can decrease the 'min_neighour_dist' value, and increase the upper limit of the 'iterator' (these keywords are described in the surface.run reference).


For values of lambda_R and lambda_v which are exactly at a phase transition, the calculation will not converge, because the topological indices are not well-defined.


Best regards,

Dominik Gresch


On 17.09.21 08:28, SAYAN MONDAL wrote:
Dear Developer,
                             I am trying to get the phase diagram of the Kane-Mele model as described in Fig. 1 of  (https://doi.org/10.1103/PhysRevLett.95.146802). 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  lambda_R and lambda_v, but for some other values it is showing some errors as follows:

WARNING: Iterator stopped before the calculation could converge.
WARNING: Iterator stopped before the calculation could converge.
WARNING: 'min_neighbour_dist' reached: cannot add line at t = 0.6562500000000001
WARNING: Iterator stopped before the calculation could converge.
WARNING: Iterator stopped before the calculation could converge.
WARNING: 'min_neighbour_dist' reached: cannot add line at t = 0.6562500000000001
WARNING: Iterator stopped before the calculation could converge.
WARNING: Iterator stopped before the calculation could converge.
WARNING: 'min_neighbour_dist' reached: cannot add line at t = 0.6562500000000001

My code is attached below:
*************************************
import logging

import z2pack
import numpy as np
from numpy import cos, sin, kron, sqrt
import matplotlib.pyplot as plt


logging.getLogger('z2pack').setLevel(logging.WARNING)

# defining pauli matrices
identity = np.identity(2, dtype=complex)
pauli_x = np.array([[0, 1], [1, 0]], dtype=complex)
pauli_y = np.array([[0, -1j], [1j, 0]], dtype=complex)
pauli_z = np.array([[1, 0], [0, -1]], dtype=complex)


def get_kane_mele_hamiltonian(t, lambda_v, lambda_R, lambda_SO):
    def inner(k):
        k = np.array(k) * 2 * np.pi
        kx, ky = k
        # change to reduced coordinates
        x = (kx - ky) / 2
        y = (kx + ky) / 2
        return (
            t * (1 + 2 * cos(x) * cos(y)) * kron(pauli_x, identity) +
            lambda_v * kron(pauli_z, identity) + lambda_R *
            (1 - cos(x) * cos(y)) * kron(pauli_y, pauli_x) +
            -sqrt(3) * lambda_R * sin(x) * sin(y) * kron(pauli_y, pauli_y) +
            2 * t * cos(x) * sin(y) * kron(pauli_y, identity) + lambda_SO *
            (2 * sin(2 * x) - 4 * sin(x) * cos(y)) * kron(pauli_z, pauli_z) +
            lambda_R * cos(x) * sin(y) * kron(pauli_x, pauli_x) +
            -sqrt(3) * lambda_R * sin(x) * cos(y) * kron(pauli_x, pauli_y)
        )

    return inner


if __name__ == '__main__':
    arr = []
    lambda_R_list = np.linspace(0, 0.31, 20)
    lambda_v_list = np.linspace(0, 0.24, 20)
    for lR in lambda_R_list:
        for lv in lambda_v_list:
            system = z2pack.hm.System(
                get_kane_mele_hamiltonian(
                    t=1, lambda_v = lv, lambda_R=lR, lambda_SO=0.06
                ),
                dim=2,
                check_periodic=True
            )
            res = z2pack.surface.run(system=system, surface=lambda s, t: [s / 2, t])
        #    print('Z2 invariant: {}'.format(z2pack.invariant.z2(res)))
            val = z2pack.invariant.z2(res)
            arr.append([lR, lv, val])
   
    arr = np.asarray(arr)
    np.savetxt('pd.txt', arr)
    print(arr)
   
#    z2pack.plot.wcc(res, axis=ax)
#    ax.set_xticks([0, 1])
#    ax.set_xticklabels(['0', '0.5'])
#    ax.set_xlabel(r'$k_y$')
#    ax.set_yticks([0, 1])
#    ax.set_ylabel(r'$\bar{y}$', rotation='horizontal')
#    plt.savefig('plot.pdf', bbox_inches='tight')

**************************************************


Is there any way to correct those errors? I shall look forward to your kind cooperation.

Thank you

Best Regards,
Sayan Mondal,
Research Scholar,
Dept. of Physics,
Roll No. -   186121022,
E-mail:       mondal18@iitg.ac.in
Indian Institute of Technology Guwahati
Guwahati - 781039