pynitride.core.sim module

class pynitride.core.sim.Simulation(name, define_mesh, solve_flow, mesh_opts={}, solve_opts={}, extras=[], outdir='')

Bases: object

Manages the running/re-loading of a simulation .

Breaks apart a simulation into the “mesh definition” which is a rapid step executed on both running and re-loading of simulations and “solve flow’ which is the slow actual computation.

Various define_mesh functions can be found under pynitride.examples, and various solve_flow functions are built into this class. define_mesh should place meshes and rmeshes into the dmeshes and rmeshes dict, and may place other free-form information into extras. solve_flow functions specify which the necessary keys/content are for these dicts.

Parameters:
  • name – Name for the simulation (becomes part of the relevant filenames)

  • define_mesh – function which defines the mesh, first argument should be this Simulation object)

  • solve_flow – function executes the solve flow, first argument should be this Simulation object)

  • mesh_opts – additional arguments to be passed to define_mesh

  • solve_opts – additional arguments to be passed to solve_flow

  • extras – name of extra objects saved by the solve_flow which should be loaded

  • outdir – directory where to save/read the results

dmeshes

Where the (direct space) meshes are stored.

extras

Where define_mesh provides any further information.

static flow_fixedschrodinger(sim)
static flow_semiclassicalramp(sim, ramp_opts={})

Does a ramp with semiclassical solver.

The main mesh should be dmeshes[‘main’].

Parameters:
  • sim – the Simulation object (ie self)

  • ramp_opts – passed to the ramp_epsfactor()

static flow_semiclassicalramp_mbkp(sim, T=300, Va=0, strain=None, ramp_opts={}, mbkp_opts={}, loop_opts={}, mbkp_loop_opts={})

Does a ramp with semiclassical solver, then swaps in an MBKP solver in dmeshes[‘mbkp’] region.

The main mesh should be dmeshes[‘main’], the quantum region should be dmeshes[‘mbkp’], and the semiclassical region should be dmeshes[‘semi’]. `extras[‘sourcepoint’] should be the interface or z-coordinate (as specified for a LinearFermi contact) of the point in the structure held to zero, eg location of a source-connected carrier gas.

Parameters:
  • sim – the Simulation object (ie self)

  • T – the temperature

  • Va – the applied voltage

  • strain – passed to pynitride.physics.strain.Pseudomorphic

  • ramp_opts – passed to the ramp_epsfactor()

  • mbkp_opts – passed to the MultibandKP solver

  • loop_opts – passed to the self-consistent loop() when called for the ramp

  • mbkp_loop_opts – passed to the self-consistent loop() when called for MBKP

static flow_semiclassicalramp_schrodinger(sim, ramp_opts={}, schro_opts={}, loop_opts={})

Does a ramp with semiclassical solver, then swaps in a schrodinger solver in dmeshes[‘schro’] region.

The main mesh should be dmeshes[‘main’], the schrodinger region should be dmeshes[‘schro’], and the semiclassical region should be dmeshes[‘semi’].

Parameters:
  • sim – the Simulation object (ie self)

  • ramp_opts – passed to the ramp_epsfactor()

  • schro_opts – passed to the Schrodinger solver

  • loop_opts – passed to the self-consistent loop()

load(force=False)

Loads the simulation or re-runs it if not able to find/load.

Parameters:

force – whether to force a fresh run even if a previous one can be found

static loader_standard(sim)

A simple loader for typical names, don’t call directly, use Simulation.load().

name

Name of the simulation.

rmeshes

Where the reciprocal space meshes are stored.