Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove v1 compatibility #200

Merged
merged 1 commit into from
Dec 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions phono3py/api_isotope.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

import warnings

import numpy as np
from phonopy.units import VaspToTHz

Expand All @@ -53,7 +51,6 @@ def __init__(
sigmas=None,
frequency_factor_to_THz=VaspToTHz,
use_grg=False,
store_dense_gp_map=True,
symprec=1e-5,
cutoff_frequency=None,
lapack_zheev_uplo="L",
Expand All @@ -66,21 +63,13 @@ def __init__(
else:
self._sigmas = sigmas

if not store_dense_gp_map:
warnings.warn(
"Phono3pyIsotope init parameter of store_dense_gp_map is deprecated. "
"This will be always set True.",
DeprecationWarning,
)

self._iso = Isotope(
mesh,
primitive,
mass_variances=mass_variances,
band_indices=band_indices,
frequency_factor_to_THz=frequency_factor_to_THz,
use_grg=use_grg,
store_dense_gp_map=store_dense_gp_map,
symprec=symprec,
cutoff_frequency=cutoff_frequency,
lapack_zheev_uplo=lapack_zheev_uplo,
Expand Down
14 changes: 1 addition & 13 deletions phono3py/api_jointdos.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

import warnings

import numpy as np
from phonopy.structure.cells import Primitive, Supercell
from phonopy.structure.symmetry import Symmetry
Expand Down Expand Up @@ -72,7 +70,6 @@ def __init__(
SNF_coordinates="reciprocal",
is_mesh_symmetry=True,
is_symmetry=True,
store_dense_gp_map=True,
symprec=1e-5,
output_filename=None,
log_level=0,
Expand All @@ -94,14 +91,6 @@ def __init__(
self._is_mesh_symmetry = is_mesh_symmetry
self._is_symmetry = is_symmetry

if not store_dense_gp_map:
warnings.warn(
"Phono3pyJointDos init parameter of store_dense_gp_map is deprecated. "
"This will be set always True.",
DeprecationWarning,
)
self._store_dense_gp_map = store_dense_gp_map

self._use_grg = use_grg
self._SNF_coordinates = SNF_coordinates
self._symprec = symprec
Expand Down Expand Up @@ -165,7 +154,7 @@ def mesh_numbers(self, mesh_numbers):
use_grg=self._use_grg,
force_SNF=False,
SNF_coordinates=self._SNF_coordinates,
store_dense_gp_map=self._store_dense_gp_map,
store_dense_gp_map=True,
)

def initialize(self, mesh_numbers):
Expand All @@ -180,7 +169,6 @@ def initialize(self, mesh_numbers):
frequency_factor_to_THz=self._frequency_factor_to_THz,
frequency_scale_factor=self._frequency_scale_factor,
is_mesh_symmetry=self._is_mesh_symmetry,
store_dense_gp_map=self._store_dense_gp_map,
symprec=self._symprec,
filename=self._filename,
log_level=self._log_level,
Expand Down
85 changes: 16 additions & 69 deletions phono3py/api_phono3py.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,10 @@ def __init__(
is_mesh_symmetry=True,
use_grg=False,
SNF_coordinates="reciprocal",
symmetrize_fc3q=None,
store_dense_gp_map=True,
store_dense_svecs=True,
make_r0_average: bool = False,
symprec=1e-5,
calculator: Optional[str] = None,
log_level=0,
lapack_zheev_uplo=None,
):
"""Init method.

Expand Down Expand Up @@ -213,23 +210,18 @@ def __init__(
`reciprocal` or `direct`. Space of coordinates to generate grid
generating matrix either in direct or reciprocal space. The default
is `reciprocal`.
symmetrize_fc3q : Deprecated.
See Phono3py.init_phph_interaction().
store_dense_gp_map : bool, optional, Deprecated.
Use dense format of BZ grid system. Default is True.
store_dense_svecs : bool, optional, Deprecated.
Shortest vectors are stored in the dense array format. This is
expected to be always True. Setting False is for rough compatibility
with v1.x. Default is True.
make_r0_average : bool, optional
fc3 transformation from real to reciprocal space is done
around three atoms and averaged when True. Default is False, i.e.,
only around the first atom. Setting False is for rough compatibility
with v2.x. Default is True.
symprec : float, optional
Tolerance used to find crystal symmetry. Default is 1e-5.
calculator : str, optional.
Calculator used for computing forces. This is used to switch the set
of physical units. Default is None, which is equivalent to "vasp".
log_level : int, optional
Verbosity control. Default is 0. This can be 0, 1, or 2.
lapack_zheev_uplo : Deprecated.
See Phono3py.init_phph_interaction().

"""
self._symprec = symprec
Expand All @@ -239,21 +231,13 @@ def __init__(
self._use_grg = use_grg
self._SNF_coordinates = SNF_coordinates

if not store_dense_gp_map:
warnings.warn(
"Phono3py init parameter of store_dense_gp_map is deprecated. "
"This will be set always True.",
DeprecationWarning,
)
self._store_dense_gp_map = store_dense_gp_map

if not store_dense_svecs:
if not make_r0_average:
warnings.warn(
"Phono3py init parameter of store_dense_svecs is deprecated. "
"This will be set always True.",
"Phono3py init parameter of make_r0_average is deprecated. "
"This is always True but exists for backward compatibility.",
DeprecationWarning,
)
self._store_dense_svecs = store_dense_svecs
self._make_r0_average = make_r0_average

self._cutoff_frequency = cutoff_frequency
self._calculator: Optional[str] = calculator
Expand Down Expand Up @@ -361,26 +345,6 @@ def __init__(
)
self.sigma_cutoff = sigma_cutoff

if symmetrize_fc3q is not None:
warnings.warn(
"Phono3py init parameter of symmetrize_fc3q is deprecated. "
"Set this at Phono3py.init_phph_interaction().",
DeprecationWarning,
)
self._symmetrize_fc3q = symmetrize_fc3q
else:
self._symmetrize_fc3q = None

if lapack_zheev_uplo is not None:
warnings.warn(
"Phono3py init parameter of lapack_zheev_uplo is deprecated. "
"Set this at Phono3py.init_phph_interaction().",
DeprecationWarning,
)
self._lapack_zheev_uplo = lapack_zheev_uplo
else:
self._lapack_zheev_uplo = None

@property
def version(self):
"""Return phono3py release version number.
Expand Down Expand Up @@ -1331,8 +1295,7 @@ def init_phph_interaction(
nac_q_direction=None,
constant_averaged_interaction=None,
frequency_scale_factor=None,
symmetrize_fc3q=False,
make_r0_average=False,
symmetrize_fc3q: bool = False,
lapack_zheev_uplo="L",
openmp_per_triplets=None,
):
Expand Down Expand Up @@ -1367,10 +1330,6 @@ def init_phph_interaction(
symmetrize_fc3q : bool, optional
fc3 in phonon space is symmetrized by permutation symmetry.
Default is False.
make_r0_average : bool, optional
fc3 transformation from real to reciprocal space is done
around three atoms and averaged when True. Default is False, i.e.,
only around the first atom.
lapack_zheev_uplo : str, optional
'L' or 'U'. Default is 'L'. This is passed to LAPACK zheev
used for phonon solver.
Expand All @@ -1389,16 +1348,6 @@ def init_phph_interaction(
msg = "Phono3py.fc2 of instance is not found."
raise RuntimeError(msg)

if self._symmetrize_fc3q is None:
_symmetrize_fc3q = symmetrize_fc3q
else:
_symmetrize_fc3q = self._symmetrize_fc3q

if self._lapack_zheev_uplo is None:
_lapack_zheev_uplo = lapack_zheev_uplo
else:
_lapack_zheev_uplo = self._lapack_zheev_uplo

self._interaction = Interaction(
self._primitive,
self._bz_grid,
Expand All @@ -1410,9 +1359,9 @@ def init_phph_interaction(
frequency_scale_factor=frequency_scale_factor,
cutoff_frequency=self._cutoff_frequency,
is_mesh_symmetry=self._is_mesh_symmetry,
symmetrize_fc3q=_symmetrize_fc3q,
make_r0_average=make_r0_average,
lapack_zheev_uplo=_lapack_zheev_uplo,
symmetrize_fc3q=symmetrize_fc3q,
make_r0_average=self._make_r0_average,
lapack_zheev_uplo=lapack_zheev_uplo,
openmp_per_triplets=openmp_per_triplets,
)
self._interaction.nac_q_direction = nac_q_direction
Expand Down Expand Up @@ -2545,9 +2494,7 @@ def _get_primitive_cell(self, supercell, supercell_matrix, primitive_matrix):
else:
t_mat = np.dot(inv_supercell_matrix, primitive_matrix)

return get_primitive(
supercell, t_mat, self._symprec, store_dense_svecs=self._store_dense_svecs
)
return get_primitive(supercell, t_mat, self._symprec, store_dense_svecs=True)

def _determine_primitive_matrix(self, primitive_matrix):
pmat = get_primitive_matrix(primitive_matrix, symprec=self._symprec)
Expand All @@ -2571,7 +2518,7 @@ def _set_mesh_numbers(
use_grg=self._use_grg,
force_SNF=False,
SNF_coordinates=self._SNF_coordinates,
store_dense_gp_map=self._store_dense_gp_map,
store_dense_gp_map=True,
)

def _init_dynamical_matrix(self):
Expand Down
10 changes: 0 additions & 10 deletions phono3py/cui/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ def load(
is_mesh_symmetry=True,
is_compact_fc=False,
use_grg=False,
store_dense_gp_map=True,
store_dense_svecs=True,
symprec=1e-5,
log_level=0,
) -> Phono3py:
Expand Down Expand Up @@ -229,12 +227,6 @@ def load(
cells. Default is False.
use_grg : bool, optional
Use generalized regular grid when True. Default is False.
store_dense_gp_map : bool, optional, Deprecated
Use new format of BZ grid system. Default is True.
store_dense_svecs : bool, optional, Deprecated
Shortest vectors are stored in the dense array format. This is expected
to be always True. Setting False is for rough compatibility with v1.x.
Default is True.
symprec : float, optional
Tolerance used to find crystal symmetry. Default is 1e-5.
log_level : int, optional
Expand Down Expand Up @@ -305,8 +297,6 @@ def load(
is_symmetry=is_symmetry,
is_mesh_symmetry=is_mesh_symmetry,
use_grg=use_grg,
store_dense_gp_map=store_dense_gp_map,
store_dense_svecs=store_dense_svecs,
calculator=calculator,
log_level=log_level,
)
Expand Down
2 changes: 1 addition & 1 deletion phono3py/cui/phono3py_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,7 @@ def init_phono3py(
is_symmetry=settings.is_symmetry,
is_mesh_symmetry=settings.is_mesh_symmetry,
use_grg=settings.use_grg,
make_r0_average=settings.is_fc3_r0_average,
symprec=symprec,
calculator=interface_mode,
log_level=log_level,
Expand Down Expand Up @@ -1036,7 +1037,6 @@ def init_phph_interaction(
constant_averaged_interaction=ave_pp,
frequency_scale_factor=updated_settings["frequency_scale_factor"],
symmetrize_fc3q=settings.is_symmetrize_fc3_q,
make_r0_average=settings.is_fc3_r0_average,
lapack_zheev_uplo=settings.lapack_zheev_uplo,
)

Expand Down
3 changes: 1 addition & 2 deletions phono3py/other/isotope.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ def __init__(
bz_grid=None,
frequency_factor_to_THz=VaspToTHz,
use_grg=False,
store_dense_gp_map=True,
symprec=1e-5,
cutoff_frequency=None,
lapack_zheev_uplo="L",
Expand Down Expand Up @@ -146,7 +145,7 @@ def __init__(
lattice=self._primitive.cell,
symmetry_dataset=primitive_symmetry.dataset,
use_grg=use_grg,
store_dense_gp_map=store_dense_gp_map,
store_dense_gp_map=True,
)

def set_grid_point(self, grid_point):
Expand Down
6 changes: 4 additions & 2 deletions phono3py/other/tetrahedron_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@
import numpy as np
from phonopy.structure.tetrahedron_method import TetrahedronMethod

from phono3py.phonon.grid import BZGrid

def get_unique_grid_points(grid_points, bz_grid):

def get_unique_grid_points(grid_points, bz_grid: BZGrid):
"""Collect grid points on tetrahedron vertices around input grid points.

Find grid points of 24 tetrahedra around each grid point and
Expand Down Expand Up @@ -88,7 +90,7 @@ def get_unique_grid_points(grid_points, bz_grid):
def get_integration_weights(
sampling_points,
grid_values,
bz_grid,
bz_grid: BZGrid,
grid_points=None,
bzgp2irgp_map=None,
function="I",
Expand Down
14 changes: 5 additions & 9 deletions phono3py/phonon3/gruneisen.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@

import numpy as np
from phonopy.harmonic.dynamical_matrix import get_dynamical_matrix
from phonopy.structure.cells import sparse_to_dense_svecs
from phonopy.structure.atoms import PhonopyAtoms
from phonopy.structure.cells import Primitive
from phonopy.structure.grid_points import get_qpoints
from phonopy.units import VaspToTHz

Expand Down Expand Up @@ -126,8 +127,8 @@
self,
fc2,
fc3,
supercell,
primitive,
supercell: PhonopyAtoms,
primitive: Primitive,
nac_params=None,
nac_q_direction=None,
ion_clamped=False,
Expand All @@ -151,12 +152,7 @@
)
self._nac_q_direction = nac_q_direction

svecs, multi = self._pcell.get_smallest_vectors()
if self._pcell.store_dense_svecs:
self._svecs = svecs
self._multi = multi
else:
self._svecs, self._multi = sparse_to_dense_svecs(svecs, multi)
self._svecs, self._multi = self._pcell.get_smallest_vectors()

Check warning on line 155 in phono3py/phonon3/gruneisen.py

View check run for this annotation

Codecov / codecov/patch

phono3py/phonon3/gruneisen.py#L155

Added line #L155 was not covered by tests

if self._ion_clamped:
num_atom_prim = len(self._pcell)
Expand Down
Loading
Loading