abics.mc module¶
-
class
abics.mc.CanonicalMonteCarlo(model, kT, config)[source]¶ Bases:
object- Parameters
model (dft_latgas object) – DFT lattice gas mapping model
kT (float) – Temperature
config (config object) – Configuration
-
__init__(model, kT, config)[source]¶ - Parameters
model (dft_latgas object) – DFT lattice gas mapping model
kT (float) – Temperature
config (config object) – Configuration
-
run(nsteps, sample_frequency=9223372036854775807, print_frequency=9223372036854775807, observer=<abics.mc.observer_base object>, save_obs=False)[source]¶ - Parameters
nsteps (int) – The number of Monte Carlo steps for running.
sample_frequency (int) – The number of Monte Carlo steps for observation of physical quantities.
print_frequency (int) – The number of Monte Carlo steps for saving physical quantities.
observer (observer object) –
save_obs (boolean) –
- Returns
obs_decode
- Return type
list
-
abics.mc.args_info(*args)[source]¶ - Parameters
args (list) –
- Returns
args_info
- Return type
numpy array
-
abics.mc.binning(x, nlevels)[source]¶ - Parameters
x (list) – Coordinates
nlevels (int) – Number to determine the number of measurements
- Returns
error_estimate – error estimation
- Return type
list
-
class
abics.mc.grid_1D(dx, minx, maxx)[source]¶ Bases:
object- Parameters
dx (float) – interval
minx (float) – minimum value of x
maxx (float) – maximum value of x
-
class
abics.mc.model[source]¶ Bases:
objectThis class defines a model whose energy equals 0 no matter the configuration, and the configuration never changes. This is a base template for building useful models.
-
energy(config)[source]¶ Calculate energy of configuration: input: config
- Parameters
config (config object) – configuration
-
model_name= None¶
-
newconfig(config, dconfig)[source]¶ Update config by using the trial step, dconfig
- Parameters
config (config object) – Original configuration This may be mutated through this function
dconfig (config object) – Difference of configuration
- Returns
config – updated configuration
- Return type
config object
-
trialstep(config, energy)[source]¶ Define a trial step on config. Returns dconfig, which can contain the minimal information for constructing the trial configuration from config to be used in newconfig(). Make sure that config is unchanged.
- Parameters
config (config object) – configuration
energy (float) – energy
- Returns
dconfig (config object) – The minimal information for constructing the trial configuration from config to be used in newconfig()
dE (float) – Energy diffence
-
-
abics.mc.obs_decode(args_info, obs_array)[source]¶ - Parameters
args_info (numpy array) –
obs_array (numpy array) –
- Returns
args
- Return type
list
-
abics.mc.obs_encode(*args)[source]¶ - Parameters
args (list) –
- Returns
obs_array
- Return type
numpy array
-
class
abics.mc.observer_base[source]¶ Bases:
object-
logfunc(calc_state)[source]¶ - Parameters
calc_state (MonteCarlo algorithm object) – MonteCarlo algorithm
- Returns
calc_state.energy – (Energy)
- Return type
tuple
-
obs_info(calc_state)[source]¶ - Parameters
calc_state (MonteCarlo algorithm object) – MonteCarlo algorithm
- Returns
args_info
- Return type
numpy array
-
observe(calc_state, outputfi, lprint=True)[source]¶ - Parameters
calc_state (MonteCarlo algorithm object) – MonteCarlo algorithm
outputfi (_io.TextIOWrapper) – TextIOWrapper for output
lprint (boolean) – if true, log info is outputted to TextIOWrapper
- Returns
obs_log – log information about observation
- Return type
numpy array
-
-
abics.mc.verylargeint= 9223372036854775807¶ Defines base classes for Monte Carlo simulations