Force constants calculated with phonopy

Dear Members,
I am using hiPhive for the first time to correct FCs obtained from phonopy. At the first stage I need to phonopy-FCS must be converted to a ForceConstantPotential. I am following the steps given here
hiphive.force_constant_potential — hiPhive documentation. However when I reaches
“from .core.orbits import Orbit” the below error appears.

" File “”, line 12, in
from .core.atoms import Atoms
ImportError: attempted relative import with no known parent package

Kindly help me to overcome this issue.

Kind regards,

Could you attach the full python script you are running to help understand where the error is coming from?
What python version are you using?

Thank you for your prompt reply. I have raw_Froce_Constants from phonopy and using python3 combined with the script ( given in hiphive-master/hiphive/. Sorry I can not upload being a new user. Please let me know another way to send it if required.

The script starts as:

This module introduces the ForceConstantPotential object which acts as the
finalized force constant model.

import pickle
import tarfile
import numpy as np

from collections import Counter
from typing import Any, Dict, List
from .core.atoms import Atoms
from .force_constant_model import ForceConstantModel
from .core.orbits import Orbit
from .core.orbits import OrientationFamily

I dont think you should be running the file.

Instead create a new script and try running something like the one below. But exactly what you put into your script will depend on what you mean by “correct phonopy FCs”.

from import read
from hiphive import ClusterSpace, ForceConstantPotential
from hiphive.cutoffs import estimate_maximum_cutoff
from hiphive.utilities import extract_parameters

prim = read('POSCAR')
supercell = read('SPOSCAR')

# Define a cluster space using the largest cutoff you can
max_cutoff = estimate_maximum_cutoff(supercell) - 0.01
cutoffs = [max_cutoff]  # only second order needed
cs = ClusterSpace(prim, cutoffs)

# import the phonopy force constants using the correct supercell also provided by phonopy
fcs = ForceConstants.read_phonopy(supercell, 'fc2.hdf5')

# Find the parameters that best fits the force constants given you cluster space
parameters = extract_parameters(fcs, cs)

fcp = ForceConstantPotential(cs, parameters)

Dear Dr. Erik Fransson,
Sorry I could not describe the problem well. I obtained 2nd order force constants from phonopy but the phonon spectra show clear deviations from quadraticity in the ZA branch near Gamma (i.e., the breakdown of rotational symmetry). Therefore, I want to correct the force constant using hiPhive.

Thank you for leading me to use the correct script. I was successful to generate the force constants after enforcing the rotational sum rules (H, BH). However, I obtained the negative Force_constants. Can you please suggest the solution to this problem?

True Regards,