本文整理汇总了C++中Generator::setTemperature方法的典型用法代码示例。如果您正苦于以下问题:C++ Generator::setTemperature方法的具体用法?C++ Generator::setTemperature怎么用?C++ Generator::setTemperature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Generator
的用法示例。
在下文中一共展示了Generator::setTemperature方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
int MainApplication::run(int argc, char *argv[])
{
Generator generator;
uint structure = 0;
uvec3 nUnitCells;
vec3 unitCellSize;
double interactionLength;
nUnitCells << 12 << endr
<< 12 << endr
<< 12;
double a = 5.72; // Angstrom
unitCellSize << a << endr
<< a << endr
<< a;
unitCellSize /= L0; // converting to MD units
interactionLength = 3.0; // MD units
State state = generator.createCrystal(structure, nUnitCells, unitCellSize, interactionLength);
state.printInfo();
generator.saveStateBox(&state, "state-0000.xyz");
long idum = -1;
double temperature = 5.0; // MD units
generator.setTemperature(&state, temperature, &idum, 1);
double dt = 0.005; // MD units
Integrator integrator(&state);
ostringstream filename;
uint nCycles = 200;
for (uint i = 1; i < 1+nCycles; i++)
{
cout << "Cycle " << i << " of " << nCycles << endl;
integrator.stepForward(dt);
filename.str(string());
filename << "./state-" << setfill('0') << setw(4) << i << ".xyz";
generator.saveStateBox(&state, filename.str());
}
return 0;
}