qmlearn.model package

Submodules

qmlearn.model.build module

qmlearn.model.model module

class qmlearn.model.model.MQMModel(mmodels=None, method='gamma', ncharge=None, nspin=1, occs=None, refqmmol=None, fragments=None, qmmodels=None, **kwargs)[source]

Bases: qmlearn.model.model.QMModel

Attributes
fragments
method
model
qmmodels
refqmmol

Methods

convert_back(y[, prop, qmmol])

Convert back the predicted properties to the original reference frame of the molecule

fit(X, y[, model, method])

Fit model

predict(x[, method, convert, split])

Predict using trained QMModel

translate_input(x[, convert])

Return external potential \(V_{ext}\) from x.

get_block_vext

orth_orb

predict_block

property fragments
get_block_vext(qmmol, convert=True, **kwargs)[source]
predict(x, method=None, convert=True, split=True, **kwargs)[source]

Predict using trained QMModel

Parameters
xarray

Training data

method{‘gamma’, ‘d_gamma’, ‘d_energy’, ‘d_forces’}
‘gamma’ -> predict \({\delta\gamma}\) using \(V_{ext}\)
‘d_gamma’ -> predict \({\gamma}+{\delta\gamma}\) based on predicted \({\gamma}\).
‘d_energy’ -> predict \(E+{\delta}E\) based on predicted \({\gamma}\)
‘d_forces’ -> predict \(F+{\delta}F\) based on predicted \({\gamma}\)
Returns
yarray

Predicted target values

predict_block(x=None, method=None, convert=True, **kwargs)[source]
property qmmodels
translate_input(x, convert=True, **kwargs)[source]

Return external potential \(V_{ext}\) from x. x could be numpy ndarray, ASE Atoms object, or QMMol object

class qmlearn.model.model.QMModel(mmodels=None, method='gamma', ncharge=None, nspin=1, occs=None, refqmmol=None, **kwargs)[source]

Bases: object

QMModel class is wrapper around sklearn regression model classes. It provide method to fit and predict based on provided training and testing data

Attributes
mmodelsdict, optional

Set of machine learning algorithms used for training , If not provided by default Kernel Ridge Rigression (KRR) will be used to learn \({\gamma}\) from \(V_{ext}\) and linear regression to learn \({\delta}E\), and \({\delta}{\gamma}\)

method{‘gamma’}, str

Determine which property to learn from external potentials \(V_{ext}\). As of now only \({\gamma}\) can be learned from \(V_{ext}\). And then all other properties calculated from \({\gamma}\)

ncharge: int, optional

Total number of electrons.

nspin: int, optional

Total spin as defined in PySCF (num. alpha electrons - num. beta electrons).

refqmmol: QMMol object

Reference QMMol object

Methods

convert_back(y[, prop, qmmol])

Convert back the predicted properties to the original reference frame of the molecule

fit(X, y[, model, method])

Fit model

predict(x[, model, method])

Predict using trained QMModel

translate_input(x, **kwargs)

Return external potential \(V_{ext}\) from x.

orth_orb

convert_back(y, prop='gamma', qmmol=None, **kwargs)[source]

Convert back the predicted properties to the original reference frame of the molecule

Returns
yarray

Predicted target values in original refrence frame of the molecule

fit(X, y, model=None, method=None)[source]

Fit model

Parameters
Xarray

Training data

yarray

Target values

modelQMModel obj, optional

Regression model (i.e., KernelRidge, LinearRegression), If not provided will take from mmodels dictionary.

method{‘gamma’, ‘d_gamma’, ‘d_energy’, ‘d_forces’}
‘gamma’ -> learn \({\delta\gamma}\) using \(V_{ext}\)
‘d_gamma’ -> learn \({\delta\gamma}\) based on predicted \({\gamma}\).
‘d_energy’ -> learn \({\delta}E\) based on predicted \({\gamma}\)
‘d_forces’ -> learn \({\delta}F\) based on predicted \({\gamma}\)
Returns
QMModel

return trained QMModel object

property method
property model
orth_orb(s, orb)[source]
predict(x, model=None, method=None, **kwargs)[source]

Predict using trained QMModel

Parameters
xarray

Training data

method{‘gamma’, ‘d_gamma’, ‘d_energy’, ‘d_forces’}
‘gamma’ -> predict \({\delta\gamma}\) using \(V_{ext}\)
‘d_gamma’ -> predict \({\gamma}+{\delta\gamma}\) based on predicted \({\gamma}\).
‘d_energy’ -> predict \(E+{\delta}E\) based on predicted \({\gamma}\)
‘d_forces’ -> predict \(F+{\delta}F\) based on predicted \({\gamma}\)
Returns
yarray

Predicted target values

property refqmmol
translate_input(x, **kwargs)[source]

Return external potential \(V_{ext}\) from x. x could be numpy ndarray, ASE Atoms object, or QMMol object

Module contents