double _ln_gammacElec(int i, unifac_solution *s) { double result; result = log(_phiElec(i, s)/s->xi[i]) + 1 - _phiElec(i, s)/s->xi[i] + Z/2*_q(s->m[i]) * (1 - _phi(i, s)/_theta(i, s) + log(_phi(i, s)/_theta(i, s))); return result; }
/** * Calculate that natural log of the combinatorial component of the activity coefficient for the ith molecule in the solution. * \f[ * \ln\gamma_i^c = \ln\frac{\phi_i}{x_i} * + \frac{z}{2}q_i\ln\frac{\theta_i}{\phi_i} + L_i * - \frac{\phi_i}{x_i}\sum_{j=1}^n x_j L_j * \f] * @param i Molecule ID in the solution. * @param s Solution * @returns ln(gamma_i^c) */ double _ln_gammac(int i, unifac_solution *s) { int j; double result, sum = 0; for(j=0; j<s->nsolutes; j++) sum += s->xi[i] * _L(s->m[i]); result = log(_phi(i, s)/s->xi[i]) + Z/2*_q(s->m[i])*log(_theta(i, s)/_phi(i, s)) + _L(s->m[i]) - _phi(i, s)/s->xi[i] * sum; return result; }
void IsotropicSphereModel::doGenerate(Catalog& catalog) { if (catalog.getType() != _catType) { std::stringstream ss; ss << "Generate failed. Model '" << ModelMapper::instance()->getKey(getType()) << "'. Provided catalog type doesn't match requested one."; Exception exc(type::EXCEPTION_WARNING + type::EXCEPTION_MOD_NO_PREFIX, ss.str(), PRETTY_FUNCTION); throw exc; } for (std::size_t i = 0; i < getNumberOfEntries(); ++i) { CatalogEntryGrbcat* entry = createEntry(); entry->getCoordFlag() = 0.0; entry->getCoodinates().getX0() = _time(getGenerator()); entry->getCoodinates().getX1() = 1.0; entry->getCoodinates().getX2() = _phi(getGenerator()); entry->getCoodinates().getX3() = _theta(getGenerator()); catalog.getEntries().push_back(entry); } }