Ejemplo n.º 1
0
        pair['Guij_tmp'] += Gku[:, si, sj] * phase * wk
        pair['Gdji_tmp'] += Gkd[:, sj, si] / phase * wk

# summ reduce partial results of mpi nodes
for pair in pairs:
    comm.Reduce(pair['Guij_tmp'], pair['Guij'], root=root_node)
    comm.Reduce(pair['Gdji_tmp'], pair['Gdji'], root=root_node)

if rank == root_node:
    for pair in pairs:
        i, j = pair['aiij']
        # The Szunyogh-Lichtenstein formula
        pair['Jijz'] = np.trace(
            (Hs[i] @ pair['Guij']) @ (Hs[j] @ pair['Gdji']), axis1=1, axis2=2)
        # evaluation of the contour integral
        pair['Jij'] = np.trapz(np.imag(pair['Jijz'] * cont.we) / (2 * np.pi))
    end = timer()

    #----------------------------------------------------------------------
    # and saveing output of the calculation
    np.savetxt(
        args.outfile,
        np.array([[
            nl.norm(p['rij']), p['Jij'] * sisl.unit_convert('eV', 'Ry') * 1000
        ] + p['aiij'] + list(p['offset']) + list(p['rij']) for p in pairs],
                 dtype=object),
        header=str(args) + '\nnumber of cores = ' + str(size) +
        '\ntime of calculation = ' + str(end - start) +
        '\nnorm(rij),Jij[mRy],aiij,offset,rij',
        fmt="%s")
Ejemplo n.º 2
0
comm.Reduce(G00d_tmp  ,G00d ,root=root_node)
for q in qs:
    comm.Reduce(q['jqz_1_tmp']  ,q['jqz_1'] ,root=root_node)

#----------------------------------------------------------------------

# evaluation of the contour integral on the root node
# and saveing output of the calculation

if rank==root_node:
    J0_1 = np.trapz(np.imag(j0z_1*cont.we)/(2*np.pi))
    j0z_2 = -np.trace((G00u@Hs[0])@(G00d@Hs[0]),axis1=1,axis2=2)
    J0_2 = np.trapz(np.imag(j0z_2*cont.we)/(2*np.pi))
    
    J0=J0_1+J0_2
    T_C_MF=J0*sisl.unit_convert('eV','K')/3
    
    for q in qs:
        q['Jq_1'] = np.trapz(np.imag(q['jqz_1']*cont.we)/(2*np.pi))
        q['Jq'] = q['Jq_1'] + J0_2
    end = timer()

    np.savetxt(args.outfile,
               np.array([ [nl.norm(q['qvec']),
                           q['Jq']*sisl.unit_convert('eV','Ry')*1000]+
                          list(q['qvec'])
                        for q in qs],
                        dtype=object),
               header=str(args)+
                      '\nJ0 = '+str(J0*1000*sisl.unit_convert('eV','Ry'))+' mRy'+
                      '\nMean field Curie temperature ='+str(T_C_MF)+' K'+
Ejemplo n.º 3
0
uc_up = dh.tocsr(dh.UP)[:, orig_indx].toarray()
# spin down
uc_down = dh.tocsr(dh.DOWN)[:, orig_indx].toarray()
Hs = []
# get number of atoms in the unit cell
for i in range(len(dh.atoms)):
    at_indx = dh.a2o(i, all=True)
    Hs.append(uc_up[:, at_indx][at_indx, :] - uc_down[:, at_indx][at_indx, :])
# generate k space sampling
kset = make_kset(NUMK=args.kset)
wk = 1 / len(kset)  # weight of a kpoint in BZ integral
kpcs = np.array_split(kset, size)
j0z = []
for ze in tqdm.tqdm(eran):
    j0z_tmp = np.zeros((1, 1), dtype='complex128')
    j0zk_tmp = np.zeros((1, 1), dtype='complex128')
    for k in kpcs[rank]:
        HKU, HKD, SK = hsk(dh, k=np.array(k))
        Gku = nl.inv(ze * SK - HKU)
        Gkd = nl.inv(ze * SK - HKD)
        j0zk_tmp += np.trace(Hs[0] @ Gku @ Hs[0] @ Gkd) * wk
    comm.Reduce(j0zk_tmp, j0z_tmp, root=root_node)
    j0z.append(j0z_tmp[0, 0])

if rank == root_node:
    j0z = np.array(j0z)
    J0 = np.trapz(np.imag(j0z * cont.we) /
                  (2 * np.pi)) * 1000 * sisl.unit_convert('eV', 'Ry')

    print(args.kset, J0)
Ejemplo n.º 4
0
    for q in qs:

        comm.Reduce(q['Jqz_tmp_kloop'],q['Jqz_tmp_qloop'],root=root_node)

        # append contributions to contour dependent list
        if rank==root_node:
            q['Jqz'].append(q['Jqz_tmp_qloop'][0,0])


#----------------------------------------------------------------------

# evaluation of the contour integral on the root node
# and saveing output of the calculation
if rank==root_node:
    for q in qs:
        q['Jqz'] = np.array(q['Jqz'])
        q['Jq']  = np.trapz(np.imag(q['Jqz']*cont.we)/(2*np.pi))
    end = timer()

    np.savetxt(args.outfile,
               np.array([ [nl.norm(q['qvec']),
                           q['Jq']*sisl.unit_convert('eV','Ry')*1000]+
                          list(q['qvec'])
                        for q in qs],
                        dtype=object),
               header=str(args)+
                      '\nnumber of cores = '+str(size)+
                      '\ntime of calculation = '+str(end-start)+
                      '\nnorm(q),Jq[mRy],qvec',
               fmt="%s")