I wanted to read the optimized POSCAR file and use generate_mc_rattled_structures() to generate structures, but I ran into some problems. I don’t know if it’s the POSCAR file or the input parameters to generate_mc_rattled_structures()
from ase.io import read # ASE reading and writing POSCAR with selective dynamics
from ase.io import write
from ase.build import bulk
from ase.calculators.emt import EMT
from hiphive.structure_generation import generate_mc_rattled_structures
# parameters
n_structures = 5
cell_size = 4
rattle_std = 0.03
minimum_distance = 2.3
prim = read('POSCAR')
atoms_ideal = prim.repeat(cell_size)
print(prim)
# generate structures
structures = generate_mc_rattled_structures(atoms_ideal, n_structures, rattle_std, minimum_distance)
Results from run of the code
Atoms(symbols='C2', pbc=True, cell=[[1.2340150698661443, -2.1373767983138197, 0.0], [1.2340150698661443, 2.1373767983138197, 0.0], [0.0, 0.0, 19.998293]])
Traceback (most recent call last):
File "C:/Users/Tung/Desktop/tutorial_graphene/1_prepare_reference_data.py", line 28, in <module>
structures = generate_mc_rattled_structures(atoms_ideal, n_structures, rattle_std, minimum_distance)
File "D:\Python38\lib\site-packages\hiphive\structure_generation\rattle.py", line 108, in generate_mc_rattled_structures
displacements = mc_rattle(atoms_tmp, rattle_std, d_min, seed=seed,
File "D:\Python38\lib\site-packages\hiphive\structure_generation\rattle.py", line 214, in mc_rattle
raise Exception('Maxmium attempts for atom {}'.format(i))
Exception: Maxmium attempts for atom 0
POSCAR
C
1.0
1.2340150698661443 -2.1373767983138197 0.0000000000000000
1.2340150698661443 2.1373767983138197 0.0000000000000000
0.0000000000000000 0.0000000000000000 19.9982930000000003
C
2
direct
0.6666666666666666 0.3333333333333333 0.5000000000000000
0.3333333333333334 0.6666666666666667 0.5000000000000000