qmlearn.io package

Submodules

qmlearn.io.core module

class qmlearn.io.core.DB(filename, mode='a', **kwargs)[source]

Bases: object

Abstract base class to create and manipulate database

Attributes
group
names

Methods

create_group

get_group

create_group(name, fh=None)[source]
get_group(name, fh=None)[source]
property group
property names

qmlearn.io.hdf5 module

class qmlearn.io.hdf5.DBHDF5(filename, mode='a', qmmol=None)[source]

Bases: object

Class to create and manipulate database in HDF5 format …

Attributes
filenamestr

Filename of database.

Methods

get_all_names([fh, attr])

Return a list of all databases in the database file

get_names([name])

Return a list of database name based on pattern

read_images([name])

Read atomic structure from the database

read_properties(name, **kwargs)

read properties from database file

read_qmmol(name, **kwargs)

read qmmol object from the database

write_images([images, prefix, name])

Write atomic structure in the database

write_properties([properties, prefix, name])

Write properties (i.e.

write_qmmol([qmmol, name])

Write qmmol object in the database

close

close()[source]
get_all_names(fh=None, attr=None)[source]

Return a list of all databases in the database file

Returns
nameslist

return list of all database from the database file

Attributes
fhobj

Filehandler object for database file

mode{‘a’,’r’,’w’} str

mode of operation (i.e. append, read, or write) for the database

get_names(name='*')[source]

Return a list of database name based on pattern

Returns
nameslist

return list of all database from the database file

Attributes
namestr

pattern of database names. Only support ‘*’, ‘?’, ‘[seq]’ and ‘[!seq]’ with fnmatch

property group
property names
property qmmol

Get qmmol object from database

read_images(name=None, **kwargs)[source]

Read atomic structure from the database

Returns
imageslist

List of ASE Atoms objects

Attributes
namestr

name of the database file

read_properties(name, **kwargs)[source]

read properties from database file

Returns
propertiesdict

return properties as dictionary

Attributes
namestr

name of the database file

read_qmmol(name, **kwargs)[source]

read qmmol object from the database

Returns
qmmolobj

return qmmol object from the database

Attributes
namestr

name of the database file

write_images(images=None, prefix='train', name=None, **kwargs)[source]

Write atomic structure in the database

Attributes
imageslist

List of ASE Atoms objects

prefix{‘train’, ‘test’} str

determine wheter to write properties in the training or testing database

namestr

name of the database file

write_properties(properties=None, prefix='train', name=None, **kwargs)[source]

Write properties (i.e. gamma, energy, forces, Vext) to the database

Attributes
propertiesdict

Dictionary of properties calulate with Pyscf, Psi4numpy or any other external engine

prefix{‘train’, ‘test’} str

determine wheter to write properties in the training or testing database

namestr

name of the database file

write_qmmol(qmmol=None, name=None, **kwargs)[source]

Write qmmol object in the database

Attributes
qmmolobj

qmmol object. raise AttributeError if not defined

namestr

name of the database where qmmol will be saved. if not given it will be set to qmmol.method/qmmol

qmlearn.io.model module

qmlearn.io.model.db2qmmodel(filename, names='*', mmodels=None)[source]

Train QMModel to learn \({\gamma}\) in terms of \(V_{ext}\) from training data then an additional layer of training learn \({\delta}E\) and \({\delta}{\gamma}\) based on previously learned \({\gamma}\).

Parameters
filenamestr

Name of database file

namesstr, optional

name of database, by default ‘*’

mmodelsdict, optional

set of machine learning models used for training , If not provided by default KKR will be used to learn gamma and linear regression for delta learning

Returns
modelobj

trained model

Module contents

qmlearn.io.read_images(traj, format=None, nsteps=None)[source]