code: def show_cationpi(self):
          
          for i, p in enumerate(self.plcomplex.pication):
              cmd.pseudoatom('ps-picat-1-%i' % i, pos=p.ring_center)
              cmd.pseudoatom('ps-picat-2-%i' % i, pos=p.charge_center)
              if p.protcharged:
                  cmd.pseudoatom('Chargecenter-P', pos=p.charge_center)
                  cmd.pseudoatom('Centroids-L', pos=p.ring_center)
                  pilig_ids = '+'.join(map(str, p.ring_atoms))
                  cmd.select('PiCatRing-L', 'PiCatRing-L or (id %s & %s)' % (pilig_ids, self.ligname))
                  for a in p.charge_atoms:
                      cmd.select('PosCharge-P', 'PosCharge-P or (id %i & %s)' % (a, self.protname))
              else:
                  cmd.pseudoatom('Chargecenter-L', pos=p.charge_center)
                  cmd.pseudoatom('Centroids-P', pos=p.ring_center)
                  pires_ids = '+'.join(map(str, p.ring_atoms))
                  cmd.select('PiCatRing-P', 'PiCatRing-P or (id %s & %s)' % (pires_ids, self.protname))
                  for a in p.charge_atoms:
                      cmd.select('PosCharge-L', 'PosCharge-L or (id %i & %s)' % (a, self.ligname))
              cmd.distance('PiCation', 'ps-picat-1-%i' % i, 'ps-picat-2-%i' % i)
          if self.object_exists('PiCation'):
              cmd.set('dash_color', 'orange', 'PiCation')
              cmd.set('dash_gap', 0.3, 'PiCation')
              cmd.set('dash_length', 0.6, 'PiCation')
docs: Visualize cation-pi interactions.