ProteoWizard
Functions
pwiz::chemistry::Ion Namespace Reference

Functions

double neutralMass (double mz, int protonDelta, int electronDelta=0, int neutronDelta=0)
 
double ionMass (double neutralMass, int protonDelta, int electronDelta=0, int neutronDelta=0)
 
double mz (double neutralMass, int protonDelta, int electronDelta=0, int neutronDelta=0)
 

Function Documentation

double pwiz::chemistry::Ion::neutralMass ( double  mz,
int  protonDelta,
int  electronDelta = 0,
int  neutronDelta = 0 
)
inline

Converts the m/z of an ion to a neutral mass.

Parameters
[in]mzThe m/z to convert.
[in]protonDeltaThe number of extra protons attached to the ion.
[in]electronDeltaThe number of extra electrons attached to the ion.
[in]neutronDeltaThe number of extra neutrons attached to the ion.
Precondition
protonDelta != electronDelta

Definition at line 46 of file Ion.hpp.

References pwiz::chemistry::Electron, pwiz::chemistry::Neutron, and pwiz::chemistry::Proton.

47  {
48  int charge = protonDelta - electronDelta;
49  return charge == 0 ? throw std::invalid_argument("[Ion::neutralMass()] m/z with protonDelta=electronDelta is impossible")
50  : mz * charge - ((Proton * protonDelta) +
51  (Electron * electronDelta) +
52  (Neutron * neutronDelta));
53  }
double pwiz::chemistry::Ion::ionMass ( double  neutralMass,
int  protonDelta,
int  electronDelta = 0,
int  neutronDelta = 0 
)
inline

Converts a neutral mass to an ionized mass.

Parameters
[in]neutralMassThe neutral mass to ionize.
[in]protonDeltaThe number of extra protons to attach to the ion.
[in]electronDeltaThe number of extra electrons to attach to the ion.
[in]neutronDeltaThe number of extra neutrons to attach to the ion.
Precondition
protonDelta != electronDelta

Definition at line 63 of file Ion.hpp.

References pwiz::chemistry::Electron, pwiz::chemistry::Neutron, and pwiz::chemistry::Proton.

Referenced by mz().

64  {
65  return neutralMass + (Proton * protonDelta) +
66  (Electron * electronDelta) +
67  (Neutron * neutronDelta);
68  }
double pwiz::chemistry::Ion::mz ( double  neutralMass,
int  protonDelta,
int  electronDelta = 0,
int  neutronDelta = 0 
)
inline

Converts a neutral mass to an m/z.

Parameters
[in]neutralMassThe neutral mass to ionize.
[in]protonDeltaThe number of extra protons to attach to the ion.
[in]electronDeltaThe number of extra electrons to attach to the ion.
[in]neutronDeltaThe number of extra neutrons to attach to the ion.
Precondition
protonDelta != electronDelta

Definition at line 78 of file Ion.hpp.

References ionMass().

Referenced by test(), test2(), testMetadata(), testMultiplePeaks(), testPolysiloxane(), and validateRecalculation().

79  {
80  int z = protonDelta - electronDelta;
81  double m = ionMass(neutralMass, protonDelta, electronDelta, neutronDelta);
82  return z == 0 ? throw std::invalid_argument("[Ion::mz()] m/z with protonDelta=electronDelta is impossible")
83  : m / z;
84  }