Create Vampire UnitCell file from Materials Project


Dear all,

I’m trying to use pymatgen, specifically the VampireCaller class, to create a unit cell file (.ucf) which I eventually want to use in a hysteresis-loop calculation using Vampire. However, I’m currently stuck in a situation which I cannot solve myself nor find anyone else with the same issue - maybe you can help me :wink: ?

The material I’m interested in is SrFe12O19 which I can find two instances of on the Materials Project homepage; mp-1218653 and mp-19538.

I have created a mwe (minimal working example) you can download here in which I first get the structure using the API “.get_structure_by_material_id”.

I’ve tried to load the structure directly into the VampireCaller class. However, since the downloaded structure does not contain the (ground state) energies I cannot do this.

I then found a VampireCallerTest code which structure the input in a valid way. Using this code and a modified json file of the downloaded material structure I can now call the VampireCaller class.

Though, after a few seconds I get an error saying “We need at least 2 unique orderings.“ from a definition in (line #105)

My problem is that I simply do not know what this means nor how to fix this issue. Is it not possible to download a material from the Materials Project and then “simply” create a Vampire UnitCell file?

I hope you can point me in the correct direction - any input is much appreciated.
Thanks in advance.

Kind regards
Joakim Vester

P.s. It should be noted that I’m completely new to both pymatgen and Vampire.


In addition, the MWE does work if I test with a .json from the pymatgen Github repository, e.g, Mn3Al.json

The file is (now) included in the mwe.



Hi Joakim,

It’s not possible to parameterize a Vampire calculation using data from just MP at this point. Vampire needs an energy model for magnetic orderings, which is not currently available via MP. You need to run your own DFT calculations for various magnetic orderings first and supply those orderings and energies as described in the docstring:

            ordered_structures (list): Structure objects with magmoms.
            energies (list): Energies of each relaxed magnetic structure.

Hi Joakim,

Thanks for your message. As Shyam mentioned, the VampireCaller needs magnetic orderings and information about exchange interactions before it can run. The VampireCaller methods _create_mat() and _create_ucf() show how to generate material and ucf files from pymatgen structures with magnetic site information. _create_input() can also be easily modified to generate Vampire input files for simulations other than Monte Carlo.

This functionality is still a work in progress, and I will create a Jupyter notebook soon to show some simple examples.


Shayamd and Ncfrey, thank you both for your swift answers.

Excuse me for my lack of knowlagde - it’s a new “world” for me (mechanical engineer).

Just to clarify, I’m not aiming at running Vampire via VampireCaller - I want to use the VampireCaller to create the .mat and .ucf files and then manually set up a hysteresis-loop calculation (at 300K) in Vampire.

I currently solve the Landau–Lifshitz–Gilbert (LLG) equation on continuum form on custom synthesised nano sized SrFe12O19 platelets to determine M(H), which then is compared to experimental M(H) measurements. However our inhouse finite element code for solving the LLG equation assumes the temperature to be 0K. Thus, I want to use Vampire to do a atomistic LLG M(H) calculation at 300K and see if the atomistic M(H)-curve differes much from the continuum one. A side benefit of using Vampire would be that it supposedly is able to determine the exchange constant, which is an input parameter to the continuum LLG - currently I uses a textbook value.

Anyhow, as I understand from your answers is that I need to calculate the (ground state?) energies, magnetic orderings, and exchange interactions using Density Functional Theory, e.g., using software packages such as VASP, Quantum Espresso?

I will try to dig into the workings of Quantum Espresso, since VASP is sadly not open source.

Thanks again for your feedback.