integer_charge(particle: plasmapy.particles.particle_class.Particle) → numbers.Integral¶
Return the integer charge of a particle.
str) – String representing a particle.
Z – The charge as a multiple of the elementary charge.
- Return type
InvalidParticleError – If the argument does not correspond to a valid particle or contradictory information is provided.
ChargeError – If charge information for the particle is not available.
AtomicWarning – If the input represents an ion with an integer charge that is less than or equal to
-3, which is unlikely to occur in nature.
This function supports two formats for integer charge information.
The first format is a string that has information for the element or isotope at the beginning, a space in between, and the integer charge information in the form of an integer followed by a plus or minus sign, or a plus or minus sign followed by an integer.
The second format is a string containing element information at the beginning, following by one or more plus or minus signs.
>>> integer_charge('Fe-56 2+') 2 >>> integer_charge('He -2') -2 >>> integer_charge('H+') 1 >>> integer_charge('N-14++') 2