diff --git a/src/capabilities/simplemd.cpp b/src/capabilities/simplemd.cpp index d15ef65..30d15d1 100644 --- a/src/capabilities/simplemd.cpp +++ b/src/capabilities/simplemd.cpp @@ -168,6 +168,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"); @@ -339,7 +340,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; @@ -714,6 +715,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; @@ -819,6 +821,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) { @@ -1109,6 +1115,12 @@ void SimpleMD::start() } } +/////////// 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 472bffd..bde0e7e 100644 --- a/src/capabilities/simplemd.h +++ b/src/capabilities/simplemd.h @@ -130,6 +130,7 @@ static json CurcumaMDJson{ { "Spin", 0 }, { "rmrottrans", 0 }, { "nocenter", false }, + { "COM", false }, { "dump", 50 }, { "print", 1000 }, { "unique", false }, @@ -307,6 +308,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; bool m_wall_render = false; EnergyCalculator* m_interface; RMSDTraj* m_unqiue; diff --git a/src/main.cpp b/src/main.cpp index b1601d7..3fe9f09 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -953,9 +953,11 @@ 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 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 auto charges = interface.Charges(); // dec and init charges mol.setDipole(interface.Dipole() * au);