diff --git a/include/tadah/mlip/structure.h b/include/tadah/mlip/structure.h index c36baf27fe3f215e0729e0c3be97f30ed420792c..b264a1eb981db6665af2cb45dfa0ecf07ef12eae 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 9db209cc995becbf1129f55c268cbda00b286aed..b7592030639659747883992212f8bf64b75ddacf 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; }