Phonon rattle structure generation

Dear hiphive developers & users

I wanted to generate structures in three different methods called standard rattle, Monte Carlo modified rattle procedure (MC-rattle) and Superposition of normal modes (phonon-rattle).
to this end I have followed the tutorial in advanced topics but I faced an error in monte carlo step which I pasted below:

Exception                                 Traceback (most recent call last)
Cell In[8], line 3
      1 # Monte Carlo rattle
      2 print('Monte Carlo rattle')
----> 3 structures_mc_rattle = generate_mc_rattled_structures(
      4     supercell, n_structures, 0.25*rattle_std, min_distance, n_iter=20)
      5 write('structures_mc_rattle.extxyz', structures_mc_rattle)

File ~/anaconda3/envs/phono3py/lib/python3.9/site-packages/hiphive/structure_generation/rattle.py:112, in generate_mc_rattled_structures(atoms, n_structures, rattle_std, d_min, seed, **kwargs)
    110 atoms_tmp = atoms.copy()
    111 seed = rs.randint(1, 1000000000)
--> 112 displacements = mc_rattle(atoms_tmp, rattle_std, d_min, seed=seed, **kwargs)
    113 atoms_tmp.positions += displacements
    114 atoms_list.append(atoms_tmp)

File ~/anaconda3/envs/phono3py/lib/python3.9/site-packages/hiphive/structure_generation/rattle.py:217, in mc_rattle(atoms, rattle_std, d_min, width, n_iter, max_attempts, max_disp, active_atoms, nbr_cutoff, seed)
    215                 atoms_rattle[i].position -= delta_disp
    216         else:
--> 217             raise Exception(f'Exceeded the maximum number of attempts for atom {i}')
    218 displacements = atoms_rattle.positions - reference_positions
    219 return displacements

Exception: Exceeded the maximum number of attempts for atom 0

please help me to understand and solve the error?

Hard to tell without seeing the script and structure but my guess is that your rattle_std is too large. Try decreasing the rattle_std and increase the number of steps.

The equivalent rattle distance is sqrt(steps) x rattle_std iirc.

Thanks a lot

decreasing the rattle_std and increase the number of steps worked for me.