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

§ neutralMass()

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  }
const double Neutron
the mass of a neutron in unified atomic mass units
Definition: Chemistry.hpp:44
const double Proton
the mass of a proton in unified atomic mass units
Definition: Chemistry.hpp:41
const double Electron
the mass of an electron in unified atomic mass units
Definition: Chemistry.hpp:47
double mz(double neutralMass, int protonDelta, int electronDelta=0, int neutronDelta=0)
Definition: Ion.hpp:78

§ ionMass()

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 neutralMass(double mz, int protonDelta, int electronDelta=0, int neutronDelta=0)
Definition: Ion.hpp:46
const double Neutron
the mass of a neutron in unified atomic mass units
Definition: Chemistry.hpp:44
const double Proton
the mass of a proton in unified atomic mass units
Definition: Chemistry.hpp:41
const double Electron
the mass of an electron in unified atomic mass units
Definition: Chemistry.hpp:47

§ mz()

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 pwiz::msdata::Precursor::Precursor(), pwiz::msdata::SelectedIon::SelectedIon(), 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  }
double neutralMass(double mz, int protonDelta, int electronDelta=0, int neutronDelta=0)
Definition: Ion.hpp:46
double ionMass(double neutralMass, int protonDelta, int electronDelta=0, int neutronDelta=0)
Definition: Ion.hpp:63