geometric/internal.py
def torsionConstraintLinearAngles(self, coords, thre=175):
        """
        Check if a torsion constrained optimization is about to fail
        because three consecutive atoms are nearly linear.
        """
        
        coords = coords.copy().reshape(-1, 3)
        
        def measure_angle_degrees(i, j, k):
            x1 = coords[i]
            x2 = coords[j]
            x3 = coords[k]
            v1 = x1-x2
            v2 = x3-x2
            n = np.dot(v1,v2)/(np.linalg.norm(v1)*np.linalg.norm(v2))
            angle = np.arccos(n)
            return angle * 180/ np.pi

        linear_torsion_angles = {}
        for Internal in self.cPrims:
            if type(Internal) is Dihedral:
                a, b, c, d = Internal.a, Internal.b, Internal.c, Internal.d
                abc = measure_angle_degrees(a, b, c)
                bcd = measure_angle_degrees(b, c, d)
                if abc > thre:
                    linear_torsion_angles[(a, b, c)] = abc
                elif bcd > thre:
                    linear_torsion_angles[(b, c, d)] = bcd
        return linear_torsion_angles

        Check if a torsion constrained optimization is about to fail
        because three consecutive atoms are nearly linear.
        
Check if a torsion constrained optimization is about to fail
because three consecutive atoms are nearly linear.
Check if a torsion constrained optimization is about to fail because three consecutive atoms are nearly linear .
def torsionConstraintLinearAngles(self, coords, thre=175):
        coords = coords.copy().reshape(-1, 3)
        def measure_angle_degrees(i, j, k):
            x1 = coords[i]
            x2 = coords[j]
            x3 = coords[k]
            v1 = x1-x2
            v2 = x3-x2
            n = np.dot(v1,v2)/(np.linalg.norm(v1)*np.linalg.norm(v2))
            angle = np.arccos(n)
            return angle * 180/ np.pi
        linear_torsion_angles = {}
        for Internal in self.cPrims:
            if type(Internal) is Dihedral:
                a, b, c, d = Internal.a, Internal.b, Internal.c, Internal.d
                abc = measure_angle_degrees(a, b, c)
                bcd = measure_angle_degrees(b, c, d)
                if abc > thre:
                    linear_torsion_angles[(a, b, c)] = abc
                elif bcd > thre:
                    linear_torsion_angles[(b, c, d)] = bcd
        return linear_torsion_angles
def torsionConstraintLinearAngles ( self , coords , thre = 175 ) : coords = coords . copy ( ) . reshape ( - 1 , 3 ) def measure_angle_degrees ( i , j , k ) : x1 = coords [ i ] x2 = coords [ j ] x3 = coords [ k ] v1 = x1 - x2 v2 = x3 - x2 n = np . dot ( v1 , v2 ) / ( np . linalg . norm ( v1 ) * np . linalg . norm ( v2 ) ) angle = np . arccos ( n ) return angle * 180 / np . pi linear_torsion_angles = { } for Internal in self . cPrims : if type ( Internal ) is Dihedral : a , b , c , d = Internal . a , Internal . b , Internal . c , Internal . d abc = measure_angle_degrees ( a , b , c ) bcd = measure_angle_degrees ( b , c , d ) if abc > thre : linear_torsion_angles [ ( a , b , c ) ] = abc elif bcd > thre : linear_torsion_angles [ ( b , c , d ) ] = bcd return linear_torsion_angles
Check if a torsion constrained optimization is about to fail
because three consecutive atoms are nearly linear.
Check if a torsion constrained optimization is about to fail because three consecutive atoms are nearly linear .
"""
        Check if a torsion constrained optimization is about to fail
        because three consecutive atoms are nearly linear.
        """
self
coords
thre