Changed name of a variable.

This commit is contained in:
Harry Moffat 2008-04-17 16:53:17 +00:00
parent f6ecf72ea3
commit b9533bcf34
9 changed files with 54 additions and 48 deletions

View file

@ -155,12 +155,12 @@ int VCS_SOLVE::vcs_evalSS_TP(int ipr, int ip1, double Temp, double pres)
for (int iph = 0; iph < NPhase; iph++) { for (int iph = 0; iph < NPhase; iph++) {
vcs_VolPhase* vph = VPhaseList[iph]; vcs_VolPhase* vph = VPhaseList[iph];
vph->setState_TP(T, Pres); vph->setState_TP(T, Pres);
vph->sendToVCSGStar(VCS_DATA_PTR(ff)); vph->sendToVCSGStar(VCS_DATA_PTR(m_SSfeSpecies));
} }
if (m_VCS_UnitsFormat == VCS_UNITS_UNITLESS) { if (m_VCS_UnitsFormat == VCS_UNITS_UNITLESS) {
for (int i = 0; i < m_numSpeciesTot; ++i) { for (int i = 0; i < m_numSpeciesTot; ++i) {
ff[i] /= Temp; m_SSfeSpecies[i] /= Temp;
} }
} }
return VCS_SUCCESS; return VCS_SUCCESS;
@ -185,7 +185,7 @@ void VCS_SOLVE::vcs_fePrep_TP(void)
* potential. This value doesn't change during the calculation * potential. This value doesn't change during the calculation
*/ */
if (SSPhase[i]) { if (SSPhase[i]) {
m_gibbsSpecies[i] = ff[i]; m_gibbsSpecies[i] = m_SSfeSpecies[i];
} }
} }
} /* vcs_fePrep_TP() ********************************************************/ } /* vcs_fePrep_TP() ********************************************************/

View file

@ -105,7 +105,7 @@ namespace VCSnonideal {
plogf("%s SPECIES MOLE_NUMBER -SS_ChemPotential\n", pprefix); plogf("%s SPECIES MOLE_NUMBER -SS_ChemPotential\n", pprefix);
for (kspec = 0; kspec < nspecies; ++kspec) { for (kspec = 0; kspec < nspecies; ++kspec) {
plogf("%s ", pprefix); plogf("%-12.12s", SpName[kspec].c_str()); plogf("%s ", pprefix); plogf("%-12.12s", SpName[kspec].c_str());
plogf(" %15.5g %12.3g\n", molNum[kspec], -ff[kspec]); plogf(" %15.5g %12.3g\n", molNum[kspec], -m_SSfeSpecies[kspec]);
} }
plogf("%s Element Abundance Agreement returned from linear " plogf("%s Element Abundance Agreement returned from linear "
"programming (vcs_inest initial guess):", "programming (vcs_inest initial guess):",
@ -195,7 +195,8 @@ namespace VCSnonideal {
wt[kspec] = 0.0; wt[kspec] = 0.0;
} }
} }
vcs_dcopy(VCS_DATA_PTR(m_gibbsSpecies), VCS_DATA_PTR(ff), nspecies); vcs_dcopy(VCS_DATA_PTR(m_gibbsSpecies), VCS_DATA_PTR(m_SSfeSpecies),
nspecies);
for (kspec = 0; kspec < m_numComponents; ++kspec) { for (kspec = 0; kspec < m_numComponents; ++kspec) {
if (SpeciesUnknownType[kspec] == VCS_SPECIES_TYPE_MOLNUM) { if (SpeciesUnknownType[kspec] == VCS_SPECIES_TYPE_MOLNUM) {
@ -213,10 +214,11 @@ namespace VCSnonideal {
for (kspec = 0; kspec < nspecies; ++kspec) { for (kspec = 0; kspec < nspecies; ++kspec) {
plogf("%s", pprefix); plogf("%-12.12s", SpName[kspec].c_str()); plogf("%s", pprefix); plogf("%-12.12s", SpName[kspec].c_str());
if (kspec < m_numComponents) if (kspec < m_numComponents)
plogf("fe* = %15.5g ff = %15.5g\n", m_gibbsSpecies[kspec], ff[kspec]); plogf("fe* = %15.5g ff = %15.5g\n", m_gibbsSpecies[kspec],
m_SSfeSpecies[kspec]);
else else
plogf("fe* = %15.5g ff = %15.5g dg* = %15.5g\n", plogf("fe* = %15.5g ff = %15.5g dg* = %15.5g\n",
m_gibbsSpecies[kspec], ff[kspec], dg[kspec-m_numComponents]); m_gibbsSpecies[kspec], m_SSfeSpecies[kspec], dg[kspec-m_numComponents]);
} }
} }
#endif #endif

View file

@ -102,7 +102,7 @@ void VCS_SOLVE::vcs_nondim_TP(void) {
* FF(I), to make it dimensionless, i.e., mu / RT. * FF(I), to make it dimensionless, i.e., mu / RT.
* Thus, we may divide it by the temperature. * Thus, we may divide it by the temperature.
*/ */
ff[i] *= tf; m_SSfeSpecies[i] *= tf;
m_gibbsSpecies[i] *= tf; m_gibbsSpecies[i] *= tf;
dg[i] *= tf; dg[i] *= tf;
dgl[i] *= tf; dgl[i] *= tf;
@ -142,7 +142,7 @@ void VCS_SOLVE::vcs_redim_TP(void)
* Modify the standard state and total chemical potential data, * Modify the standard state and total chemical potential data,
* FF(I), to make it have units, i.e. mu = RT * mu_star * FF(I), to make it have units, i.e. mu = RT * mu_star
*/ */
ff[i] *= tf; m_SSfeSpecies[i] *= tf;
m_gibbsSpecies[i] *= tf; m_gibbsSpecies[i] *= tf;
dg[i] *= tf; dg[i] *= tf;
dgl[i] *= tf; dgl[i] *= tf;

View file

@ -196,7 +196,7 @@ int VCS_SOLVE::vcs_prep_oneTime(int printLvl)
retn = vcs_evalSS_TP(0, 0, T, pres); retn = vcs_evalSS_TP(0, 0, T, pres);
for (kspec = 0; kspec < m_numSpeciesTot; ++kspec) { for (kspec = 0; kspec < m_numSpeciesTot; ++kspec) {
if (SpeciesUnknownType[kspec] == VCS_SPECIES_TYPE_MOLNUM) { if (SpeciesUnknownType[kspec] == VCS_SPECIES_TYPE_MOLNUM) {
soln[kspec] = - ff[kspec]; soln[kspec] = - m_SSfeSpecies[kspec];
} else { } else {
soln[kspec] = 0.0; soln[kspec] = 0.0;
} }

View file

@ -313,7 +313,7 @@ int VCS_SOLVE::vcs_report(int iconv)
int pid = PhaseID[l]; int pid = PhaseID[l];
plogf(" %-12.12s", SpName[l].c_str()); plogf(" %-12.12s", SpName[l].c_str());
plogf(" %14.7E ", soln[l]); plogf(" %14.7E ", soln[l]);
plogf("%14.7E ", ff[l]); plogf("%14.7E ", m_SSfeSpecies[l]);
plogf("%14.7E ", log(ActCoeff[l])); plogf("%14.7E ", log(ActCoeff[l]));
double tpmoles = TPhMoles[pid]; double tpmoles = TPhMoles[pid];
double phi = phasePhi[pid]; double phi = phasePhi[pid];
@ -325,12 +325,12 @@ int VCS_SOLVE::vcs_report(int iconv)
if (tpmoles > 0.0 && soln[l] > 0.0) { if (tpmoles > 0.0 && soln[l] > 0.0) {
lx = log(soln[l]) - log(tpmoles); lx = log(soln[l]) - log(tpmoles);
} else { } else {
lx = m_gibbsSpecies[l] - ff[l] - log(ActCoeff[l]) + SpecLnMnaught[l]; lx = m_gibbsSpecies[l] - m_SSfeSpecies[l] - log(ActCoeff[l]) + SpecLnMnaught[l];
} }
} }
plogf("%14.7E |", lx); plogf("%14.7E |", lx);
plogf("%14.7E | ", eContrib); plogf("%14.7E | ", eContrib);
double tmp = ff[l] + log(ActCoeff[l]) + lx - SpecLnMnaught[l] + eContrib; double tmp = m_SSfeSpecies[l] + log(ActCoeff[l]) + lx - SpecLnMnaught[l] + eContrib;
if (fabs(m_gibbsSpecies[l] - tmp) > 1.0E-8) { if (fabs(m_gibbsSpecies[l] - tmp) > 1.0E-8) {
plogf("\n\t\twe have a problem - doesn't add up\n"); plogf("\n\t\twe have a problem - doesn't add up\n");
exit(-1); exit(-1);

View file

@ -98,7 +98,7 @@ int VCS_SOLVE::vcs_setMolesLinProg() {
#ifdef DEBUG_MODE #ifdef DEBUG_MODE
if (vcs_debug_print_lvl >= 2) { if (vcs_debug_print_lvl >= 2) {
printProgress(SpName, soln, ff); printProgress(SpName, soln, m_SSfeSpecies);
} }
#endif #endif
@ -144,11 +144,11 @@ int VCS_SOLVE::vcs_setMolesLinProg() {
// dg_rt is the Delta_G / RT value for the reaction // dg_rt is the Delta_G / RT value for the reaction
ik = m_numComponents + irxn; ik = m_numComponents + irxn;
dg_rt = ff[ik]; dg_rt = m_SSfeSpecies[ik];
dxi_min = 1.0e10; dxi_min = 1.0e10;
const double *sc_irxn = sc[irxn]; const double *sc_irxn = sc[irxn];
for (jcomp = 0; jcomp < m_numElemConstraints; jcomp++) { for (jcomp = 0; jcomp < m_numElemConstraints; jcomp++) {
dg_rt += ff[jcomp] * sc_irxn[jcomp]; dg_rt += m_SSfeSpecies[jcomp] * sc_irxn[jcomp];
} }
// fwd or rev direction. // fwd or rev direction.
// idir > 0 implies increasing the current species // idir > 0 implies increasing the current species
@ -208,14 +208,14 @@ int VCS_SOLVE::vcs_setMolesLinProg() {
// vcs_updateVP(0); // vcs_updateVP(0);
#ifdef DEBUG_MODE #ifdef DEBUG_MODE
if (vcs_debug_print_lvl >= 2) { if (vcs_debug_print_lvl >= 2) {
printProgress(SpName, soln, ff); printProgress(SpName, soln, m_SSfeSpecies);
} }
#endif #endif
} }
#ifdef DEBUG_MODE #ifdef DEBUG_MODE
if (vcs_debug_print_lvl == 1) { if (vcs_debug_print_lvl == 1) {
printProgress(SpName, soln, ff); printProgress(SpName, soln, m_SSfeSpecies);
plogf(" --- setInitialMoles end\n"); plogf(" --- setInitialMoles end\n");
} }
#endif #endif

View file

@ -110,7 +110,7 @@ namespace VCSnonideal {
m_spSize.resize(nspecies0, 1.0); m_spSize.resize(nspecies0, 1.0);
m_gibbsSpecies.resize(nspecies0, 0.0); m_gibbsSpecies.resize(nspecies0, 0.0);
ff.resize(nspecies0, 0.0); m_SSfeSpecies.resize(nspecies0, 0.0);
feTrial.resize(nspecies0, 0.0); feTrial.resize(nspecies0, 0.0);
soln.resize(nspecies0, 0.0); soln.resize(nspecies0, 0.0);
@ -300,7 +300,7 @@ namespace VCSnonideal {
int iprintTime = MAX(ipr, ip1); int iprintTime = MAX(ipr, ip1);
if (m_timing_print_lvl < iprintTime) { if (m_timing_print_lvl < iprintTime) {
iprintTime = m_timing_print_lvl ; iprintTime = m_timing_print_lvl ;
} }
if (ifunc < 0 || ifunc > 2) { if (ifunc < 0 || ifunc > 2) {

View file

@ -417,12 +417,12 @@ public:
std::vector<double> m_spSize; std::vector<double> m_spSize;
//! Standard state chemical potentials for species K at the current //! Standard state chemical potentials for species K at the current
//! temperature and pressure. //! temperature and pressure.
/*! /*!
* The first NC entries are for components. The following NR entries are * The first NC entries are for components. The following NR entries are
* for the current non-component species in the mechanism. * for the current non-component species in the mechanism.
*/ */
std::vector<double> ff; std::vector<double> m_SSfeSpecies;
//! Dimensionless/Dimensional free energy for all the species in the mechanism at the //! Dimensionless/Dimensional free energy for all the species in the mechanism at the
//! current T, P, and mole numbers. //! current T, P, and mole numbers.
@ -801,7 +801,8 @@ public:
//! printing level of timing information //! printing level of timing information
/*! /*!
* 1 allowing printing of timing * 1 allowing printing of timing
* 0 do not allow printing of timing -> everything is a zero. * 0 do not allow printing of timing -> everything is printed
* as a NA.
*/ */
int m_timing_print_lvl; int m_timing_print_lvl;

View file

@ -294,7 +294,7 @@ namespace VCSnonideal {
plogf(" 0"); plogf(" 0");
} }
print_space(47-m_numElemConstraints*3); print_space(47-m_numElemConstraints*3);
plogf("%12.5E %12.5E", RT * ff[i], soln[i]); plogf("%12.5E %12.5E", RT * m_SSfeSpecies[i], soln[i]);
if (SpeciesUnknownType[i] == VCS_SPECIES_TYPE_MOLNUM) { if (SpeciesUnknownType[i] == VCS_SPECIES_TYPE_MOLNUM) {
plogf(" Mol_Num"); plogf(" Mol_Num");
} else if (SpeciesUnknownType[i] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) { } else if (SpeciesUnknownType[i] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
@ -2525,7 +2525,7 @@ namespace VCSnonideal {
* for formation reactions * for formation reactions
*/ */
for (kspec = m_numSpeciesRdc; kspec < m_numSpeciesTot; ++kspec) { for (kspec = m_numSpeciesRdc; kspec < m_numSpeciesTot; ++kspec) {
m_gibbsSpecies[kspec] = ff[kspec]; m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec];
} }
/* /*
* Recalculate the DeltaG's of the formation reactions for the * Recalculate the DeltaG's of the formation reactions for the
@ -2613,7 +2613,7 @@ namespace VCSnonideal {
* ~ infinite dilution. * ~ infinite dilution.
*/ */
for (kspec = m_numSpeciesRdc; kspec < m_numSpeciesTot; ++kspec) { for (kspec = m_numSpeciesRdc; kspec < m_numSpeciesTot; ++kspec) {
m_gibbsSpecies[kspec] = ff[kspec]; m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec];
} }
/* /*
* Recalculate the DeltaG's of the formation reactions for the * Recalculate the DeltaG's of the formation reactions for the
@ -3494,7 +3494,7 @@ namespace VCSnonideal {
kfound = kspec; kfound = kspec;
} else { } else {
// ok we are sitting pretty equal here decide on the raw ss Gibbs energy // ok we are sitting pretty equal here decide on the raw ss Gibbs energy
if (ff[kspec] <= ff[kfound]) { if (m_SSfeSpecies[kspec] <= m_SSfeSpecies[kfound]) {
kfound = kspec; kfound = kspec;
} }
} }
@ -4106,15 +4106,15 @@ namespace VCSnonideal {
exit(-1); exit(-1);
} }
#endif #endif
mu_i[kspec] = ff[kspec] + Charge[kspec] * Faraday_phi; mu_i[kspec] = m_SSfeSpecies[kspec] + Charge[kspec] * Faraday_phi;
} else { } else {
if (SSPhase[kspec]) { if (SSPhase[kspec]) {
mu_i[kspec] = ff[kspec] + Charge[kspec] * Faraday_phi; mu_i[kspec] = m_SSfeSpecies[kspec] + Charge[kspec] * Faraday_phi;
} else if (molNum[kspec] <= VCS_DELETE_MINORSPECIES_CUTOFF) { } else if (molNum[kspec] <= VCS_DELETE_MINORSPECIES_CUTOFF) {
mu_i[kspec] = ff[kspec] + log(ac[kspec] * VCS_DELETE_MINORSPECIES_CUTOFF) mu_i[kspec] = m_SSfeSpecies[kspec] + log(ac[kspec] * VCS_DELETE_MINORSPECIES_CUTOFF)
- tlogMoles - SpecLnMnaught[kspec] + Charge[kspec] * Faraday_phi; - tlogMoles - SpecLnMnaught[kspec] + Charge[kspec] * Faraday_phi;
} else { } else {
mu_i[kspec] = ff[kspec] + log(ac[kspec] * molNum[kspec]) mu_i[kspec] = m_SSfeSpecies[kspec] + log(ac[kspec] * molNum[kspec])
- tlogMoles - SpecLnMnaught[kspec] + Charge[kspec] * Faraday_phi; - tlogMoles - SpecLnMnaught[kspec] + Charge[kspec] * Faraday_phi;
} }
} }
@ -4328,23 +4328,24 @@ namespace VCSnonideal {
exit(-1); exit(-1);
} }
#endif #endif
m_gibbsSpecies[kspec] = ff[kspec] + Charge[kspec] * Faraday_dim * phasePhi[iphase]; m_gibbsSpecies[kspec] =
m_SSfeSpecies[kspec] + Charge[kspec] * Faraday_dim * phasePhi[iphase];
} else { } else {
if (SSPhase[kspec]) { if (SSPhase[kspec]) {
m_gibbsSpecies[kspec] = ff[kspec]; m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec];
} else { } else {
if (z[kspec] <= VCS_DELETE_MINORSPECIES_CUTOFF) { if (z[kspec] <= VCS_DELETE_MINORSPECIES_CUTOFF) {
iph = PhaseID[kspec]; iph = PhaseID[kspec];
if (tPhMoles_ptr[iph] > 0.0) { if (tPhMoles_ptr[iph] > 0.0) {
m_gibbsSpecies[kspec] = ff[kspec] m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec]
+ log(ActCoeff[kspec] * VCS_DELETE_MINORSPECIES_CUTOFF) + log(ActCoeff[kspec] * VCS_DELETE_MINORSPECIES_CUTOFF)
- tlogMoles[PhaseID[kspec]] - SpecLnMnaught[kspec] - tlogMoles[PhaseID[kspec]] - SpecLnMnaught[kspec]
+ Charge[kspec] * Faraday_dim * phasePhi[iphase]; + Charge[kspec] * Faraday_dim * phasePhi[iphase];
} else { } else {
m_gibbsSpecies[kspec] = ff[kspec]; m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec];
} }
} else { } else {
m_gibbsSpecies[kspec] = ff[kspec] + log(ActCoeff[kspec] * z[kspec]) m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec] + log(ActCoeff[kspec] * z[kspec])
- tlogMoles[PhaseID[kspec]] - SpecLnMnaught[kspec] - tlogMoles[PhaseID[kspec]] - SpecLnMnaught[kspec]
+ Charge[kspec] * Faraday_dim * phasePhi[iphase]; + Charge[kspec] * Faraday_dim * phasePhi[iphase];
} }
@ -4370,23 +4371,24 @@ namespace VCSnonideal {
exit(-1); exit(-1);
} }
#endif #endif
m_gibbsSpecies[kspec] = ff[kspec] + Charge[kspec] * Faraday_dim * phasePhi[iphase]; m_gibbsSpecies[kspec] =
m_SSfeSpecies[kspec] + Charge[kspec] * Faraday_dim * phasePhi[iphase];
} else { } else {
if (SSPhase[kspec]) { if (SSPhase[kspec]) {
m_gibbsSpecies[kspec] = ff[kspec]; m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec];
} else { } else {
if (z[kspec] <= VCS_DELETE_MINORSPECIES_CUTOFF) { if (z[kspec] <= VCS_DELETE_MINORSPECIES_CUTOFF) {
iph = PhaseID[kspec]; iph = PhaseID[kspec];
if (tPhMoles_ptr[iph] > 0.0) { if (tPhMoles_ptr[iph] > 0.0) {
m_gibbsSpecies[kspec] = ff[kspec] m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec]
+ log(ActCoeff[kspec] * VCS_DELETE_MINORSPECIES_CUTOFF) + log(ActCoeff[kspec] * VCS_DELETE_MINORSPECIES_CUTOFF)
- tlogMoles[PhaseID[kspec]] - SpecLnMnaught[kspec] - tlogMoles[PhaseID[kspec]] - SpecLnMnaught[kspec]
+ Charge[kspec] * Faraday_dim * phasePhi[iphase]; ; + Charge[kspec] * Faraday_dim * phasePhi[iphase]; ;
} else { } else {
m_gibbsSpecies[kspec] = ff[kspec]; m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec];
} }
} else { } else {
m_gibbsSpecies[kspec] = ff[kspec] + log(ActCoeff[kspec] * z[kspec]) m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec] + log(ActCoeff[kspec] * z[kspec])
- tlogMoles[PhaseID[kspec]] - SpecLnMnaught[kspec] - tlogMoles[PhaseID[kspec]] - SpecLnMnaught[kspec]
+ Charge[kspec] * Faraday_dim * phasePhi[iphase]; + Charge[kspec] * Faraday_dim * phasePhi[iphase];
} }
@ -4413,23 +4415,24 @@ namespace VCSnonideal {
exit(-1); exit(-1);
} }
#endif #endif
m_gibbsSpecies[kspec] = ff[kspec] + Charge[kspec] * Faraday_dim * phasePhi[iphase]; ; m_gibbsSpecies[kspec] =
m_SSfeSpecies[kspec] + Charge[kspec] * Faraday_dim * phasePhi[iphase]; ;
} else { } else {
if (SSPhase[kspec]) { if (SSPhase[kspec]) {
m_gibbsSpecies[kspec] = ff[kspec]; m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec];
} else { } else {
if (z[kspec] <= VCS_DELETE_MINORSPECIES_CUTOFF) { if (z[kspec] <= VCS_DELETE_MINORSPECIES_CUTOFF) {
iph = PhaseID[kspec]; iph = PhaseID[kspec];
if (tPhMoles_ptr[iph] > 0.0) { if (tPhMoles_ptr[iph] > 0.0) {
m_gibbsSpecies[kspec] = ff[kspec] m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec]
+ log(ActCoeff[kspec] * VCS_DELETE_MINORSPECIES_CUTOFF) + log(ActCoeff[kspec] * VCS_DELETE_MINORSPECIES_CUTOFF)
- tlogMoles[PhaseID[kspec]] - SpecLnMnaught[kspec]; - tlogMoles[PhaseID[kspec]] - SpecLnMnaught[kspec];
} else { } else {
m_gibbsSpecies[kspec] = ff[kspec]; m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec];
} }
} else { } else {
st_ptr = SpeciesThermo[kspec]; st_ptr = SpeciesThermo[kspec];
m_gibbsSpecies[kspec] = ff[kspec] + log(ActCoeff[kspec] * z[kspec]) m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec] + log(ActCoeff[kspec] * z[kspec])
- tlogMoles[PhaseID[kspec]] - SpecLnMnaught[kspec]; - tlogMoles[PhaseID[kspec]] - SpecLnMnaught[kspec];
} }
} }
@ -4669,7 +4672,7 @@ namespace VCSnonideal {
SWAP(soln[k1], soln[k2], t1); SWAP(soln[k1], soln[k2], t1);
SWAP(SpeciesUnknownType[k1], SpeciesUnknownType[k2], j); SWAP(SpeciesUnknownType[k1], SpeciesUnknownType[k2], j);
SWAP(wt[k1], wt[k2], t1); SWAP(wt[k1], wt[k2], t1);
SWAP(ff[k1], ff[k2], t1); SWAP(m_SSfeSpecies[k1], m_SSfeSpecies[k2], t1);
SWAP(m_spSize[k1], m_spSize[k2], t1); SWAP(m_spSize[k1], m_spSize[k2], t1);
SWAP(m_gibbsSpecies[k1], m_gibbsSpecies[k2], t1); SWAP(m_gibbsSpecies[k1], m_gibbsSpecies[k2], t1);
SWAP(ds[k1], ds[k2], t1); SWAP(ds[k1], ds[k2], t1);