From ab833001310ae983199135d5df543239a6e60ed1 Mon Sep 17 00:00:00 2001 From: Susi Lehtola Date: Sun, 4 Feb 2024 09:16:30 +0200 Subject: [PATCH] Fix computation of virial ratio --- src/contrib/hneoci.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/contrib/hneoci.cpp b/src/contrib/hneoci.cpp index 4aeaa6fa..fbee5df3 100644 --- a/src/contrib/hneoci.cpp +++ b/src/contrib/hneoci.cpp @@ -329,12 +329,15 @@ int main_guarded(int argc, char **argv) { double Enuc_CI = arma::as_scalar(C.col(0).t() * V_ci * C.col(0)); printf("CI energy % .15f\n",E(0)); - printf("Electronic kinetic energy (dm) %.9f\n", arma::trace(Pe*T)); - printf("Protonic kinetic energy (dm) %.9f\n", arma::trace(Pp*Tp)); - printf("Total kinetic energy (dm) %.9f\n", arma::trace(Pe*T)+arma::trace(Pp*Tp)); + double Ekine=arma::trace(Pe*T); + double Ekinp=arma::trace(Pp*Tp); + double Ekin=Ekine+Ekinp; + printf("Electronic kinetic energy (dm) %.9f\n", Ekine); + printf("Protonic kinetic energy (dm) %.9f\n", Ekinp); + printf("Total kinetic energy (dm) %.9f\n", Ekin); printf("Total kinetic energy (CI) %.9f\n", Ekin_CI); printf("Electron-proton Coulomb energy %.9f\n", Enuc_CI); - printf("Virial ratio %e\n",-E(0)/Enuc_CI); + printf("Virial ratio %e\n",-E(0)/Ekin); printf("\nRunning program took %s.\n",t.elapsed().c_str());