10 #include "cantera/thermo/mix_defs.h"
27 LatticeSolidPhase::LatticeSolidPhase() :
121 if (lkstart_[n+1] < k) {
127 doublereal mm = 1.0E300;
151 if (lkstart_[n+1] < k) {
157 doublereal mm = -1.0E300;
178 doublereal sum = 0.0;
188 doublereal sum = 0.0;
198 doublereal sum = 0.0;
208 doublereal sum = 0.0;
218 doublereal sum = 0.0;
237 for (
size_t k = 0; k <
m_kk; k++) {
304 size_t nsp, strt = 0;
307 m_lattice[n]->setMoleFractions(x + strt);
310 for (
size_t k = 0; k < strt; k++) {
326 size_t nsp, strt = 0;
333 for (
size_t k = 0; k < nsp; k++) {
334 sum += (x + strt)[k];
336 for (
size_t k = 0; k < nsp; k++) {
337 (x + strt)[k] /= sum;
345 for (
size_t k = 0; k < nsp; k++) {
346 if (fabs((x + strt)[k] -
m_x[strt+k]) > 1.0E-14) {
347 throw CanteraError(
"LatticeSolidPhase::getMoleFractions()",
373 m_lattice[n]->getChemPotentials(mu+strt);
384 m_lattice[n]->getPartialMolarEnthalpies(hbar + strt);
395 m_lattice[n]->getPartialMolarEntropies(sbar + strt);
406 m_lattice[n]->getPartialMolarCp(cpbar + strt);
417 m_lattice[n]->getPartialMolarVolumes(vbar + strt);
440 m_lattice[n]->getStandardChemPotentials(mu0+strt);
449 m_lattice[n]->getGibbs_RT_ref(grt + lkstart_[n]);
456 for (
size_t k = 0; k <
m_kk; k++) {
478 std::vector<XML_Node*> lattices;
482 XML_Node* phaseNode_ptr = lattices[n];
484 vector<doublereal> constArr(lp->
nElements());
486 for (
size_t es = 0; es < lp->
nElements(); es++) {
494 const std::vector<const XML_Node*> & spNode = lp->
speciesData();
498 for (
size_t k = 0; k < nsp; k++) {
500 std::map<std::string, double> comp;
504 for (
size_t m = 0; m < lp->
nElements(); m++) {
505 if (constArr[m] != 0.0) {
508 if (newIndex ==
npos) {
509 throw CanteraError(
"LatticeSolidPhase::installSlavePhases",
"confused");
511 ecomp[newIndex] = constArr[m];
514 double chrg = lp->
charge(k);
515 double sz = lp->
size(k);
533 for (
size_t k = 0; k < nsp0; k++) {
536 for (
size_t k = 0; k < nsp; k++) {
537 size_t ks = kstart + k;
569 for (
size_t k = 0; k < nsp; k++) {
570 m_x[loc] =
m_lattice[n]->moleFraction(k) / (double) m_nlattice;
613 m_lattice[nn]->setMoleFractionsByName(x);
619 for (
size_t k = 0; k < nsp; k++) {
637 eosdata.
_require(
"model",
"LatticeSolid");
639 std::vector<XML_Node*> lattices;
641 size_t nl = lattices.size();
643 for (
size_t n = 0; n < nl; n++) {
647 std::vector<string> pnam;
648 std::vector<string> pval;
652 for (
int i = 0; i < np; i++) {
655 for (
size_t j = 0; j < nl; j++) {
657 string idj = tp.
id();
658 if (idj == pnam[i]) {
697 #ifdef H298MODIFY_CAPABILITY
710 if (lkstart_[n+1] < k) {
711 int kk = k-lkstart_[n];
713 l_spthermo.modifyOneHf298(kk, Hf298New);
724 throw CanteraError(
"LatticeSolidPhase",
"Unimplemented " + msg);