#NEWLINE# def pi_cation( mol1 , mol2 , cutoff = 5 , tolerance = 30 ) : #NEWLINE# #INDENT# "Returns pairs of ring-cation atoms, which meet pi-cation criteria\n\n    Parameters\n    ----------\n        mol1, mol2 : oddt.toolkit.Molecule object\n            Molecules to compute ring-cation pairs\n\n        cutoff : float, (default=5)\n            Distance cutoff for Pi-cation pairs\n\n        tolerance : int, (default=30)\n            Range (+/- tolerance) from perfect direction (perpendicular) in which pi-cation are considered as strict.\n\n    Returns\n    -------\n        r1 : ring_dict-type numpy array\n            Aligned rings forming pi-stacking\n\n        plus2 : atom_dict-type numpy array\n            Aligned cations forming pi-cation\n\n        strict_parallel : numpy array, dtype=bool\n            Boolean array align with ring-cation pairs, informing whether they form 'strict' pi-cation. If false, only distance cutoff is met, therefore the interaction is 'crude'.\n\n    " #NEWLINE# ( r1 , plus2 ) = close_contacts ( mol1 . ring_dict , mol2 . atom_dict [ mol2 . atom_dict [ 'isplus' ] ] , cutoff , x_column = 'centroid' ) #NEWLINE# if ( ( len ( r1 ) > 0 ) and ( len ( plus2 ) > 0 ) ) : #NEWLINE# #INDENT# angle1 = angle_2v ( r1 [ 'vector' ] , ( plus2 [ 'coords' ] - r1 [ 'centroid' ] ) ) #NEWLINE# strict = ( ( angle1 > ( 180 - tolerance ) ) | ( angle1 < tolerance ) ) #NEWLINE# return ( r1 , plus2 , strict ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return ( strict , plus2 , np . array ( [ ] , dtype = bool ) )