Skip to content

Commit

Permalink
Add predict example for pizeoelectric tensor
Browse files Browse the repository at this point in the history
  • Loading branch information
mjwen committed Aug 8, 2024
1 parent 25f0be7 commit ae9b6f9
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions notebooks/predict_general.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""
An example script make predictions of any tensor.
"""

from pymatgen.core import Structure

from matten.predict import predict


def get_structure():
a = 5.46
lattice = [[0, a / 2, a / 2], [a / 2, 0, a / 2], [a / 2, a / 2, 0]]
basis = [[0.0, 0.0, 0.0], [0.25, 0.25, 0.25]]
Si = Structure(lattice, ["Si", "Si"], basis)

return Si


if __name__ == "__main__":
structure = get_structure()

tensor = predict(
structure,
model_identifier="/Users/mjwen.admin/Packages/matten_wengroup/scripts",
checkpoint="epoch=9-step=10.ckpt",
is_elasticity_tensor=False,
)

print("value:", tensor)
print("type:", type(tensor))
print("shape:", tensor.shape)

0 comments on commit ae9b6f9

Please sign in to comment.