nextnanoevo.IO module

Defines the nextnanoevo.IO (input-output) class for interfacing with nextnano simulations.

class nextnanoevo.IO.IO(input_file_path: str, variable_names: list, target_output_paths: list)

Bases: object

A class to represent a Nextnano simulation problem. Interface between the input file, variables under optimization and output datafiles used for metric.

Parameters:
input_file_pathstr

The path to nextnano input file.

variable_nameslist of str

A list of variable names to be used in the simulation.

target_output_pathslist of list or tuple

A nested list or tuple containing paths to the target output files.

  • Example one output: [(‘bias_00000’, ‘potential.dat’)]

  • Example 2 ouptuts: [ (‘bias_00000’, ‘potential.dat’), (‘Structure’, ‘AlloyConcentration.dat’)]

Attributes:
input_file_pathstr

The input file for the Nextnano simulation.

input_variable_nameslist of str

A list of variable names to be used in the simulation.

target_outputlist of list or tuple

A nested list or tuple containing paths to the target output files.

  • Example one output: [(‘bias_00000’, ‘potential.dat’)]

  • Example 2 ouptuts: [ (‘bias_00000’, ‘potential.dat’), (‘Structure’, ‘AlloyConcentration.dat’)]

_execute_kwargsdict

A dictionary of keyword arguments to be passed to the execute method of the input file.

number_of_output_targetsint

Returns the number of target output paths.

number_of_input_variablesint

Returns the number of input variable names.

Methods

get_datafiles_from_datafolder(datafolder)

Retrieves the data files from the specified datafolder.

get_target()

Retrieves the target value from the simulation output.

run_simulation(input_variable_values[, ...])

Runs the Nextnano simulation with the specified input variable values.

validate_variable_names()

Validates the input variable names against the variables in the input file.

Raises:
ValueError

If input variables are invalid or if the length of input_variable_values does not match the length of input_variable_names.

get_datafiles_from_datafolder(datafolder: DataFolder)

Retrieves the data files from the specified datafolder.

get_target() list[DataFile]

Retrieves the target value from the simulation output.

property number_of_input_variables: int
property number_of_output_targets: int
property output_datafiles: list[DataFile]

Retrieves the data files from the target output paths.

Raises:
RuntimeError

If the input file has not been executed before calling output_datafiles.

run_simulation(input_variable_values: tuple, input_dir_path=None) dict

Runs the Nextnano simulation with the specified input variable values.

Raises:
ValueError

If the length of input_variable_values does not match the length of input_variable_names.

validate_variable_names() None

Validates the input variable names against the variables in the input file.

Raises:
ValueError

If an input variable name is not found in the input file or if the length of input_variable_values does not match the length of input_variable_names.