Database storage class
The Database class handles the connection to the database. It has functions to create new Minima and TransitionState objects. The objects are persistent in the database and exist as soon as the Database class in connected to the database. If any value in the objects is changed, the changes are automatically persistent in the database (TODO: be careful, check commit transactions, ...)
Database uses SQLAlchemy to connect to the database. Check the web page for available connectors. Unless you know better, the standard sqlite should be used. The database can be generated in memory (default) or written to a file if db is specified when creating the class.
Parameters : | db : string, optional
accuracy : float, optional
connect_string : string, optional
compareMinima : callable, bool = compareMinima(min1, min2), optional
createdb : boolean, optional
|
---|
See also
Examples
>>> from pele.storage import Database
>>> db = Database(db="test.db")
>>> for energy in np.random.random(10):
>>> a.addMinimum(energy, np.random.random(10))
>>>
>>> for minimum in database.minima():
>>> print minimum.energy
Attributes
engine | (sqlalchemy database engine) |
session | (sqlalchemy session) |
accuracy | (float) |
on_minimum_removed | (signal) called when a minimum is removed from the database |
on_minimum_added | (signal) called when a new, unique, minimum is added to the database |
on_ts_removed | (signal) called when a transition_state is removed from the database |
on_ts_added | (signal) called when a new, unique, transition state is added to the database |
compareMinima |
Methods
addMinimum(E, coords[, commit, ...]) | add a new minimum to database |
addTransitionState(energy, coords, min1, min2) | Add transition state object |
add_properties(properties[, overwrite]) | add multiple properties from a dictionary |
add_property(name, value[, dtype, commit, ...]) | add a system property to the database |
findMinimum(E, coords) | |
getMinimum(mid) | return the minimum with a given id |
getTransitionState(min1, min2) | return the TransitionState between two minima |
getTransitionStateFromID(id_) | return the transition state with id id_ |
getTransitionStatesMinimum(min1) | return all transition states connected to a minimum |
get_lowest_energy_minimum() | return the minimum with the lowest energy |
get_property(property_name) | return the minimum with a given name |
mergeMinima(min1, min2) | merge two minima in the database |
minima([order_energy]) | return an iterator over all minima in database |
minimum_adder([Ecut, max_n_minima, ...]) | wrapper class to add minima |
number_of_minima() | return the number of minima in the database |
number_of_transition_states() | return the number of transition states in the database |
properties([as_dict]) | |
removeMinimum(m[, commit]) | remove a minimum from the database |
remove_transition_state(ts[, commit]) | remove a transition states from the database |
transition_states([order_energy]) | return an iterator over all transition states in database |