예제 #1
0
파일: phonon.py 프로젝트: goirijo/statm2d
def is_equivalent_cluster(site0,site1,comp0,comp1,lattice):
    """Check if two pairs of sites are equivalent
    and if the sites are swapped.

    :site0: Site
    :site1: Site
    :comp0: Site
    :comp1: Site
    :returns: bool,bool

    """
    swithin0,swithin1=structure.bring_cluster_within(site0,site1,lattice)
    cwithin0,cwithin1=structure.bring_cluster_within(comp0,comp1,lattice)

    sitedelta,sitemap=structure.site_delta(swithin0,swithin1)
    compdelta,compmap=structure.site_delta(cwithin0,cwithin1)

    goodmap=False
    mapswitch=False
    
    if np.allclose(sitedelta,compdelta):
        goodmap=True

    #if the deltas have opposite signs, the sites map by translation, but they switched places
    elif np.allclose(-sitedelta,compdelta) and sitemap and compmap:
        goodmap=True
        mapswitch=True

    return goodmap,mapswitch 
예제 #2
0
파일: phonon.py 프로젝트: goirijo/statm2d
def dynamical_exp_inputs(site0,site1,lattice):
    """Determine rn, tb0 and tb1 needed
    for the exponential term of the dynamical
    matrix calculations for the given cluster.
    Pivot always goes as first site.

    :site0: Site
    :site1: Site
    :lattice: 2x2 matrix with a and b vectors as columns
    :returns: (2x1 vector,2x1 vector, 2x1 vector)

    """
    sw0=site0.bring_within(lattice)
    sw1=site1.bring_within(lattice)
    rn,_=structure.site_delta(site0,site1)
    ##Erm... not sure which one the real rn is...
    #l0,_=structure.site_delta(sw0,site0)
    #l1,_=structure.site_delta(sw1,site1)
    #rn=l1-l0

    tb0=structure.bring_within(site0._coord,lattice)
    tb1=structure.bring_within(site1._coord,lattice)

    return rn,tb0,tb1