def is_same_axis(cls, a1, a2, parallel_only=False): """ True if the axes `a1` and `a2` are parallel or antiparallel. Note that normalized versions of `a1` and `a2` are used, so normalizing before passing in will just slow things down. If `parallel_only` is `True` (it is `False` by default), this method only returns `True` if the two axes are parallel, not anti_parallel. """ n1 = a1.normalized() n2 = a2.normalized() if parallel_only: return magnitude(n1-n2) < cls.same_axis_tolerance else: return magnitude(n1-n2) < cls.same_axis_tolerance or magnitude(n1+n2) < cls.same_axis_tolerance
def is_same_axis(cls, a1, a2, parallel_only=False): """ True if the axes `a1` and `a2` are parallel or antiparallel. Note that normalized versions of `a1` and `a2` are used, so normalizing before passing in will just slow things down. If `parallel_only` is `True` (it is `False` by default), this method only returns `True` if the two axes are parallel, not anti_parallel. """ n1 = a1.normalized() n2 = a2.normalized() if parallel_only: return magnitude(n1 - n2) < cls.same_axis_tolerance else: return magnitude(n1 - n2) < cls.same_axis_tolerance or magnitude( n1 + n2) < cls.same_axis_tolerance
def is_bonded_to(self, other_atom, n_vdw_radii=1.2, default_vdw_radius=2.0*Angstroms): #TODO deal with units dist = magnitude(self.xyz - other_atom.xyz) vdw_me = self.element.vdw_radius if vdw_me is None: vdw_me = default_vdw_radius vdw_me = strip_units(vdw_me, convert_to=self.cartesian_units, assume_units=DistanceUnit.default) vdw_other = self.element.vdw_radius if vdw_other is None: vdw_other = default_vdw_radius vdw_other = strip_units(vdw_other, convert_to=self.cartesian_units, assume_units=DistanceUnit.default) return dist < (vdw_me * n_vdw_radii/2 + vdw_other * n_vdw_radii/2)
def is_bonded_to(self, other_atom, n_vdw_radii=1.2, default_vdw_radius=2.0 * Angstroms): #TODO deal with units dist = magnitude(self.xyz - other_atom.xyz) vdw_me = self.element.vdw_radius if vdw_me is None: vdw_me = default_vdw_radius vdw_me = strip_units(vdw_me, convert_to=self.cartesian_units, assume_units=DistanceUnit.default) vdw_other = self.element.vdw_radius if vdw_other is None: vdw_other = default_vdw_radius vdw_other = strip_units(vdw_other, convert_to=self.cartesian_units, assume_units=DistanceUnit.default) return dist < (vdw_me * n_vdw_radii / 2 + vdw_other * n_vdw_radii / 2)