asedb package
Submodules
asedb.abstract module
- class asedb.abstract.ArrayType(*args: Any, **kwargs: Any)[source]
Bases:
TypeDecoratorCustom type for saving/loading NumPy arrays.
- compare_values(x: Any, y: Any) bool[source]
Given two values, compare them for equality.
By default this calls upon
TypeEngine.compare_values()of the underlying “impl”, which in turn usually uses the Python equals operator==.This function is used by the ORM to compare an original-loaded value with an intercepted “changed” value, to determine if a net change has occurred.
- impl
alias of
LargeBinary
- class asedb.abstract.NamedArray(**kwargs: Any)[source]
Bases:
BaseBase table object for storing a NumPy array along with a name and some metadata.
- classmethod from_np_array(name: str, array: ndarray) T_Arr[source]
Construct an instance of the NamedArray model from a NumPy array.
- set_array(array: ndarray | Cell) None[source]
Update the blob representing a NumPy array. The array will be serialized to a binary blob using the NumPy save function.
Note: Arbitrary Python objects are not allowed, as Pickle serialization is disabled by default for security purposes. Change the asedb.abstract.ALLOW_PICKLE variable to True to allow pickle serialization.
asedb.atoms_model module
- class asedb.atoms_model.AtomsArray(**kwargs)[source]
Bases:
NamedArray
- class asedb.atoms_model.AtomsModel(**kwargs)[source]
Bases:
BaseThe primary class representing the SQLAlchemy model for an ASE Atoms object.
The main usage will be something like
atoms = ase.Atoms(...) model = AtomsModel.from_atoms(atoms) session.add(model) session.commit() # Load the model from the database loaded = session.query(AtomsModel).first().to_atoms()
The AtomsModel will also serialize a calculator object into a
Calculationif a calculator exists.- arrays: Mapped[list[AtomsArray]]
- calculation: Mapped[Calculation]
- classmethod from_atoms(atoms: Atoms, import_calculation: bool = True, project: None | str = None) AtomsModel[source]
Helper method to instantiate an AtomsModel instance from an ASE Atoms object.
- Parameters:
- Returns:
The newly instantiated AtomsModel.
- Return type:
- set_atoms(atoms: Atoms, import_calculation: bool = True) None[source]
Read the current Atoms configurations, including the calculator, and save the state in the current AtomsModel instance.
If import_calculation is True, then the calculator object will also be serialized into a Calculation object, otherwise the calculator will be ignored.
- to_atoms() Atoms[source]
Export the SQL Alchemy object as an ASE Atoms object. If a corresponding
Calculationobject exists, a SinglePointCalculator will be attached to the constructed Atoms object.
- class asedb.atoms_model.CalcArray(**kwargs)[source]
Bases:
NamedArray
- class asedb.atoms_model.Calculation(**kwargs)[source]
Bases:
BaseThe serialization of an ASE Calculator.
- classmethod from_calc(calc: Calculator) Calculation[source]
Construct a Calculation object from an ASE Calculator. Extracts the following properties: As floats:
energy
free_energy
magmom
As arrays:
forces
stress
stresses
charges
magmoms
asedb.initialization module
asedb.properties module
asedb.time_utils module
asedb.trajectory_model module
- class asedb.trajectory_model.Trajectory(**kwargs)[source]
Bases:
Base- add_atoms(atoms: Atoms) AtomsModel[source]
Add an Atoms object to the Trajectory. Returns the newly created AtomsModel instance, which belongs to the trajectory.
- atoms_list: Mapped[list[AtomsModel]]
asedb.utils module
asedb.version module
Module contents
- class asedb.AtomsModel(**kwargs)[source]
Bases:
BaseThe primary class representing the SQLAlchemy model for an ASE Atoms object.
The main usage will be something like
atoms = ase.Atoms(...) model = AtomsModel.from_atoms(atoms) session.add(model) session.commit() # Load the model from the database loaded = session.query(AtomsModel).first().to_atoms()
The AtomsModel will also serialize a calculator object into a
Calculationif a calculator exists.- arrays: Mapped[list[AtomsArray]]
- calculation: Mapped[Calculation]
- classmethod from_atoms(atoms: Atoms, import_calculation: bool = True, project: None | str = None) AtomsModel[source]
Helper method to instantiate an AtomsModel instance from an ASE Atoms object.
- Parameters:
- Returns:
The newly instantiated AtomsModel.
- Return type:
- set_atoms(atoms: Atoms, import_calculation: bool = True) None[source]
Read the current Atoms configurations, including the calculator, and save the state in the current AtomsModel instance.
If import_calculation is True, then the calculator object will also be serialized into a Calculation object, otherwise the calculator will be ignored.
- to_atoms() Atoms[source]
Export the SQL Alchemy object as an ASE Atoms object. If a corresponding
Calculationobject exists, a SinglePointCalculator will be attached to the constructed Atoms object.
- class asedb.Calculation(**kwargs)[source]
Bases:
BaseThe serialization of an ASE Calculator.
- classmethod from_calc(calc: Calculator) Calculation[source]
Construct a Calculation object from an ASE Calculator. Extracts the following properties: As floats:
energy
free_energy
magmom
As arrays:
forces
stress
stresses
charges
magmoms
- class asedb.Trajectory(**kwargs)[source]
Bases:
Base- add_atoms(atoms: Atoms) AtomsModel[source]
Add an Atoms object to the Trajectory. Returns the newly created AtomsModel instance, which belongs to the trajectory.
- atoms_list: Mapped[list[AtomsModel]]