From 1d414081cc2d3298ad83a6b65fe7235fa95afd3e Mon Sep 17 00:00:00 2001 From: Marcin Kirsz <mkirsz@ed.ac.uk> Date: Fri, 7 Feb 2025 12:49:14 +0000 Subject: [PATCH] added get_t --- include/tadah/mlip/structure.h | 3 +++ src/structure.cpp | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/tadah/mlip/structure.h b/include/tadah/mlip/structure.h index c36baf2..b264a1e 100644 --- a/include/tadah/mlip/structure.h +++ b/include/tadah/mlip/structure.h @@ -140,6 +140,9 @@ struct Structure { /** @return density of this structure in g/cm^3 */ double get_density() const; + /** @return temperature of this structure in K */ + double get_temperature() const; + /** @return virial pressure calculated from the stress tensor. * * Units: energy/distance^3 diff --git a/src/structure.cpp b/src/structure.cpp index 9db209c..b759203 100644 --- a/src/structure.cpp +++ b/src/structure.cpp @@ -174,7 +174,7 @@ double Structure::get_volume() const { return cell.row(0)*(cell.row(1).cross(cell.row(2))); } double Structure::get_density() const { - double V = cell.row(0)*(cell.row(1).cross(cell.row(2))); + double V = get_volume(); V*=1e-24; // convert to cm^3 double amu = 1.66053906660e-24; // g double mass = 0; @@ -182,6 +182,10 @@ double Structure::get_density() const { return amu*mass/V; } +double Structure::get_temperature() const { + return T; +} + double Structure::get_virial_pressure() const { return stress.trace()/get_volume()/3; } -- GitLab