Skip to content

Commit 243f153

Browse files
Merge pull request #9 from gg27fyla/master
some changes
2 parents 07070b6 + 22fe874 commit 243f153

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

Diff for: src/capabilities/simplemd.cpp

+13-1
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ void SimpleMD::LoadControlJson()
168168
m_T0 = Json2KeyWord<double>(m_defaults, "T");
169169
m_rmrottrans = Json2KeyWord<int>(m_defaults, "rmrottrans");
170170
m_nocenter = Json2KeyWord<bool>(m_defaults, "nocenter");
171+
m_COM = Json2KeyWord<bool>(m_defaults, "COM");
171172
m_dump = Json2KeyWord<int>(m_defaults, "dump");
172173
m_print = Json2KeyWord<int>(m_defaults, "print");
173174
m_max_top_diff = Json2KeyWord<int>(m_defaults, "MaxTopoDiff");
@@ -339,7 +340,7 @@ bool SimpleMD::Initialise()
339340
m_molecule.setCharge(0);
340341
if (!m_nocenter) {
341342
std::cout << "Move stucture to the origin ... " << std::endl;
342-
m_molecule.setGeometry(GeometryTools::TranslateGeometry(m_molecule.getGeometry(), GeometryTools::Centroid(m_molecule.getGeometry()), Position{ 0, 0, 0 }));
343+
m_molecule.Center(m_COM);
343344
} else
344345
std::cout << "Move stucture NOT to the origin ... " << std::endl;
345346

@@ -714,6 +715,7 @@ nlohmann::json SimpleMD::WriteRestartInformation()
714715
restart["gradient"] = Tools::DoubleVector2String(m_gradient);
715716
restart["rmrottrans"] = m_rmrottrans;
716717
restart["nocenter"] = m_nocenter;
718+
restart["COM"] = m_COM;
717719
restart["average_T"] = m_aver_Temp;
718720
restart["average_Epot"] = m_aver_Epot;
719721
restart["average_Ekin"] = m_aver_Ekin;
@@ -819,6 +821,10 @@ bool SimpleMD::LoadRestartInformation(const json& state)
819821
m_nocenter = state["nocenter"];
820822
} catch (json::type_error& e) {
821823
}
824+
try {
825+
m_COM = state["COM"];
826+
} catch (json::type_error& e) {
827+
}
822828
try {
823829
m_T0 = state["T"];
824830
} catch (json::type_error& e) {
@@ -1109,6 +1115,12 @@ void SimpleMD::start()
11091115
}
11101116
}
11111117

1118+
/////////// Dipole calc
1119+
1120+
1121+
1122+
1123+
/////////// Dipole calc
11121124
if (m_step % m_dump == 0) {
11131125
bool write = WriteGeometry();
11141126
if (write) {

Diff for: src/capabilities/simplemd.h

+2
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ static json CurcumaMDJson{
130130
{ "Spin", 0 },
131131
{ "rmrottrans", 0 },
132132
{ "nocenter", false },
133+
{ "COM", false },
133134
{ "dump", 50 },
134135
{ "print", 1000 },
135136
{ "unique", false },
@@ -307,6 +308,7 @@ class SimpleMD : public CurcumaMethod {
307308
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;
308309
int m_rmrottrans = 0, m_rattle_maxiter = 100;
309310
bool m_nocenter = false;
311+
bool m_COM = false;
310312
bool m_wall_render = false;
311313
EnergyCalculator* m_interface;
312314
RMSDTraj* m_unqiue;

Diff for: src/main.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -953,9 +953,11 @@ int main(int argc, char **argv) {
953953
while (!file.AtEnd()) { // calculation and output dipole moment
954954
mol = file.Next(); // load Molecule
955955
mol.Center(false);
956+
956957
EnergyCalculator interface("gfn2", blob); // set method to gfn2-xtb and give
957958
interface.setMolecule(mol); // set molecule for calc
958959
interface.CalculateEnergy(false, true); // calc energy and charges and dipole moment
960+
959961
mol.setPartialCharges(interface.Charges()); // calc Partial Charges and give it to mol
960962
auto charges = interface.Charges(); // dec and init charges
961963
mol.setDipole(interface.Dipole() * au);

0 commit comments

Comments
 (0)