when I use pymatgen python module to generate vampire ucf file, it put an error.
Traceback (most recent call last):
File "/opt/anaconda3/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 3444, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-9dee7c724d05>", line 1, in <module>
runfile('/Users/xbunax/PycharmProjects/pythonProject/test.py', wdir='/Users/xbunax/PycharmProjects/pythonProject')
File "/Users/xbunax/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.7571.203/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_umd.py", line 198, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "/Users/xbunax/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.7571.203/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/Users/xbunax/PycharmProjects/pythonProject/test.py", line 15, in <module>
vc = VampireCaller(magmoms)
File "/opt/anaconda3/lib/python3.9/site-packages/monty/dev.py", line 113, in decorated
return _callable(*args, **kwargs)
File "/opt/anaconda3/lib/python3.9/site-packages/pymatgen/command_line/vampire_caller.py", line 110, in __init__
hmapper = HeisenbergMapper(ordered_structures, energies, cutoff=3.0, tol=0.02)
File "/opt/anaconda3/lib/python3.9/site-packages/pymatgen/analysis/magnetism/heisenberg.py", line 78, in __init__
hs = HeisenbergScreener(ordered_structures, energies, screen=False)
File "/opt/anaconda3/lib/python3.9/site-packages/pymatgen/analysis/magnetism/heisenberg.py", line 708, in __init__
structures, energies = self._do_cleanup(structures, energies)
File "/opt/anaconda3/lib/python3.9/site-packages/pymatgen/analysis/magnetism/heisenberg.py", line 741, in _do_cleanup
ordered_structures = [
File "/opt/anaconda3/lib/python3.9/site-packages/pymatgen/analysis/magnetism/heisenberg.py", line 742, in <listcomp>
CollinearMagneticStructureAnalyzer(
File "/opt/anaconda3/lib/python3.9/site-packages/pymatgen/analysis/magnetism/analyzer.py", line 150, in __init__
structure = structure.copy()
AttributeError: 'float' object has no attribute 'copy'
This is my codes
from pymatgen.command_line.vampire_caller import VampireCaller
from mp_api.client import MPRester
mpr = MPRester('API_KEY')
structure = mpr.get_structure_by_material_id('mp-30409')
print(structure)
magmoms = structure.site_properties['magmom']
print(magmoms)
# Create a VampireCaller object with ferromagnetic order and default parameters
vc = VampireCaller(magmoms)
# Generate the ucf file
vc._create_ucf()
I read the source code of vampireacaller,the parameters notes says that
ordered_structures (list): Structure objects with magmoms.
I think the error is about the type of the structure parameter. But I don’t know how to solve this.If someone has the example code to generate ucf file. It will be grateful.