-
Notifications
You must be signed in to change notification settings - Fork 876
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create a hcp mg grain boundary mgΣ7[0001](0001) too many values to unpack (expected 3) #3733
Comments
You need to use the 3-integer specification of the rotation axis. Not 4. In hexagonal structures, one of the indices (the third) is redundant. |
struc = Structure.from_file("mg.cif") gb.to(filename="Mg_GB.cif") It turns a new wrong:RuntimeError Traceback (most recent call last) File /opt/conda/lib/python3.10/site-packages/pymatgen/analysis/gb/grain.py:567, in GrainBoundaryGenerator.gb_from_parameters(self, rotation_axis, rotation_angle, expand_times, vacuum_thickness, ab_shift, normal, ratio, plane, max_search, tol_coi, rm_ratio, quick_gen) File /opt/conda/lib/python3.10/site-packages/pymatgen/analysis/gb/grain.py:1202, in GrainBoundaryGenerator.get_trans_mat(r_axis, angle, normal, trans_cry, lat_type, ratio, surface, max_search, quick_gen) RuntimeError: Sigma >1000 too large. Are you sure what you are doing, Please check the GB if exist |
Python version
Python3.10
Pymatgen version
2024.3.1
Operating system version
ubuntu22.04-py310-torch2.1.2-tf2.14.0-1.13.1
Current behavior
from pymatgen.core import Structure, Element
from pymatgen.analysis.gb.grain import GrainBoundary, GrainBoundaryGenerator
angle = GrainBoundaryGenerator.get_rotation_angle_from_sigma(7,[0,0,0,1], lat_type='H',ratio=None)
struc = Structure.from_file("mg.cif")
generator = GrainBoundaryGenerator(struc)
gb = generator.gb_from_parameters(
rotation_axis=[0,0,0,1],
rotation_angle=angle[0],
expand_times=8,
vacuum_thickness=0.0,
plane=None,
)
gb.to(filename="Mg_GB.cif")
ValueError Traceback (most recent call last)
Cell In[19], line 10
8 generator = GrainBoundaryGenerator(struc)
9 #gb = generator.gb_from_parameters([0,0,0,1],angle[0], plane = None, expand_times=8, vacuum_thickness=0.0)
---> 10 gb = generator.gb_from_parameters(
11 rotation_axis=[0,0,0,1], # 旋转轴向量,应为长度为3的列表
12 rotation_angle=angle[0], # 旋转角度,假设
angle
已经定义并包含所需角度13 expand_times=8, # 扩展次数
14 vacuum_thickness=0.0, # 真空厚度
15 plane=None, # 平面信息
16 )
17 gb.to(filename="Mg_GB.cif")
File /opt/conda/lib/python3.10/site-packages/pymatgen/analysis/gb/grain.py:567, in GrainBoundaryGenerator.gb_from_parameters(self, rotation_axis, rotation_angle, expand_times, vacuum_thickness, ab_shift, normal, ratio, plane, max_search, tol_coi, rm_ratio, quick_gen)
564 index = reduce(gcd, plane)
565 plane = [int(round(x / index)) for x in plane]
--> 567 t1, t2 = self.get_trans_mat(
568 r_axis=rotation_axis,
569 angle=rotation_angle,
570 normal=normal,
571 trans_cry=trans_cry,
572 lat_type=lat_type,
573 ratio=ratio,
574 surface=plane,
575 max_search=max_search,
576 quick_gen=quick_gen,
577 )
579 # find the join_plane
580 if lat_type.lower() != "c":
File /opt/conda/lib/python3.10/site-packages/pymatgen/analysis/gb/grain.py:1110, in GrainBoundaryGenerator.get_trans_mat(r_axis, angle, normal, trans_cry, lat_type, ratio, surface, max_search, quick_gen)
1108 r_matrix = (np.array(r_list) / com_fac / sigma).reshape(3, 3)
1109 else:
-> 1110 u, v, w = r_axis
1111 if lat_type.lower() == "c":
1112 mu = 1
ValueError: too many values to unpack (expected 3)
Expected Behavior
generate gbs
Minimal example
No response
Relevant files to reproduce this bug
No response
The text was updated successfully, but these errors were encountered: