The error of "Using the MEGNet-MP-2018.6.1-Eform model" #270
Unanswered
hwshou2024
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Dear, When I running the code "# Load the pre-trained MEGNet formation energy model.
model = matgl.load_model("../pretrained_models/MEGNet-MP-2018.6.1-Eform/")
eform = model.predict_structure(struct)
print(f"The predicted formation energy for CsCl is {float(eform):.3f} eV/atom.")",
The error is "ValueError Traceback (most recent call last)
Input In [8], in <cell line: 3>()
1 # Load the pre-trained MEGNet formation energy model.
2 model = matgl.load_model("../pretrained_models/MEGNet-MP-2018.6.1-Eform/")
----> 3 eform = model.predict_structure(struct)
4 print(f"The predicted formation energy for CsCl is {float(eform):.3f} eV/atom.")
File D:\Application\anaconda3\lib\site-packages\matgl\models_wrappers.py:60, in TransformedTargetModel.predict_structure(self, *args, **kwargs)
50 def predict_structure(self, *args, **kwargs):
51 """Pass through to parent model.predict_structure with inverse transform.
52
53 Args:
(...)
58 Transformed answer.
59 """
---> 60 return self.transformer.inverse_transform(self.model.predict_structure(*args, **kwargs))
File D:\Application\anaconda3\lib\site-packages\matgl\models_megnet.py:217, in MEGNet.predict_structure(self, structure, state_feats, graph_converter)
214 from matgl.ext.pymatgen import Structure2Graph
216 graph_converter = Structure2Graph(element_types=self.element_types, cutoff=self.cutoff)
--> 217 g, state_feats_default = graph_converter.get_graph(structure)
218 if state_feats is None:
219 state_feats = torch.tensor(state_feats_default)
File D:\Application\anaconda3\lib\site-packages\matgl\ext\pymatgen.py:110, in Structure2Graph.get_graph(self, structure)
108 volume = structure.volume
109 cart_coords = structure.cart_coords
--> 110 src_id, dst_id, images, bond_dist = find_points_in_spheres(
111 cart_coords,
112 cart_coords,
113 r=self.cutoff,
114 pbc=pbc,
115 lattice=lattice_matrix,
116 tol=numerical_tol,
117 )
118 exclude_self = (src_id != dst_id) | (bond_dist > numerical_tol)
119 src_id, dst_id, images, bond_dist = (
120 src_id[exclude_self],
121 dst_id[exclude_self],
122 images[exclude_self],
123 bond_dist[exclude_self],
124 )
File neighbors.pyx:37, in pymatgen.optimization.neighbors.find_points_in_spheres()
File stringsource:658, in View.MemoryView.memoryview_cwrapper()
File stringsource:349, in View.MemoryView.memoryview.cinit()
ValueError: buffer source array is read-only
",
my env is"matgl=0.8.5 pymatgen=2020.12.31 ",I followed the tutorial on the official website, but encountered many errors. Thank you for your reply.
Beta Was this translation helpful? Give feedback.
All reactions