diff --git a/include/teqp/algorithms/critical_tracing.hpp b/include/teqp/algorithms/critical_tracing.hpp index 999819231f0f4dfe8f89be85fbe35ad2dc0c2069..0b964ef3e569d56e3eba091118d443024ad444a1 100644 --- a/include/teqp/algorithms/critical_tracing.hpp +++ b/include/teqp/algorithms/critical_tracing.hpp @@ -95,6 +95,13 @@ struct CriticalTracing { else { throw std::invalid_argument("More than one non-zero concentration value found; not currently supported"); } + // Align with the eigenvector of the component with the smallest density, and make that one positive + Eigen::Index ind; + rhovec.minCoeff(&ind); + if (ed.eigenvectorscols.col(ind).minCoeff() < 0) { + ed.eigenvectorscols *= -1.0; + } + ed.v0 = ed.eigenvectorscols.col(0); ed.v1 = ed.eigenvectorscols.col(1); return ed;