Skip to content

Commit ac6a4fb

Browse files
committed
Update fortran wrapper functions
1 parent fb55b8f commit ac6a4fb

4 files changed

Lines changed: 62 additions & 36 deletions

File tree

fortran/spglib_f08.f90

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ end function spg_get_symmetry
8080
function spgat_get_symmetry( rotation, translation, max_size, lattice, &
8181
& position, types, num_atom, symprec, angle_tolerance) bind(c)
8282
import c_int, c_double
83-
integer(c_int), intent(out) :: rotation(3,3,*)
84-
real(c_double), intent(out) :: translation(3,*)
83+
integer(c_int), intent(inout) :: rotation(3,3,*)
84+
real(c_double), intent(inout) :: translation(3,*)
8585
integer(c_int), intent(in), value :: max_size
8686
real(c_double), intent(in) :: lattice(3,3), position(3,*)
8787
integer(c_int), intent(in) :: types(*)
@@ -95,9 +95,9 @@ function spg_get_symmetry_with_collinear_spin( rotation, translation, &
9595
& equivalent_atoms, max_size, lattice, position, types, spins, &
9696
& num_atom, symprec) bind(c)
9797
import c_int, c_double
98-
integer(c_int), intent(out) :: rotation(3,3,*)
99-
real(c_double), intent(out) :: translation(3,*)
100-
integer(c_int), intent(out) :: equivalent_atoms(*)
98+
integer(c_int), intent(inout) :: rotation(3,3,*)
99+
real(c_double), intent(inout) :: translation(3,*)
100+
integer(c_int), intent(inout) :: equivalent_atoms(*)
101101
integer(c_int), intent(in), value :: max_size
102102
real(c_double), intent(in) :: lattice(3,3), position(3,*)
103103
integer(c_int), intent(in) :: types(*)
@@ -112,9 +112,9 @@ function spgat_get_symmetry_with_collinear_spin( rotation, translation, &
112112
& equivalent_atoms, max_size, lattice, position, types, spins, &
113113
& num_atom, symprec, angle_tolerance) bind(c)
114114
import c_int, c_double
115-
integer(c_int), intent(out) :: rotation(3,3,*)
116-
real(c_double), intent(out) :: translation(3,*)
117-
integer(c_int), intent(out) :: equivalent_atoms(*)
115+
integer(c_int), intent(inout) :: rotation(3,3,*)
116+
real(c_double), intent(inout) :: translation(3,*)
117+
integer(c_int), intent(inout) :: equivalent_atoms(*)
118118
integer(c_int), intent(in), value :: max_size
119119
real(c_double), intent(in) :: lattice(3,3), position(3,*)
120120
integer(c_int), intent(in) :: types(*)
@@ -127,43 +127,45 @@ end function spgat_get_symmetry_with_collinear_spin
127127

128128
function spg_get_symmetry_with_site_tensors( rotation, translation, &
129129
& equivalent_atoms, primitive_lattice, spin_flips, max_size, lattice, &
130-
& position, types, tensors, tensor_rank, num_atom, is_magnetic, &
131-
& symprec) bind(c)
130+
& position, types, tensors, tensor_rank, num_atom, with_time_reversal, &
131+
& is_axial, symprec) bind(c)
132132
import c_int, c_double
133133
integer(c_int), intent(inout) :: rotation(3,3,*)
134134
real(c_double), intent(inout) :: translation(3,*)
135-
integer(c_int), intent(out) :: equivalent_atoms(*)
136-
real(c_double), intent(out) :: primitive_lattice(3,3)
137-
integer(c_int), intent(out) :: spin_flips(*)
135+
integer(c_int), intent(inout) :: equivalent_atoms(*)
136+
real(c_double), intent(inout) :: primitive_lattice(3,3)
137+
integer(c_int), intent(inout) :: spin_flips(*)
138138
integer(c_int), intent(in), value :: max_size
139139
real(c_double), intent(in) :: lattice(3,3), position(3,*)
140140
integer(c_int), intent(in) :: types(*)
141141
real(c_double), intent(in) :: tensors(*)
142142
integer(c_int), intent(in), value :: tensor_rank
143143
integer(c_int), intent(in), value :: num_atom
144-
integer(c_int), intent(in), value :: is_magnetic
144+
integer(c_int), intent(in), value :: with_time_reversal
145+
integer(c_int), intent(in), value :: is_axial
145146
real(c_double), intent(in), value :: symprec
146147
integer(c_int) :: spg_get_symmetry_with_site_tensors
147148
end function spg_get_symmetry_with_site_tensors
148149

149150

150151
function spgat_get_symmetry_with_site_tensors( rotation, translation, &
151152
& equivalent_atoms, primitive_lattice, spin_flips, max_size, lattice, &
152-
& position, types, tensors, tensor_rank, num_atom, is_magnetic, &
153-
& symprec, angle_tolerance) bind(c)
153+
& position, types, tensors, tensor_rank, num_atom, with_time_reversal, &
154+
& is_axial, symprec, angle_tolerance) bind(c)
154155
import c_int, c_double
155156
integer(c_int), intent(inout) :: rotation(3,3,*)
156157
real(c_double), intent(inout) :: translation(3,*)
157-
integer(c_int), intent(out) :: equivalent_atoms(*)
158-
real(c_double), intent(out) :: primitive_lattice(3,3)
159-
integer(c_int), intent(out) :: spin_flips(*)
158+
integer(c_int), intent(inout) :: equivalent_atoms(*)
159+
real(c_double), intent(inout) :: primitive_lattice(3,3)
160+
integer(c_int), intent(inout) :: spin_flips(*)
160161
integer(c_int), intent(in), value :: max_size
161162
real(c_double), intent(in) :: lattice(3,3), position(3,*)
162163
integer(c_int), intent(in) :: types(*)
163164
real(c_double), intent(in) :: tensors(*)
164165
integer(c_int), intent(in), value :: tensor_rank
165166
integer(c_int), intent(in), value :: num_atom
166-
integer(c_int), intent(in), value :: is_magnetic
167+
integer(c_int), intent(in), value :: with_time_reversal
168+
integer(c_int), intent(in), value :: is_axial
167169
real(c_double), intent(in), value :: symprec, angle_tolerance
168170
integer(c_int) :: spgat_get_symmetry_with_site_tensors
169171
end function spgat_get_symmetry_with_site_tensors
@@ -439,6 +441,7 @@ function spg_get_spacegroup_type(hall_number) result(spgtype)
439441
character(kind=c_char) :: international_full(20)
440442
character(kind=c_char) :: international(32)
441443
character(kind=c_char) :: schoenflies(7)
444+
integer(c_int) :: hall_number
442445
character(kind=c_char) :: hall_symbol(17)
443446
character(kind=c_char) :: choice(6)
444447
character(kind=c_char) :: pointgroup_international(6)

src/spglib.h

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,27 @@ int spgms_get_symmetry_with_collinear_spin(
278278
const int num_atom, const double symprec, const double angle_tolerance,
279279
const double mag_symprec);
280280

281-
/* Return 0 if failed */
282-
/* ``rotation`` and ``translation`` are used as input and output. */
281+
/**
282+
* @brief
283+
*
284+
* @param rotation Rotation parts of symmetry operations as return values.
285+
* @param translation Translation parts of symmetry operations as return value.
286+
* @param equivalent_atoms Symmetrically equivalent atoms as return value.
287+
* @param primitive_lattice Primitive basis vectors as return value.
288+
* @param spin_flips 1 for non time reversal and -1 for time reversal for each
289+
* symmetry operation.
290+
* @param max_size
291+
* @param lattice
292+
* @param position
293+
* @param types
294+
* @param tensors
295+
* @param tensor_rank
296+
* @param num_atom
297+
* @param with_time_reversal
298+
* @param is_axial
299+
* @param symprec
300+
* @return int Number of symmetry operations. Return 0 if failed.
301+
*/
283302
int spg_get_symmetry_with_site_tensors(
284303
int rotation[][3][3], double translation[][3], int equivalent_atoms[],
285304
double primitive_lattice[3][3], int *spin_flips, const int max_size,

src/spin.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -85,20 +85,7 @@ static int is_zero_d3(const double a[3], const double mag_symprec);
8585

8686
/******************************************************************************/
8787

88-
/// Return NULL if failed
89-
/// @param[out] equivalent_atoms
90-
/// @param[out] permutations such that the p-th operation in `magnetic_symmetry`
91-
/// maps
92-
/// site-`i` to site-`permutations[p * cell->size + i]`.
93-
/// @param[out] prim_lattice
94-
/// @param[in] sym_nonspin Symmetry operations with ignoring spin
95-
/// @param[in] cell
96-
/// @param[in] with_time_reversal true if consider time reversal operation
97-
/// @param[in] is_axial true if site tensors are axial w.r.t. time-reversal
98-
/// operations
99-
/// @param[in] symprec
100-
/// @param[in] angle_tolerance
101-
/// @param[in] mag_symprec if mag_sympprec < 0, use symprec instead
88+
/* doc was moved to spin.h. */
10289
MagneticSymmetry *spn_get_operations_with_site_tensors(
10390
int **equivalent_atoms, int **permutations, double prim_lattice[3][3],
10491
const Symmetry *sym_nonspin, const Cell *cell, const int with_time_reversal,

src/spin.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,23 @@
3939
#include "mathfunc.h"
4040
#include "symmetry.h"
4141

42+
/**
43+
* @brief
44+
*
45+
* @param[out] equivalent_atoms
46+
* @param[out] permutations such that the p-th operation in `magnetic_symmetry`
47+
* maps site-`i` to site-`permutations[p * cell->size + i]`.
48+
* @param[out] prim_lattice
49+
* @param[in] sym_nonspin Symmetry operations with ignoring spin
50+
* @param[in] cell
51+
* @param[in] with_time_reversal true if consider time reversal operation
52+
* @param[in] is_axial true if site tensors are axial w.r.t. time-reversal
53+
* operations
54+
* @param[in] symprec
55+
* @param[in] angle_tolerance
56+
* @param[in] mag_symprec if mag_sympprec < 0, use symprec instead
57+
* @return Return NULL if failed.
58+
*/
4259
MagneticSymmetry *spn_get_operations_with_site_tensors(
4360
int **equivalent_atoms, int **permutations, double prim_lattice[3][3],
4461
const Symmetry *sym_nonspin, const Cell *cell, const int with_time_reversal,

0 commit comments

Comments
 (0)