From 25c4256d0f18d8eab837eb627d82e053169ae2b0 Mon Sep 17 00:00:00 2001 From: Gerd Gehrisch Date: Thu, 5 Sep 2024 15:22:24 +0200 Subject: [PATCH] some changes --- src/capabilities/simplemd.cpp | 12 +++++++++++- src/capabilities/simplemd.h | 2 ++ src/main.cpp | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/capabilities/simplemd.cpp b/src/capabilities/simplemd.cpp index ce7f178..45c3c1c 100644 --- a/src/capabilities/simplemd.cpp +++ b/src/capabilities/simplemd.cpp @@ -73,6 +73,7 @@ void SimpleMD::LoadControlJson() m_T0 = Json2KeyWord(m_defaults, "T"); m_rmrottrans = Json2KeyWord(m_defaults, "rmrottrans"); m_nocenter = Json2KeyWord(m_defaults, "nocenter"); + m_COM = Json2KeyWord(m_defaults, "COM"); m_dump = Json2KeyWord(m_defaults, "dump"); m_print = Json2KeyWord(m_defaults, "print"); m_max_top_diff = Json2KeyWord(m_defaults, "MaxTopoDiff"); @@ -219,7 +220,7 @@ bool SimpleMD::Initialise() m_molecule.setCharge(0); if (!m_nocenter) { std::cout << "Move stucture to the origin ... " << std::endl; - m_molecule.setGeometry(GeometryTools::TranslateGeometry(m_molecule.getGeometry(), GeometryTools::Centroid(m_molecule.getGeometry()), Position{ 0, 0, 0 })); + m_molecule.Center(m_COM); } else std::cout << "Move stucture NOT to the origin ... " << std::endl; @@ -427,6 +428,7 @@ nlohmann::json SimpleMD::WriteRestartInformation() restart["gradient"] = Tools::DoubleVector2String(m_gradient); restart["rmrottrans"] = m_rmrottrans; restart["nocenter"] = m_nocenter; + restart["COM"] = m_COM; restart["average_T"] = m_aver_Temp; restart["average_Epot"] = m_aver_Epot; restart["average_Ekin"] = m_aver_Ekin; @@ -500,6 +502,10 @@ bool SimpleMD::LoadRestartInformation(const json& state) m_nocenter = state["nocenter"]; } catch (json::type_error& e) { } + try { + m_COM = state["COM"]; + } catch (json::type_error& e) { + } try { m_T0 = state["T"]; } catch (json::type_error& e) { @@ -719,7 +725,11 @@ void SimpleMD::start() } } #endif +/////////// Dipole calc + + +/////////// Dipole calc if (m_step % m_dump == 0) { bool write = WriteGeometry(); if (write) { diff --git a/src/capabilities/simplemd.h b/src/capabilities/simplemd.h index a01efc5..80214c7 100644 --- a/src/capabilities/simplemd.h +++ b/src/capabilities/simplemd.h @@ -45,6 +45,7 @@ static json CurcumaMDJson{ { "Spin", 0 }, { "rmrottrans", 0 }, { "nocenter", false }, + { "COM", false }, { "dump", 50 }, { "print", 1000 }, { "unique", false }, @@ -193,6 +194,7 @@ class SimpleMD : public CurcumaMethod { bool m_initialised = false, m_restart = false, m_writeUnique = true, m_opt = false, m_rescue = false, m_writeXYZ = true, m_writeinit = false, m_norestart = false; int m_rmrottrans = 0, m_rattle_maxiter = 100; bool m_nocenter = false; + bool m_COM = false; EnergyCalculator* m_interface; RMSDTraj* m_unqiue; const std::vector m_used_mass; diff --git a/src/main.cpp b/src/main.cpp index cd15f0d..e96d416 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -945,7 +945,7 @@ int main(int argc, char **argv) { while (!file.AtEnd()) { // calculation and output dipole moment mol = file.Next(); // load Molecule mol.Center(false); - EnergyCalculator interface("gfn2", blob); // set method to gfn2-xtb and give + EnergyCalculator interface("gfn2", blob); // set method to gfn2-xtb interface.setMolecule(mol); // set molecule for calc interface.CalculateEnergy(false, true); //calc energy and charges and dipole moment mol.setPartialCharges(interface.Charges()); // calc Partial Charges and give it to mol