abipy.abio.abivar_database package

Submodules

abipy.abio.abivar_database.variables module

abipy.abio.abivar_database.variables.is_string(s)[source]

True if s behaves like a string (duck typing test).

abipy.abio.abivar_database.variables.list_strings(arg)[source]

Always return a list of strings, given a string or list of strings as input.

Examples:

>>> list_strings('A single string')
['A single string']
>>> list_strings(['A single string in a list'])
['A single string in a list']
>>> list_strings(['A','list','of','strings'])
['A', 'list', 'of', 'strings']
abipy.abio.abivar_database.variables.splitall(path)[source]

Return list with all components of a path.

class abipy.abio.abivar_database.variables.Variable(abivarname=None, varset=None, vartype=None, topics=None, dimensions=None, defaultval=None, mnemonics=None, characteristics=None, excludes=None, requires=None, commentdefault=None, commentdims=None, added_in_version=None, alternative_name=None, text=None)[source]

Bases: object

This object gathers information about a single variable. name, associated topics, description etc It’s constructed from the variables_CODENANE.py modules but client code usually interact with variables via the VarDatabase dictionary.

property name

Name of the variable without the executable name.

property executable

string with the name of the code associated to this variable.

property website_url

The absolute URL associated to this variable on the Abinit website.

property topic2relevances: dict

topic –> list of tribes

property is_internal

True if this is an internal variable.

Abinit wikilink.

to_string(verbose=0)[source]

String representation with verbosity level verbose.

property info

String with extra info on the variable.

browse()[source]

Open variable documentation in browser.

property isarray

True if this variable is an array.

depends_on_dimension(dimname)[source]

True if variable is an array whose shape depends on dimension name dimname.

Args: dimname: String of Variable object.

String with the URL of the web page.

get_parent_names()[source]

Return set of strings with the name of the parents i.e. the variables that are connected to this variable (either because they are present in dimensions on in requires).

String with the website internal URL.

static format_dimensions(dimensions)[source]

Pretty print dimensions.

to_abimarkdown(with_hr=True)[source]

Return markdown string Can use Abinit markdown extensions.

validate()[source]

Validate variable. Raises ValueError if not valid.

class abipy.abio.abivar_database.variables.ValueWithUnit(value=None, units=None)[source]

Bases: object

This type allows to specify values with units:

class abipy.abio.abivar_database.variables.Range(start=None, stop=None)[source]

Bases: object

Specifies a range (start:stop:step)

start = None
stop = None
isin(value)[source]

True if value is in range.

class abipy.abio.abivar_database.variables.ValueWithConditions[source]

Bases: dict

Used for variables whose value depends on a list of conditions.

class abipy.abio.abivar_database.variables.MultipleValue(number=None, value=None)[source]

Bases: object

Used for variables that can assume multiple values. This is the equivalent to the X * Y syntax in the Abinit parser. If X is null, it means that you want to do *Y (all Y)

abipy.abio.abivar_database.variables.my_unicode(s)[source]

Convert string to unicode (needed for py2.7 DOH!)

abipy.abio.abivar_database.variables.get_codevars()[source]

Return the database of variables indexed by code name and cache it. Main entry point for client code.

class abipy.abio.abivar_database.variables.VarDatabase[source]

Bases: OrderedDict

This object stores the full set of input variables for all the Abinit executables. in a dictionary mapping the name of the code to a subdictionary of variables.

all_characteristics = ['DEVELOP', 'EVOLVING', 'ENERGY', 'INPUT_ONLY', 'INTERNAL_ONLY', 'LENGTH', 'MAGNETIC_FIELD', 'NO_MULTI']
all_external_params = {'AUTO_FROM_PSP': 'Means that the value is read from the PSP file', 'CUDA': 'True if CUDA is enabled (compilation)', 'ETSF_IO': 'True if ETSF_IO is enabled (compilation)', 'FFTW3': 'True if FFTW3 is enabled (compilation)', 'MPI_IO': 'True if MPI_IO is enabled (compilation)', 'NPROC': 'Number of processors used for Abinit', 'PARALLEL': 'True if the code is compiled with MPI', 'SEQUENTIAL': 'True if the code is compiled without MPI'}
classmethod from_pyfiles(dirpath=None)[source]

Initialize the object from python modules inside dirpath. If dirpath is None, the directory of the present module is used.

iter_allvars()[source]

Iterate over all variables. Flat view.

get_version_endpoints()[source]

API used by the webser to serve the documentation of a variable given codename, varname, [version]:

docs.abinit.org/vardocs/abinit/asr?version=8.6.2

# asr@anaddb at /variables/anaddb#asr # asr@abinit at /variables/eph#asr # asr@abinit at /variables/abinit/eph#asr

update_json_endpoints(json_path, indent=4)[source]

Update the json file with the mapping varname –> relative url used by the webserve to implement the vardocs API.

class abipy.abio.abivar_database.variables.InputVariables[source]

Bases: OrderedDict

Dictionary storing the variables used by one executable.

classmethod from_pyfile(filepath)[source]

Initialize the object from python file.

property my_varset_list

Set with the all the varset strings found in the database.

property name2varset

Dictionary mapping the name of the variable to the varset section.

property my_characteristics

Set with all characteristics found in the database. NB [] are removed from the string.

get_all_vnames(with_internal=False)[source]

Return set with all the variable names including possible aliases.

groupby_first_letter()[source]

Return ordered dict mapping first_char –> list of variables.

get_vartabs_html(website, page_rpath)[source]

Return HTML string with all the variabes in tabular format.

group_by_varset(names)[source]

Group a list of variable in sections.

Parameters:

names – string or list of strings with ABINIT variable names.

Returns:

Ordered dict mapping section_name to the list of variable names belonging to the section. The dict uses the same ordering as those in self.sections

apropos(varname)[source]

Return the list of Variable objects that are related` to the given varname

vars_with_varset(sections)[source]

List of Variable associated to the given sections. sections can be a string or a list of strings.

vars_with_char(chars)[source]

Return list of Variable with the specified characteristic. chars can be a string or a list of strings.

get_graphviz_varname(varname, engine='automatic', graph_attr=None, node_attr=None, edge_attr=None)[source]

Generate task graph in the DOT language (only parents and children of this task).

Parameters:
  • varname – Name of the variable.

  • engine – [‘dot’, ‘neato’, ‘twopi’, ‘circo’, ‘fdp’, ‘sfdp’, ‘patchwork’, ‘osage’]

  • graph_attr – Mapping of (attribute, value) pairs for the graph.

  • node_attr – Mapping of (attribute, value) pairs set for all nodes.

  • edge_attr – Mapping of (attribute, value) pairs set for all edges.

Returns: graphviz.Digraph <https://graphviz.readthedocs.io/en/stable/api.html#digraph>

get_graphviz(varset=None, vartype=None, engine='automatic', graph_attr=None, node_attr=None, edge_attr=None)[source]

Generate graph in the DOT language (only parents and children of this task).

Parameters:
  • varset – Select variables with this varset. Include all if None

  • vartype – Select variables with this vartype. Include all

  • engine – [‘dot’, ‘neato’, ‘twopi’, ‘circo’, ‘fdp’, ‘sfdp’, ‘patchwork’, ‘osage’]

  • graph_attr – Mapping of (attribute, value) pairs for the graph.

  • node_attr – Mapping of (attribute, value) pairs set for all nodes.

  • edge_attr – Mapping of (attribute, value) pairs set for all edges.

Returns: graphviz.Digraph <https://graphviz.readthedocs.io/en/stable/api.html#digraph>

abipy.abio.abivar_database.variables_abinit module

abipy.abio.abivar_database.variables_aim module

abipy.abio.abivar_database.variables_anaddb module

abipy.abio.abivar_database.variables_atdep module

abipy.abio.abivar_database.variables_multibinit module

abipy.abio.abivar_database.variables_optic module