Skip to main content

No project description provided

Project description

MEGNetSparse

Installation

pip install MEGNetSparse
  1. You must first install the torch and torch-geometric
  2. The notebook provided in the examples will only work with pymatgen=2023.1.30, so you may need to reinstall it.

Usage

The library provides the ability to use a function convert_to_sparse_representation and a class MEGNetTrainer

convert_to_sparse_representation(
    structure,
    unit_cell,
    supercell_size,
    skip_eos=False,
    skip_was=False,
    skip_state=False,
    copy_unit_cell_properties=False
)
  • structure : Structure - the structre to convert to sparse representation
  • unit_cell : Structure - unit cell of base material
  • supercell_size : List[int] - list with three integers to copy a cell along three coordinates
  • skip_eos : bool - if True will not add eos to properties and will speed up computations
  • skip_was: bool - if True will not add was to properties
  • skip_state : bool - if True will not add global state
  • copy_unit_cell_properties: bool - if True will also copy unit cell properties in case of name collisions structure properties will be overwritten

return : sparse representation of structure

MEGNetTrainer(
    config,
    device,
)
  • config : dict - template config can be found in examples notebook
  • device : str - device in torch format
MEGNetTrainer.prepare_data(
    self,
    train_data,
    train_targets,
    test_data,
    test_targets,
    target_name,
):
  • train_data : List[Structure] - list of structures in sparse or dense representation
  • train_targets : List[float32] - list of targets
  • test_data : List[Structure] - list of structures in sparse or dense representation
  • test_targets : List[float32] - list of targets
  • target_name : str - target name
MEGNetTrainer.train_one_epoch(self)

return : mae on train data, mse on train data

MEGNetTrainer.evaluate_on_test(
    self, 
    return_predictions=False
)

return : if return_predictions=True, mae on test data, predictions else only mae on test data

MEGNetTrainer.predict_structures(
    self, 
    structures_list
)
  • structures_list : List[Structure] - list of structures in sparse or dense representation

return : predictions for structures

MEGNetTrainer.save(self, path)
  • path : str - where to store model data
MEGNetTrainer.load(self, path)
  • path : str - where to load model data from

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

MEGNetSparse-0.0.2.tar.gz (88.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

MEGNetSparse-0.0.2-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file MEGNetSparse-0.0.2.tar.gz.

File metadata

  • Download URL: MEGNetSparse-0.0.2.tar.gz
  • Upload date:
  • Size: 88.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for MEGNetSparse-0.0.2.tar.gz
Algorithm Hash digest
SHA256 87d93b8f67489474f46cf0f5a5cf0d782eb16d5ce3b13c22fd997f34f8e3a834
MD5 95a92ebffbbe092e8cc058cc3a620058
BLAKE2b-256 ba958d5aa81494b3af1287ff68c249df7cfad4985ca016d338da9523928d28b1

See more details on using hashes here.

File details

Details for the file MEGNetSparse-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: MEGNetSparse-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for MEGNetSparse-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5427446131e7964399a28077d52d4155b3b61057c711f8a04008367cc7c283ca
MD5 efcc9183ff68c783ee2943c5186bab18
BLAKE2b-256 a35e9e2d83a8ecf536dcaf7cbfa2a64df39a3b7c10c24c1a9b8c29f401638522

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page