CoREMOF.models.cp_app package

Submodules

CoREMOF.models.cp_app.descriptors module

Feature list used in heat capacity models.

CoREMOF.models.cp_app.featurizer module

The methods to featurize a dataset of porous materials for heat capacity.

class CoREMOF.models.cp_app.featurizer.LocalPropertyStatsNew(data_source=<matminer.utils.data.MagpieData object>, weight='area', properties=('Electronegativity', ), cutoff=5)[source]

Bases: BaseFeaturizer

Differences, minima and maxima in elemental properties between site and its neighboring sites. Uses the Voronoi tessellation of the structure to determine the neighbors of the site, and assigns each neighbor (\(n\)) a weight (\(A_n\)) that corresponds to the area of the facet on the tessellation corresponding to that neighbor. The local property difference is then computed by \(\frac{\sum_n {A_n |p_n - p_0|}}{\sum_n {A_n}}\) where \(p_n\) is the property (e.g., atomic number) of a neighbor and \(p_0\) is the property of a site. If signed parameter is assigned True, signed difference of the properties is returned instead of absolute difference. Taken from oximachine featurizer: https://github.com/kjappelbaum/oximachine_featurizer

Features:
  • “local property stat in [property]”

References

citations()[source]

Citation(s) and reference(s) for this feature.

Returns:

(list) each element should be a string citation,

ideally in BibTeX format.

feature_labels()[source]

Generate attribute names.

Returns:

([str]) attribute labels.

featurize(strc, idx)[source]

Main featurizer function, which has to be implemented in any derived featurizer subclass.

Parameters:

x – input data to featurize (type depends on featurizer).

Returns:

(list) one or more features.

static from_preset(preset, cutoff=13)[source]

Create a new LocalPropertyStats class according to a preset.

Parameters:
  • preset (str) – Name of preset

  • cutoff (float) – Cutoff for the nearest neighbor search

implementors()[source]

List of implementors of the feature.

Returns:

(list) each element should either be a string with author name (e.g.,

”Anubhav Jain”) or a dictionary with required key “name” and other keys like “email” or “institution” (e.g., {“name”: “Anubhav Jain”, “email”: “ajain@lbl.gov”, “institution”: “LBNL”}).

CoREMOF.models.cp_app.featurizer.add_type_feature(mydict, atomtype, name, feat)[source]
CoREMOF.models.cp_app.featurizer.featurize_dataset(cifs, verbos=False, saveto='features.csv')[source]

Featurize crystal structures using elemetal, geometric, and chemical descriptors for local environments.

Parameters:
  • cifs (list) – list of paths to crystal structure in cif format.

  • verbos – printing the steps.

  • saveto (str) – filename to save the generated features.

Return type:

DataFrame

CoREMOF.models.cp_app.featurizer.featurize_structure(cif, verbos=False, saveto='features.csv')[source]

Featurize a crystal structure using elemetal, geometric, and chemical descriptors for local environments.

Parameters:
  • cifs – list of paths to crystal structure in cif format.

  • verbos – printing the steps.

  • saveto (str) – filename to save the generated features.

Return type:

DataFrame

CoREMOF.models.cp_app.generate_labels module

The methods to compute labels for machine learning the heat capacity.

CoREMOF.models.cp_app.generate_labels.compute_atomic_cv_dataset(phonopy_params, cifs, temperatures, verbos=False, saveto='labels.csv')[source]

Compute atomic contribution to total cv from phonopy parameter file.

Parameters:

phonopy_params (list[str]) –

list of phonopy parameter files (output of DFT).

cifs: list of crystal structure in cif format. temperatures: the target temperature .

Return type:

DataFrame

CoREMOF.models.cp_app.generate_labels.compute_projected_dos_structure(phonopy_params, unitfactor=phonopy.units.CP2KToTHz, dx=0.5, fmax=100, freq_pitch=0.5, saveto=None)[source]

Compute projected dos from phonopy parameter file.

Parameters:
  • phonopy_params (str) – list of phonopy parameter files (output of DFT).

  • cif – list of crystal structure in cif format.

  • temperatures – the target temperature.

  • factor – the unit conversion factor.

  • dx – spacing to compute dos.

  • fmax – max frequency in dos calculations.

  • freq_pitch – pitch frequency in dos calculations.

  • saveto (Optional[str]) – save the projected dos to a file.

CoREMOF.models.cp_app.generate_labels.compute_total_dos_structure(phonopy_params, unitfactor=phonopy.units.CP2KToTHz, dx=0.5, fmax=100.0, freq_pitch=0.5, saveto=None)[source]

Compute projected dos from phonopy parameter file.

Parameters:
  • phonopy_params (str) – list of phonopy parameter files (output of DFT).

  • cif – list of crystal structure in cif format.

  • temperatures – the target temperature .

  • factor – the unit conversion factor.

  • dx (float) – spacing to compute dos.

  • fmax (float) – max frequency in dos calculations.

  • freq_pitch (float) – pitch frequency in dos calculations.

CoREMOF.models.cp_app.predictions module

CoREMOF.models.cp_app.predictions.predict_Cv_ensemble_structure(models, FEATURES, df_features, temperature)[source]

Predict heat capacity using an ensemble of ML models for one structure.

Parameters:
  • models (list) – list (ensemble) of ML models.

  • FEATURES (list) – features for ML model.

  • df_features (DataFrame) – pandas dataframe containing the features.

  • temperature (float) – target temperature.

Return type:

list

Returns:

a list containing the gravimetric and molar heat capacity together with the uncertainty of the models.

CoREMOF.models.cp_app.predictions.predict_Cv_ensemble_structure_multitemperatures(path_to_models, structure_name, features_file='features.csv', FEATURES=['site Number', 'site AtomicWeight', 'site Row', 'site Column', 'site Electronegativity', 'site CovalentRadius', 'AGNI eta=8.00e-01', 'AGNI eta=1.23e+00', 'AGNI eta=1.88e+00', 'AGNI eta=2.89e+00', 'AGNI eta=4.43e+00', 'AGNI eta=6.80e+00', 'AGNI eta=1.04e+01', 'AGNI eta=1.60e+01', 'G2_0.05', 'G2_4.0', 'G2_20.0', 'G2_80.0', 'G4_0.005_1.0_1.0', 'G4_0.005_1.0_-1.0', 'G4_0.005_4.0_1.0', 'G4_0.005_4.0_-1.0', 'local difference in Number', 'local difference in AtomicWeight', 'local difference in Row', 'local difference in Column', 'local difference in Electronegativity', 'local difference in CovalentRadius', 'local signed difference in Number', 'local signed difference in AtomicWeight', 'local signed difference in Row', 'local signed difference in Column', 'local signed difference in Electronegativity', 'local signed difference in CovalentRadius', 'maximum local difference in Number', 'maximum local difference in AtomicWeight', 'maximum local difference in Row', 'maximum local difference in Column', 'maximum local difference in Electronegativity', 'maximum local difference in CovalentRadius', 'minimum local difference in Number', 'minimum local difference in AtomicWeight', 'minimum local difference in Row', 'minimum local difference in Column', 'minimum local difference in Electronegativity', 'minimum local difference in CovalentRadius'], temperatures=[300.0], save_to='cv_predicted.csv')[source]

Predict heat capacity using an ensemble of ML models for a dataset.

Parameters:
  • models – ensemble of ML models.

  • FEATURES (list) – features for ML model.

  • df_features – pandas dataframe containing the features.

  • temperature – target temperature.

Return type:

DataFrame

Returns:

a list containing the gravimetric and molar heat capacity together with the uncertainty of the models.

CoREMOF.models.cp_app.utils module

The utilities for cp_app.

CoREMOF.models.cp_app.utils.add_type_label(mydict, atomtype, name, label)[source]
CoREMOF.models.cp_app.utils.cv_from_dos(temp, totaldos)[source]
CoREMOF.models.cp_app.utils.cv_from_frequencies(temp, freqs)[source]
CoREMOF.models.cp_app.utils.cv_from_pdos(temp, pdos)[source]
CoREMOF.models.cp_app.utils.cv_from_pdos_site(temp, pdos, site)[source]
CoREMOF.models.cp_app.utils.read_atoms_from_mesh(filename)[source]
CoREMOF.models.cp_app.utils.read_frequencies_from_mesh(filename)[source]
CoREMOF.models.cp_app.utils.read_pdos(filename)[source]
CoREMOF.models.cp_app.utils.read_totaldos(filename)[source]
CoREMOF.models.cp_app.utils.read_vibspectrum(filename)[source]
CoREMOF.models.cp_app.utils.select_structures(nsamples, df)[source]

CoREMOF.models.cp_app.versions module

Version information.

Module contents

General functions and methods for heat capacity.