Enforcing rotational symmetry to phonopy obtained FC

Hello experts,
I am facing an error while enforcing the rotational sum rule to my force constants obtained from PHONOPY.
File “/home/murari/anaconda3/lib/python3.8/site-packages/hiphive/core/utilities.py”, line 170, in index
return self._dict[value]
KeyError: Atom(12, (-2, -1, 0))
This is the error I am facing, I am also describing the script file used to enforce sum rule:- from ase.io import read
#from hiphive import *
from hiphive import ForceConstants
from hiphive import ClusterSpace, ForceConstantPotential, enforce_rotational_sum_rules
from hiphive.cutoffs import estimate_maximum_cutoff
from hiphive.utilities import extract_parameters

Define a cluster space using the largest cutoff you can

max_cutoff = estimate_maximum_cutoff(supercell)-0.001
cutoffs = [max_cutoff] # only second order needed
cs = ClusterSpace(prim, cutoffs)

Find the parameters that best fits the force constants given you cluster space

parameters = extract_parameters(fcs, cs)

Enforce the rotational sum rules

parameters_rot = enforce_rotational_sum_rules(cs, parameters, [‘Huang’ ,‘Born-Huang’])
#parameters_trans = enforce_translational_sum_rules

use the new parameters to make a fcp and then create the force constants and write to a phonopy file

fcp = ForceConstantPotential(cs, parameters_rot)
fcs = fcp.get_force_constants(supercell)
fcs.write_to_phonopy(‘FORCE_CONSTANTS’, format=‘text’)

My system is a 2D system with a unit-cell made of 15 atoms. The unit-cell I have made is actually a kind of doped system made of 221. Please any kind of suggestion will be helpful. I have also used same script for normal 2D systems earlier, it worked fine for me. But this time I think the complicated structure is an issue.

Hi,
Do you know which version of hiphive you’re using? (I dont think this is the issue but always good idea to try with the latest version)
Can you post the full error message and also the POSCAR and SPOSCAR files?
Is the SPOSCAR a phonopy supercell based on POSCAR?

If you wrap your code blocks in triple ``` you’ll get nicer formatting and make it more readable.

1 Like

Yes I also get this error when running your script. This error is caused with some problematic handling of tolerances in hiphive.

If you include

``````prim.set_scaled_positions(prim.get_scaled_positions().round(6))
``````

in your script, it should run fine (atleast ClusterSpace construction works for me).

1 Like

Thanks a lot, Sir,
It worked for me also.