api
api copied to clipboard
ModuleNotFoundError: No module named 'pymatgen.plotting'
how to solve the question, I want to visualize .cif file.
Please post the entire error message and traceback, including the code you are trying to run. It is impossible to answer your question otherwise.
This package never tries to import pymatgen.plotting
(which I'm pretty sure does not exist anyway) so it must be some other code that is triggering it.
from pymatgen.io.cif import CifParser from pymatgen.plotting import BSPlotter import matplotlib.pyplot as plt
读取 CIF 文件
parser = CifParser("mp-6127.cif") structure = parser.get_structures()[0]
可选:如果你想调整晶体结构到原胞,可以使用 SpacegroupAnalyzer
analyzer = SpacegroupAnalyzer(structure) structure = analyzer.get_primitive_standard_structure()
使用 BSPlotter 可视化晶体结构
plotter = BSPlotter(structure) plotter.show()
如果你想将可视化结果保存为图像文件,你也可以使用 Matplotlib
plt.savefig("structure.png")
that‘s all. please tell how to improve it thanks
Dear @xiaowangfeng ,
It feels like a lot of code is actually missing to do the required tasks. There are tutorials around the MP that you might find helpful: https://youtube.com/playlist?list=PLTjFYVNE7LTi6kGvPAF7DDQYj0KDL-vQL&si=w8y5_SacASkgo9pG
Or use the matsci Forum for further help: https://matsci.org
In general, your requests need to be much more specific, also for the forum. Here, the issues are meant for actual software bugs, not general help requests.
I hope you can understand this.
Sorry, I am a novice to materials chemistry. I downloaded some data through materials project and wanted to realize the visualization of.cif through pymatgen, but the code kept giving errors. In desperation, I want to ask for help through here, thank you
Once again, I'm sorry for my behavior
I very well understand this. This is why I am pointing to the tutorials that have been made for the purpose and the forum that can be used to ask questions. :)