Interface for Monte Carlo module

Description

The objective of this issue is to develop a use case/user interface for the Monte Carlo module.

Monte Carlo simulation

from icet import ClusterExpansion
from icet.mchammer import CanonicalEnsemble
from icet.mchammer.observers import (SnapShooter,
                                     ShortRangeOrder)

# set up Monte Carlo simulation
ce = ClusterExpansion.read('mymodel.icet')
atoms = ce.primitive_structure.repeat(4)
mc = CanonicalEnsemble(atoms, calculator=ce, temperature=500.0, data_container='myrun.mc')

# attach a trajectory/configuration to store snapshots
obs = SnapShooter(interval=100)
mc.attach_observer(obs, tag='snapshooter')

# attach SRO calculator
obs = ShortRangeOrderCalculator(mode='Warren-Cowley', interval=10)
mc.attach_observer(obs, tag='sro')

# run MC
mc.run(steps=15000)

# example for temperature loop
for temperature in range(1000, 100, -10):
    mc.reset_data_container()
    mc.temperature = temperature
    mc.run(steps=15000)

Data container

The MC simulation should own a DataContainer object, which holds the main output from the simulation (excluding the trajectory).

from icet.mchammer import DataContainer

container = DataContainer.read('myrun.mc')
data = container.get_properties(['mcstep', 'energy', 'temperature', 'sro1'],
                                interval=..., filter=...)
print(data)
>> [[0, -100.0, 500.0, 0.1],
    [10, -99.1, 500.0, 0.2],
    [20, -98.7, 500.0, 0.15],
    ...
    [1000, -99.8, 500.0, -0.4]]
Edited by Paul Erhart