Skip to content

Commit

Permalink
Hamiltonian_Heisenberg: Fixed a bug in the OpenMP implementation of D…
Browse files Browse the repository at this point in the history
…DI. Some index variables were not thread private. Somehow this only caused issues on clang.
  • Loading branch information
Moritz committed Aug 1, 2022
1 parent 8972d5a commit 32ce288
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions core/src/engine/Hamiltonian_Heisenberg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -932,8 +932,6 @@ void Hamiltonian_Heisenberg::Gradient_DDI_FFT( const vectorfield & spins, vector
auto & res_iFFT = fft_plan_reverse.real_ptr;
auto & res_mult = fft_plan_reverse.cpx_ptr;

int idx_b1, idx_b2, idx_d;

// Workaround for compability with intel compiler
const int c_n_cell_atoms = geometry->n_cell_atoms;
const int * c_it_bounds_pointwise_mult = it_bounds_pointwise_mult.data();
Expand All @@ -948,14 +946,15 @@ void Hamiltonian_Heisenberg::Gradient_DDI_FFT( const vectorfield & spins, vector
{
for( int a = 0; a < c_it_bounds_pointwise_mult[0]; ++a )
{
// Collect the intersublattice contributions
for( int i_b2 = 0; i_b2 < c_n_cell_atoms; ++i_b2 )
{
// Look up at which position the correct D-matrices are saved
int & b_inter = inter_sublattice_lookup[i_b1 + i_b2 * geometry->n_cell_atoms];

idx_b2 = i_b2 * spin_stride.basis + a * spin_stride.a + b * spin_stride.b + c * spin_stride.c;
idx_b1 = i_b1 * spin_stride.basis + a * spin_stride.a + b * spin_stride.b + c * spin_stride.c;
idx_d = b_inter * dipole_stride.basis + a * dipole_stride.a + b * dipole_stride.b
int idx_b2 = i_b2 * spin_stride.basis + a * spin_stride.a + b * spin_stride.b + c * spin_stride.c;
int idx_b1 = i_b1 * spin_stride.basis + a * spin_stride.a + b * spin_stride.b + c * spin_stride.c;
int idx_d = b_inter * dipole_stride.basis + a * dipole_stride.a + b * dipole_stride.b
+ c * dipole_stride.c;

auto & fs_x = ft_spins[idx_b2];
Expand Down

0 comments on commit 32ce288

Please sign in to comment.