Database
Class Methods
|
Create a new database instance with the given parameters. |
Return the global database instance if it was initialized, otherwise None. |
|
|
Initialize the global database with the given parameters. |
Class Attributes and Properties
The directory where the databases are stored. |
|
Whether to download missing databases if needed. |
|
Whether to load the Wigner 3j symbols table into memory. |
- class Database[source]
Class for handling the databases for the PairInteraction package.
The Databases are used to store the atomic states, their energies, and their matrix elements to other states. The databases are stored in the user’s cache directory by default, but can be stored in a different directory. When running PairInteraction for the first time, the databases have to be downloaded from the internet (e.g. by explicitly passing download_missing=True to the constructor). Once the databases are downloaded, the user usually does not have to interact with the Database class directly.
- __init__(download_missing=False, use_cache=True, database_dir='')[source]
Create a new database instance with the given parameters.
- Parameters:
download_missing (
bool) – Whether to download missing databases if needed. Default False.use_cache (
bool) – Whether to load the Wigner 3j symbols table into memory. Default True.database_dir (
str|PathLike[str]) – The directory where the databases are stored. Default “”, i.e. use the default directory (the user’s cache directory).
- Return type:
None
- classmethod get_global_database()[source]
Return the global database instance if it was initialized, otherwise None.
- Return type:
- classmethod initialize_global_database(download_missing=False, use_cache=True, database_dir='')[source]
Initialize the global database with the given parameters.
The arguments are the same as for the constructor of this class.
- Return type:
None- Parameters:
download_missing (bool)
use_cache (bool)
database_dir (str | PathLike[str])
- property download_missing: bool
Whether to download missing databases if needed.
- property use_cache: bool
Whether to load the Wigner 3j symbols table into memory.
- property database_dir: Path
The directory where the databases are stored.