Re: [Spglib-users] How to get equivalent_atoms using fortran code
Brought to you by:
atztogo
From: Atsushi T. <atz...@gm...> - 2023-06-15 01:14:49
|
Hi Wang, Without spin, spg_get_dataset, and with spin, spg_get_magnetic_dataset is recommended to use. However for the latter, the fortran interface has not been written yet. A possible route is using spg_get_symmetry_with_site_tensors. The interface is function spg_get_symmetry_with_site_tensors(rotation, translation, & & equivalent_atoms, primitive_lattice, spin_flips, max_size, lattice, & & position, types, tensors, tensor_rank, num_atom, with_time_reversal, & & is_axial, symprec) bind(c) import c_int, c_double integer(c_int), intent(out) :: rotation(3, 3, *) real(c_double), intent(out) :: translation(3, *) integer(c_int), intent(out) :: equivalent_atoms(*) real(c_double), intent(out) :: primitive_lattice(3, 3) integer(c_int), intent(out) :: spin_flips(*) integer(c_int), intent(in), value :: max_size real(c_double), intent(in) :: lattice(3, 3), position(3, *) integer(c_int), intent(in) :: types(*) real(c_double), intent(in) :: tensors(*) integer(c_int), intent(in), value :: tensor_rank integer(c_int), intent(in), value :: num_atom integer(c_int), intent(in), value :: with_time_reversal integer(c_int), intent(in), value :: is_axial real(c_double), intent(in), value :: symprec integer(c_int) :: spg_get_symmetry_with_site_tensors end function spg_get_symmetry_with_site_tensors Unfortunately, I haven't wrote any example of it, but I hope it can be guessed from C-api doc. https://spglib.readthedocs.io/en/latest/api.html#spg-get-symmetry-with-site-tensors https://spglib.readthedocs.io/en/latest/development/magnetic_symmetry_flags.html#magnetic-action-flags If you want to specify collinear spin, the array length is the number of atoms, tensor_rank=0, is_axial=0, and with_time_reversal =1. For the non-collinear case, the array length is the number-of-atoms x 3, tensor_rank=1, is_axial=1, and with_time_reversal =1. These are the typical choices. The spin_flips array stores if the spin is flipped or not by the found symmety operations. Therefore the length is the number of symmetry operations. The number of symmetry operations is unknown before running this function, so you have to prepare large enough symmetry operations related arrays, whose length is considered to inform to spglib by max_size. Togo On Tue, Jun 13, 2023 at 8:29 PM VeiWANG via Spglib-users <spg...@li...> wrote: > > Dear all, > > I am currently trying to use Fortran code to obtain the equivalent_atoms using spglib, with input variables of lattice vectors and atom positions. Could anyone provide guidance on how to implement this? > > If I understand correctly, to obtain the equivalent_atoms, I first simply call the spg_get_symmetry function, which requires input variables of max_size, lattice, position, types, num_atom, and optional parameter symprec. And then I use the spg_get_symmetry_with_collinear_spin function, which takes an additional input variable of spins and outputs equivalent_atoms directly from the function. I was wondering if anyone has experience using spin information with spglib and if so, how to incorporate it into the function. Thank you for your assistance. > > Best, > Wang > _______________________________________________ > Spglib-users mailing list > Spg...@li... > https://lists.sourceforge.net/lists/listinfo/spglib-users -- Atsushi Togo |