mammos_spindynamics.uppasd#
Module for interfacing with UppASD.
- class mammos_spindynamics.uppasd.MammosUppasdData(out)[source]#
Collection of UppASD Result instances.
Initialize MammosUppasdData given the directory containing all runs.
- Parameters:
out (pathlib.Path | str)
- class mammos_spindynamics.uppasd.RunData(out)[source]#
UppASD Data parser class for a single run.
Initialize Data given the output directory of a single run.
- Parameters:
out (pathlib.Path)
- property Cv: mammos_entity.Entity#
Get specific heat capacity.
- property E: mammos_entity.Entity#
Get energy.
- property Ms: mammos_entity.Entity#
Get Spontaneous Magnetization.
- class mammos_spindynamics.uppasd.Simulation(inpsd=None, **kwargs)[source]#
Class to perform UppASD simulations.
Simulations can be performed without or with existing inpsd.dat file:
If no inpsd.dat file is passed the simulation object will use an internal template to create a new inpsd.dat file. This template requires a number of parameters, which have to be passed by the user either when creating the simulation object, or when calling
run()ortemperature_sweep(). A list of required parameters can be obtained fromrequired_parameters().If an inpsd.dat file is passed most of its lines can be modified by passing a new value for a parameters as keyword argument. It is not possible to overwrite
ip_mcanneal.
Create a new simulation object with an inpsd.dat file and/or parameters.
- Parameters:
inpsd (Path | str | None) – Optional path to an existing inpsd.dat file. If not passed a default template defined in the Simulation class is used.
kwargs – Parameters to use (or overwrite when passing inpsd) in inpsd.dat. Parameters can also be passed when calling
Simulation.run()orSimulation.temperature_sweep().
- property allowed_parameters#
UppASD inpsd parameters that can be passed without a custom inpsd file.
- create_input_files(**kwargs)[source]#
Create input files required for UppASD: inpsd.dat and auxilary files.
This method creates the content for inpsd.dat and collects auxiliary files posfile, momfile, exchange, and optionally restartfile. Other external files are not supported.
If no custom inpsd.dat file is used, a predefined template will be used. The user has to pass all required template arguments either at object creation time or when calling this method. A list of required arguments can be obtained from
Simulation.required_parameters().If a custom inpsd.dat file is used, the user has the option to overwrite lines in that input files by passing the respective keys and new values. Not all options in inpsd.dat are currently supported, in particular ip_mcanneal cannot be used.
The auxiliary files have hard-coded names in inpsd.dat, when passing a custom inpsd.dat the corresponding lines will be modified (trailing comments are lost). The dict returned as second object maps names used in the inpsd.dat file to original file paths.
- property required_parameters#
UppASD inpsd parameters that must be passed without a custom inpsd file.
- run(out, description='', uppasd_executable='uppasd', verbosity=1, **kwargs)[source]#
Run a single UppASD simulation.
This method creates inputs required for UppASD in a new directory, runs UppASD in that directory and returns an object that allows accessing the resulting data.
- Parameters:
out (str | Path) – Base directory in which the output is stored. The method will create a subdirectory
<index>-runinside that directory. The value of<index>depends on the existing directory content. For empty directories<index>=0. Otherwise, the method will search for all existing<some-index>-runand<some-index>-temperature_sweepdirectories and use the next index.description (str) – Human-readable description of this simulation run, stored as metadata.
uppasd_executable (str | Path) – Name or path to UppASD executable. If provided a name the method will search for the executable on PATH.
verbosity (int) –
Verbosity of the run:
0: no output
1: summary line with status information (output directory, runtime)
kwargs –
UppASD arguments to use in the inpsd.dat file, including paths to files for momfile, posfile, and exchange. Further details are explained in
Simulation.create_input_files().In addition a special argument
Tis supported, which will be used to set bothip_tempandtemp. Passing bothTand (at least) one ofip_temportempis not supported.Parameters passed to run instead of at object creation time are recorded as separate metadata and can be used later on to conveniently retrieve simulation results.
- Returns:
An object to access UppASD outputs.
- Return type:
- temperature_sweep(T, out, restart_with_previous=True, description='', uppasd_executable='uppasd', verbosity=2, **kwargs)[source]#
Run temperature sweep.
This method runs consecutive simulations for multiple temperatures. For each temperature it will call
Simulation.run()internally. The method does not sort the temperatures, so make sure you pass the desired order, in particular when using restart_with_previous=True.After finishing all simulations two additional files M(T) and output.csv with aggregated simulation results are created.
- Parameters:
T (Iterable[Real]) – Temperatures in Kelvin to run the simulation for. The value will be used for both
ip_tempandtemp.out (str | Path) – Base directory for the output. A new directory
<index>-temperature_sweepwill be created inside, the logic is equivalent toSimulation.run().restart_with_previous (bool) – If set to True use the restart file from the previous run as initial configuration for all but the first run in the sweep.
description (str) – Human-readable description of the sweep, the individual runs do not have a description.
uppasd_executable (str | Path) – Name or path to UppASD executable, like in
Simulation.run().verbosity (int) –
Verbosity of the sweep:
0: no output
1: only summary output for the whole sweep (number and list of temperatures)
2: summary for the sweep and summary for each run (verbosity 1 for each run)
kwargs – UppASD arguments in inpsd.dat as in
Simulation.run(). The two optionsip_tempandtempcannot be used as insteadTis required.
- Returns:
An object to access UppASD outputs.
- Return type:
- class mammos_spindynamics.uppasd.TemperatureSweepData(out)[source]#
Class for the result of the temperature_array runner.
Initialize TemperatureSweepData given the output directory of a sweep run.
- Parameters:
out (pathlib.Path | str)
- property Cv: mammos_entity.Entity#
Get Isochoric Heat Capacity.
The isochorich (at constant volume) heat capacity Cv is evaluated as the derivative of the energy as a function of temperature.
- property E: mammos_entity.Entity#
Get Energy.
- property Ms: mammos_entity.Entity#
Get Spontaneous Magnetization.
- property T: mammos_entity.Entity#
Get Thermodynamics Temperature.
- property U_binder: numpy.ndarray#
Get Binder coefficient.
- get(**kwargs)[source]#
Select run satisfying certain filters defined in the keyword arguments.
If there are multiple matches, it returns the first one.
- Return type:
- info(include_description=True, include_time_elapsed=True, include_parameters=True)[source]#
Dataframe containing information about all available UppASD runs.
- Parameters:
- Return type: