msg-byu/autoGR

Bug in lat_type.py

wsmorgan opened this issue · 1 comments

The following are both body centered orthorhombic cells but one has been scaled by a numerical factor:

A_s = np.array([[ 0.5,  1. ,  0. ],
       [-1. ,  0. ,  2. ],
       [ 4.5,  0. ,  0. ]])
lat_type(np.transpose(A_s))
print("Div")
A_t = np.array([[ 0.28642524,  0.57285048,  0.        ],
       [-0.57285048,  0.        ,  1.14570096],
       [ 2.57782715,  0.        ,  0.        ]])
lat_type(np.transpose(A_t))

They should give the same answer but A_t gives face centered orthorhombic instead.

Fixed in revision 0.1.6. The error was in the logic of:

(pa3ta1n-a1n/2.)<tiny and (pa3ta2n -a2n/2.)<tiny

Since the projection of a3 onto a1 and a2 was normalized it doesn't make sense to subtract off half of the norm of a1 and a2. Instead we just need to see if the projection is greater than or less than 0.5, so the above inequalities have all been replaced with:

abs(pa3ta1n-0.5)<tiny and abs(pa3ta2n -0.5)<tiny