spirit-code / spirit

Atomistic Spin Simulation Framework
http://spirit-code.github.io
MIT License
120 stars 53 forks source link

Saving spin-configuration files is not implemented for Monte-Carlo simulation? #597

Open gwwfromcs opened 3 years ago

gwwfromcs commented 3 years ago

I notice Monte Carlo simulation does not output spin-configurations files or energies. After checking "spirit/core/src/engine/Method_MC.cpp", I notice Method_MC::Save_Current is not implemented.

void Method_MC::Save_Current(std::string starttime, int iteration, bool initial, bool final)
{
}

I think a quick solution is copying the code in "Method_LLG::Save_Current" to "Method_MC::Save_Current" (just replace LLG with MC)?

Thank you very much!

GPMueller commented 3 years ago

You are right, that method should not be empty and should mostly look like the one for LLG, so it should be a small fix. Please feel free to create a pull request if you like.

One comment: I would generally recommend using the Python package for Monte Carlo, as it gives you the flexibility that MC-simulations typically need, as shown here https://github.com/spirit-code/spirit/blob/master/ui-python/mc.py

gwwfromcs commented 3 years ago

You are right, that method should not be empty and should mostly look like the one for LLG, so it should be a small fix. Please feel free to create a pull request if you like.

One comment: I would generally recommend using the Python package for Monte Carlo, as it gives you the flexibility that MC-simulations typically need, as shown here https://github.com/spirit-code/spirit/blob/master/ui-python/mc.py

Thank you for your comment. That's very helpful.

sukhitoteh commented 3 years ago

You are right, that method should not be empty and should mostly look like the one for LLG, so it should be a small fix. Please feel free to create a pull request if you like.

One comment: I would generally recommend using the Python package for Monte Carlo, as it gives you the flexibility that MC-simulations typically need, as shown here https://github.com/spirit-code/spirit/blob/master/ui-python/mc.py

Thank you, the code is helpful. But how can I get the net magnetization by considering the magnetic moment of individual atom? I am now studying system with two species of different magnetic moment, the function quantities.get_magnetization only return magnetization as unit vector, thus unable to tell the actual magnetization.

GPMueller commented 3 years ago

@sukhitoteh, you are right, the quantities.get_magnetization function is not correct in this case (see also #527). However, you can always calculate the magnetization yourself, for example by using system.get_spin_directions, scaling the vectors with the atoms' magnetizations and then averaging or whatever you want to do.

sukhitoteh commented 3 years ago

@sukhitoteh, you are right, the quantities.get_magnetization function is not correct in this case (see also #527). However, you can always calculate the magnetization yourself, for example by using system.get_spin_directions, scaling the vectors with the atoms' magnetizations and then averaging or whatever you want to do.

thanks, this solved my problem.