Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cp2kinput improvements #1702

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions avogadro/qtplugins/cp2kinput/cp2kinputdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ QString Cp2kInputDialog::generateJobTitle() const
// Merge theory/basis into theory
// replace(QRegExp("\\s+"), "");

return QString("%1 | %2 | %3").arg(formula, calculation, basis);
return QString("%1_%2_%3").arg(formula, calculation, basis);
}

void Cp2kInputDialog::updatePreviewText()
Expand Down Expand Up @@ -654,7 +654,7 @@ void Cp2kInputDialog::updatePreviewText()

switch (method) {
case DFT:
gmethod = "DFT";
gmethod = "QS";
break;
case MolecularMechanics:
gmethod = "FIST";
Expand Down Expand Up @@ -756,7 +756,8 @@ void Cp2kInputDialog::updatePreviewText()
file += "&FORCE_EVAL\n";

file += QString(" METHOD %1\n").arg(gmethod);
file += "&END FORCE_EVAL\n";

file += " &SUBSYS\n";

if (m_molecule) {
std::vector<unsigned int> atomList;
Expand All @@ -782,6 +783,7 @@ void Cp2kInputDialog::updatePreviewText()
file += QString(" POTENTIAL GTH-%1-q%2\n")
.arg(gfunc)
.arg(valencee[symbol]);
file += QString(" &END KIND\n");
}
}
}
Expand Down Expand Up @@ -811,10 +813,12 @@ void Cp2kInputDialog::updatePreviewText()
file += " A 10.00000000 0.000000000 0.000000000\n";
file += " B 0.000000000 10.00000000 0.000000000\n";
file += " C 0.000000000 0.000000000 10.00000000\n";
file += " PERIODIC NONE\n";
}
file += " &END CELL \n";
file += " &END CELL\n";

if (m_molecule) {
file += " &COORD\n";
for (size_t i = 0; i < m_molecule->atomCount(); ++i) {
Core::Atom atom = m_molecule->atom(i);
file += QString(" %1 %2 %3 %4\n")
Expand All @@ -823,8 +827,12 @@ void Cp2kInputDialog::updatePreviewText()
.arg(atom.position3d().y(), 9, 'f', 5)
.arg(atom.position3d().z(), 9, 'f', 5);
}
file += " &END COORD\n";
}
if (gmethod == "DFT") {

file += " &END SUBSYS\n";

if (gmethod == "QS") {
file += " &DFT\n";
file += " BASIS_SET_FILE_NAME BASIS_SET\n";
file += " POTENTIAL_FILE_NAME GTH_POTENTIALS\n";
Expand Down Expand Up @@ -857,7 +865,7 @@ void Cp2kInputDialog::updatePreviewText()
file += " &END SCF\n";

file += " &XC\n";
file += QString(" &XC_FUNCTIONAL %1\n").arg(functional);
file += QString(" &XC_FUNCTIONAL %1\n").arg(gfunc);
file += " &END XC_FUNCTIONAL\n";
file += " &END XC\n";

Expand Down Expand Up @@ -914,6 +922,7 @@ void Cp2kInputDialog::updatePreviewText()
}

file += " $END\n";
file += "&END FORCE_EVAL\n";

ui.previewText->setText(file);
ui.previewText->document()->setModified(false);
Expand Down
Loading