abipy.abio.abivar_database package
Submodules
abipy.abio.abivar_database.variables module
- class abipy.abio.abivar_database.variables.lazy_property(func)[source]
Bases:
object
lazy_property descriptor
Used as a decorator to create lazy attributes. Lazy attributes are evaluated on first use.
- 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.- depends_on_dimension(dimname)[source]
True if variable is an array whose shape depends on dimension name dimname.
Args: dimname: String of
Variable
object.
- 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).
- 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
- 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.
- 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
- class abipy.abio.abivar_database.variables.InputVariables[source]
Bases:
OrderedDict
Dictionary storing the variables used by one executable.
- my_characteristics()[source]
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.
- 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>