| 1 |
/****************************************************************************** |
| 2 |
This source file is part of the Avogadro project. |
| 3 |
This source code is released under the 3-Clause BSD License, (see "LICENSE"). |
| 4 |
******************************************************************************/ |
| 5 |
|
| 6 |
#ifndef LAMMPSINPUTDIALOG_H |
| 7 |
#define LAMMPSINPUTDIALOG_H |
| 8 |
|
| 9 |
#include "ui_lammpsinputdialog.h" |
| 10 |
|
| 11 |
#include <QHash> |
| 12 |
#include <QtCore/QSettings> |
| 13 |
|
| 14 |
class QJsonObject; |
| 15 |
class QTextEdit; |
| 16 |
|
| 17 |
namespace Avogadro { |
| 18 |
namespace QtGui { |
| 19 |
class Molecule; |
| 20 |
} |
| 21 |
|
| 22 |
namespace QtPlugins { |
| 23 |
class LammpsInputDialog : public QDialog |
| 24 |
{ |
| 25 |
Q_OBJECT |
| 26 |
|
| 27 |
public: |
| 28 |
explicit LammpsInputDialog(QWidget* parent = nullptr, |
| 29 |
Qt::WindowFlags flag = Qt::WindowFlags()); |
| 30 |
~LammpsInputDialog() override; |
| 31 |
|
| 32 |
void readSettings(QSettings&); |
| 33 |
void writeSettings(QSettings&) const; |
| 34 |
|
| 35 |
enum unitType |
| 36 |
{ |
| 37 |
lj, |
| 38 |
real, |
| 39 |
metal, |
| 40 |
si, |
| 41 |
cgs, |
| 42 |
u_electron |
| 43 |
}; |
| 44 |
enum dimensionType |
| 45 |
{ |
| 46 |
d2, |
| 47 |
d3 |
| 48 |
}; |
| 49 |
enum boundaryType |
| 50 |
{ |
| 51 |
p, |
| 52 |
s, |
| 53 |
f, |
| 54 |
m, |
| 55 |
fs, |
| 56 |
fm |
| 57 |
}; |
| 58 |
enum atomStyle |
| 59 |
{ |
| 60 |
angle, |
| 61 |
atomic, |
| 62 |
bond, |
| 63 |
charge, |
| 64 |
dipole, |
| 65 |
a_electron, |
| 66 |
ellipsoid, |
| 67 |
full, |
| 68 |
line, |
| 69 |
meso, |
| 70 |
molecular, |
| 71 |
peri, |
| 72 |
sphere, |
| 73 |
tri, |
| 74 |
wavepacket |
| 75 |
}; |
| 76 |
enum waterPotential |
| 77 |
{ |
| 78 |
NONE, |
| 79 |
SPC, |
| 80 |
SPCE |
| 81 |
}; |
| 82 |
void setMolecule(QtGui::Molecule* molecule); |
| 83 |
enum ensemble |
| 84 |
{ |
| 85 |
NVT, |
| 86 |
NVE |
| 87 |
}; |
| 88 |
enum velocityDist |
| 89 |
{ |
| 90 |
gaussian, |
| 91 |
uniform |
| 92 |
}; |
| 93 |
enum thermoStyle |
| 94 |
{ |
| 95 |
one, |
| 96 |
multi |
| 97 |
}; |
| 98 |
|
| 99 |
protected: |
| 100 |
/** |
| 101 |
* Reimplemented to update the dialog when it is shown |
| 102 |
*/ |
| 103 |
void showEvent(QShowEvent* event) override; |
| 104 |
|
| 105 |
private: |
| 106 |
Ui::LammpsInputDialog ui; |
| 107 |
QtGui::Molecule* m_molecule; |
| 108 |
|
| 109 |
// QString m_title; |
| 110 |
QString m_readData; |
| 111 |
unitType m_unitType; |
| 112 |
QString m_title; |
| 113 |
QString m_savePath; |
| 114 |
dimensionType m_dimensionType; |
| 115 |
boundaryType m_xBoundaryType; |
| 116 |
boundaryType m_yBoundaryType; |
| 117 |
boundaryType m_zBoundaryType; |
| 118 |
atomStyle m_atomStyle; |
| 119 |
waterPotential m_waterPotential; |
| 120 |
|
| 121 |
// coordType m_coordType; |
| 122 |
ensemble m_ensemble; |
| 123 |
double m_temperature; |
| 124 |
int m_nhChain; |
| 125 |
double m_timeStep; |
| 126 |
int m_runSteps; |
| 127 |
int m_xReplicate; |
| 128 |
int m_yReplicate; |
| 129 |
int m_zReplicate; |
| 130 |
QString m_dumpXYZ; |
| 131 |
int m_dumpStep; |
| 132 |
velocityDist m_velocityDist; |
| 133 |
double m_velocityTemp; |
| 134 |
bool m_zeroMOM; |
| 135 |
bool m_zeroL; |
| 136 |
thermoStyle m_thermoStyle; |
| 137 |
int m_thermoInterval; |
| 138 |
|
| 139 |
QString m_output; |
| 140 |
bool m_dirty; |
| 141 |
bool m_warned; |
| 142 |
bool readData; |
| 143 |
|
| 144 |
QTextEdit* m_jobEdit; |
| 145 |
QTextEdit* m_moleculeEdit; |
| 146 |
QString m_moleculeFileName; |
| 147 |
QString m_jobFileName; |
| 148 |
|
| 149 |
// Generate an input deck as a string |
| 150 |
QString generateInputDeck(); |
| 151 |
QString getUnitType(unitType t); |
| 152 |
QString getAtomStyle(atomStyle t); |
| 153 |
QString getDimensionType(dimensionType t); |
| 154 |
QString getXBoundaryType(boundaryType t); |
| 155 |
QString getYBoundaryType(boundaryType t); |
| 156 |
QString getZBoundaryType(boundaryType t); |
| 157 |
QString getWaterPotential(waterPotential t); |
| 158 |
QString getEnsemble(ensemble t); |
| 159 |
QString getVelocityDist(velocityDist t); |
| 160 |
QString getZeroMOM(); |
| 161 |
QString getZeroL(); |
| 162 |
QString getThermoStyle(thermoStyle t); |
| 163 |
// Translate enums to strings |
| 164 |
// QString getCalculationType(calculationType t); |
| 165 |
// QString getWavefunction(void); |
| 166 |
// QString getTheoryType(theoryType t); |
| 167 |
// QString getBasisType(basisType t); |
| 168 |
|
| 169 |
// Enable/disable form elements |
| 170 |
void deckDirty(bool); |
| 171 |
void determineAtomTypesSPC(int& hyd, int& oxy); |
| 172 |
void addMoleculeDataTab(); |
| 173 |
|
| 174 |
// system typing |
| 175 |
QHash<QString, int> AtomType; |
| 176 |
QHash<QString, double> AtomMass; |
| 177 |
QHash<QString, double>::iterator itr; |
| 178 |
|
| 179 |
public Q_SLOTS: |
| 180 |
void updatePreviewText(); |
| 181 |
|
| 182 |
private Q_SLOTS: |
| 183 |
//! Button Slots |
| 184 |
void textEditModified(); |
| 185 |
void resetClicked(); |
| 186 |
void generateClicked(); |
| 187 |
void enableFormClicked(); |
| 188 |
|
| 189 |
void setTitle(); |
| 190 |
void setReadData(); |
| 191 |
|
| 192 |
void setUnits(int); |
| 193 |
void setAtomStyle(int); |
| 194 |
void setDimensionType(int); |
| 195 |
void setXBoundaryType(int); |
| 196 |
void setYBoundaryType(int); |
| 197 |
void setZBoundaryType(int); |
| 198 |
|
| 199 |
void setWaterPotential(int); |
| 200 |
|
| 201 |
void setEnsemble(int); |
| 202 |
void setTemperature(double); |
| 203 |
void setNHChain(int); |
| 204 |
|
| 205 |
void setTimeStep(double); |
| 206 |
void setRunSteps(int); |
| 207 |
void setXReplicate(int); |
| 208 |
void setYReplicate(int); |
| 209 |
void setZReplicate(int); |
| 210 |
void setDumpXYZ(); |
| 211 |
void setDumpStep(int); |
| 212 |
|
| 213 |
void setVelocityDist(int); |
| 214 |
void setVelocityTemp(double); |
| 215 |
void setZeroMOM(bool); |
| 216 |
void setZeroL(bool); |
| 217 |
void setThermoStyle(int); |
| 218 |
void setThermoInterval(int); |
| 219 |
}; |
| 220 |
} // namespace QtPlugins |
| 221 |
} // namespace Avogadro |
| 222 |
|
| 223 |
#endif |