Esempio n. 1
0
int main() {
    double dt = UnitConverter::timeFromSI(1e-14);

    System system;
    VelocityVerlet *integrator = new VelocityVerlet();
    //EulerCromer *integrator = new EulerCromer();
    system.setIntegrator(integrator);
    system.createFCCLattice(5, UnitConverter::lengthFromAngstroms(5.26), 700.0);
    system.removeMomentum();
    LennardJones *potential = new LennardJones(3.405, 1.);
    system.setPotential(potential);
    StatisticsSampler statisticsSampler;
    Thermostat thermostat(&statisticsSampler, &system);
    thermostat.setThermostat(false);
    Neighbourlists neighbourlist(&system);

    IO *output = new IO();
    output->open((char *)"output.dat");
    IO *movie = new IO();
    movie->open((char *)"movie.xyz");
    movie->saveState(system);
    for(int timestep=0; timestep<1000; timestep++) {
        system.step(dt, thermostat, neighbourlist);
        statisticsSampler.sample(system);
        movie->saveState(system);
        //if(timestep % 10 == 0) {
            output->saveOutput(system, statisticsSampler);
        //}
        if(timestep % 100 == 0) {
            cout << timestep << endl;
        }
    }
    statisticsSampler.getEnergyVariance();
    cout << "The standard deviation of the energy is:" << statisticsSampler.energyTotalVariance << endl;
    movie->close();
    output->close();

    return 0;
}