Skip to content

How to convert to torch_geometric #207

@vict0rsch

Description

@vict0rsch

Do you have any tutorial or pointers about how to convert matbench samples to torch_geometric Data objects?

For instance, this is what an "input" looks like for matbench_mp_e_form but not sure how to convert that into a pytorch_geometric Data format to train a GNN on it:

Structure Summary
Lattice
    abc : 2.81605053 2.81605053 2.81605053
 angles : 90.0 90.0 90.0
 volume : 22.331676604441288
      A : 2.81605053 0.0 -0.0
      B : -0.0 2.81605053 -0.0
      C : 0.0 0.0 2.81605053
    pbc : True True True
PeriodicSite: Pt (0.0000, 0.0000, 0.0000) [0.0000, 0.0000, 0.0000]
PeriodicSite: C (1.4080, 1.4080, 1.4080) [0.5000, 0.5000, 0.5000]

I found this AtomsToGraph class in the OCP project and I want to make sure it does the right thing if I use it like:

from atoms_to_graphs import AtomsToGraph
from pymatgen.io.ase import AseAtomsAdaptor
from matbench.bench import MatbenchBenchmark

mb = MatbenchBenchmark(autoload=False)
task = mb.task_map["matbench_mp_e_form"]
task.load()
train_inputs, train_outputs = task.get_train_and_val_data(0)

struct = train_inputs[0]
atoms = AseAtomsAdaptor.get_atoms(struct)
data = AtomsToGraph(atoms)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions