63 bool VCS_SOLVE::vcs_elabcheck(
int ibound)
68 bool multisign =
false;
75 for (
size_t i = 0; i < top; ++i) {
134 void VCS_SOLVE::vcs_elabPhase(
size_t iphase,
double*
const elemAbundPhase)
147 elemAbundPhase[j] = 0.0;
162 int VCS_SOLVE::vcs_elcorr(
double aa[],
double x[])
207 double xx, par, saveDir, dir;
210 double l2before = 0.0, l2after = 0.0;
211 std::vector<double> ga_save(m_numElemConstraints, 0.0);
214 plogf(
" --- vcsc_elcorr: Element abundances correction routine");
216 plogf(
" (m_numComponents != m_numElemConstraints)");
226 l2before += x[i] * x[i];
228 l2before = sqrt(l2before/m_numElemConstraints);
238 bool changed =
false;
239 bool multisign =
false;
255 if (numNonZero < 2) {
266 int numCompNonZero = 0;
267 size_t compID =
npos;
277 if (numCompNonZero == 1) {
279 for (
size_t kspec = m_numComponents; kspec <
m_numSpeciesTot; kspec++) {
311 if (atomComp > 0.0) {
317 plogf(
" --- vcs_elcorr: Reduced species %s from %g to %g "
318 "due to %s max bounds constraint\n",
334 plogf(
" --- vcs_elcorr: Zeroed species %s and changed "
335 "status to %d due to max bounds constraint\n",
359 if (fabs(x[i]) > 1.0E-13) {
366 int err = vcsUtil_mlequ(aa, m_numElemConstraints, m_numComponents, x, 1);
368 plogf(
"vcs_elcorr ERROR: mlequ returned error condition\n");
369 return VCS_FAILED_CONVERGENCE;
387 if (par < 1.0 && par > 0.0) {
442 if (fabs(dir) > 1.0E-10) {
481 vcs_reinsert_deleted(kspec);
490 if (vcs_elabcheck(0)) {
522 if (vcs_elabcheck(1)) {
535 bool useZeroed =
true;
579 if (vcs_elabcheck(1)) {
590 l2after += SQUARE(m_elemAbundances[i] - m_elemAbundancesGoal[i]);
592 l2after = sqrt(l2after/m_numElemConstraints);
594 plogf(
" --- Elem_Abund: Correct Initial "
599 plogf(
" %20.12E %20.12E %20.12E\n", m_elemAbundancesGoal[i], ga_save[i], m_elemAbundances[i]);
601 plogf(
" --- Diff_Norm: %20.12E %20.12E\n",