mirror of https://github.com/phonopy/phono3py.git
Merge branch 'develop' into rc
This commit is contained in:
commit
090def079a
|
@ -12,8 +12,7 @@ jobs:
|
|||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest]
|
||||
# os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-latest]
|
||||
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
|
|
@ -11,7 +11,7 @@ repos:
|
|||
exclude: ^example/AlN-LDA/
|
||||
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.9.3
|
||||
rev: v0.9.4
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: [ "--fix", "--show-fixes" ]
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
# Change Log
|
||||
|
||||
## Feb-5-2025: Version 3.13.0
|
||||
|
||||
- Release to follow the change of phonopy
|
||||
|
||||
## Feb-1-2025: Version 3.12.2
|
||||
|
||||
- Fix an openmp related bug in computing collision matrix in C
|
||||
|
|
|
@ -58,9 +58,9 @@ copyright = "2015, Atsushi Togo"
|
|||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = "3.12"
|
||||
version = "3.13"
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = "3.12.2"
|
||||
release = "3.13.0"
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
|
|
@ -54,7 +54,10 @@ from phono3py.cui.create_force_constants import (
|
|||
run_pypolymlp_to_compute_forces,
|
||||
)
|
||||
from phono3py.file_IO import read_fc2_from_hdf5, read_fc3_from_hdf5
|
||||
from phono3py.interface.fc_calculator import extract_fc2_fc3_calculators
|
||||
from phono3py.interface.fc_calculator import (
|
||||
extract_fc2_fc3_calculators,
|
||||
update_cutoff_fc_calculator_options,
|
||||
)
|
||||
from phono3py.interface.phono3py_yaml import Phono3pyYaml
|
||||
from phono3py.phonon3.dataset import forces_in_dataset
|
||||
from phono3py.phonon3.fc3 import show_drift_fc3
|
||||
|
@ -435,6 +438,7 @@ def compute_force_constants_from_datasets(
|
|||
ph3py: Phono3py,
|
||||
fc_calculator: Optional[str] = None,
|
||||
fc_calculator_options: Optional[Union[dict, str]] = None,
|
||||
cutoff_pair_distance: Optional[float] = None,
|
||||
symmetrize_fc: bool = True,
|
||||
is_compact_fc: bool = True,
|
||||
log_level: int = 0,
|
||||
|
@ -453,13 +457,18 @@ def compute_force_constants_from_datasets(
|
|||
"""
|
||||
fc3_calculator = extract_fc2_fc3_calculators(fc_calculator, 3)
|
||||
fc2_calculator = extract_fc2_fc3_calculators(fc_calculator, 2)
|
||||
fc3_calc_opts = extract_fc2_fc3_calculators(fc_calculator_options, 3)
|
||||
fc3_calc_opts = update_cutoff_fc_calculator_options(
|
||||
fc3_calc_opts, cutoff_pair_distance
|
||||
)
|
||||
fc2_calc_opts = extract_fc2_fc3_calculators(fc_calculator_options, 2)
|
||||
exist_fc2 = ph3py.fc2 is not None
|
||||
if ph3py.fc3 is None and forces_in_dataset(ph3py.dataset):
|
||||
ph3py.produce_fc3(
|
||||
symmetrize_fc3r=symmetrize_fc,
|
||||
is_compact_fc=is_compact_fc,
|
||||
fc_calculator=fc3_calculator,
|
||||
fc_calculator_options=extract_fc2_fc3_calculators(fc_calculator_options, 3),
|
||||
fc_calculator_options=fc3_calc_opts,
|
||||
)
|
||||
|
||||
if log_level and symmetrize_fc and fc_calculator is None:
|
||||
|
@ -476,9 +485,7 @@ def compute_force_constants_from_datasets(
|
|||
symmetrize_fc2=symmetrize_fc,
|
||||
is_compact_fc=is_compact_fc,
|
||||
fc_calculator=fc2_calculator,
|
||||
fc_calculator_options=extract_fc2_fc3_calculators(
|
||||
fc_calculator_options, 2
|
||||
),
|
||||
fc_calculator_options=fc2_calc_opts,
|
||||
)
|
||||
if log_level and symmetrize_fc and fc_calculator is None:
|
||||
print("fc2 was symmetrized.")
|
||||
|
|
|
@ -158,12 +158,6 @@ def finalize_phono3py(
|
|||
else:
|
||||
yaml_filename = filename
|
||||
|
||||
if phono3py.mlp is not None and phono3py.dataset is not None:
|
||||
mlp_eval_filename = "phono3py_mlp_eval_dataset.yaml"
|
||||
if log_level:
|
||||
print(f'Dataset generated using MLPs was written in "{mlp_eval_filename}".')
|
||||
phono3py.save(mlp_eval_filename)
|
||||
|
||||
_physical_units = get_default_physical_units(phono3py.calculator)
|
||||
|
||||
ph3py_yaml = Phono3pyYaml(
|
||||
|
@ -603,6 +597,7 @@ def _store_force_constants(ph3py: Phono3py, settings: Phono3pySettings, log_leve
|
|||
|
||||
load_fc2_and_fc3(ph3py, log_level=log_level)
|
||||
|
||||
cutoff_pair_distance = get_cutoff_pair_distance(settings)
|
||||
(fc_calculator, fc_calculator_options) = get_fc_calculator_params(
|
||||
settings, log_level=(not read_fc3) * 1
|
||||
)
|
||||
|
@ -611,6 +606,7 @@ def _store_force_constants(ph3py: Phono3py, settings: Phono3pySettings, log_leve
|
|||
ph3py,
|
||||
fc_calculator=fc_calculator,
|
||||
fc_calculator_options=fc_calculator_options,
|
||||
cutoff_pair_distance=cutoff_pair_distance,
|
||||
symmetrize_fc=settings.fc_symmetry,
|
||||
is_compact_fc=settings.is_compact_fc,
|
||||
log_level=log_level,
|
||||
|
@ -623,6 +619,7 @@ def _store_force_constants(ph3py: Phono3py, settings: Phono3pySettings, log_leve
|
|||
ph3py,
|
||||
fc_calculator="symfc",
|
||||
fc_calculator_options=fc_calculator_options,
|
||||
cutoff_pair_distance=cutoff_pair_distance,
|
||||
symmetrize_fc=settings.fc_symmetry,
|
||||
is_compact_fc=settings.is_compact_fc,
|
||||
log_level=log_level,
|
||||
|
@ -1169,6 +1166,15 @@ def main(**argparse_control):
|
|||
log_level=log_level,
|
||||
)
|
||||
|
||||
if ph3py.dataset is not None:
|
||||
mlp_eval_filename = "phono3py_mlp_eval_dataset.yaml"
|
||||
if log_level:
|
||||
print(
|
||||
"Dataset generated using MLPs was written in "
|
||||
f'"{mlp_eval_filename}".'
|
||||
)
|
||||
ph3py.save(mlp_eval_filename)
|
||||
|
||||
# pypolymlp dataset is stored in "phono3py.pmlp" and stop here.
|
||||
if not prepare_dataset:
|
||||
if log_level:
|
||||
|
|
|
@ -118,7 +118,10 @@ def get_fc3(
|
|||
raise RuntimeError(msg)
|
||||
|
||||
|
||||
def extract_fc2_fc3_calculators(fc_calculator: Optional[Union[str, dict]], order: int):
|
||||
def extract_fc2_fc3_calculators(
|
||||
fc_calculator: Optional[Union[str, dict]],
|
||||
order: int,
|
||||
) -> Optional[Union[str, dict]]:
|
||||
"""Extract fc_calculator and fc_calculator_options for fc2 and fc3.
|
||||
|
||||
fc_calculator : str
|
||||
|
@ -141,4 +144,32 @@ def extract_fc2_fc3_calculators(fc_calculator: Optional[Union[str, dict]], order
|
|||
return None
|
||||
return fc_calculator
|
||||
else:
|
||||
raise RuntimeError("fc_calculator should be str or dict.")
|
||||
raise RuntimeError("fc_calculator should be str, dict, or None.")
|
||||
|
||||
|
||||
def update_cutoff_fc_calculator_options(
|
||||
fc_calc_opts: Optional[Union[str, dict]],
|
||||
cutoff_pair_distance: Optional[float],
|
||||
) -> Optional[Union[str, dict]]:
|
||||
"""Update fc_calculator_options with cutoff distances.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
fc_calc_opts : str or dict
|
||||
FC calculator options.
|
||||
cutoff_pair_distance : float, optional
|
||||
Cutoff distance for pair interaction.
|
||||
|
||||
"""
|
||||
if cutoff_pair_distance is not None:
|
||||
if not isinstance(fc_calc_opts, (str, dict)) and fc_calc_opts is not None:
|
||||
raise RuntimeError("fc_calculator_options should be str, dict, or None.")
|
||||
|
||||
if isinstance(fc_calc_opts, dict) and "cutoff" not in fc_calc_opts:
|
||||
fc_calc_opts["cutoff"] = float(cutoff_pair_distance)
|
||||
elif isinstance(fc_calc_opts, str) and "cutoff" not in fc_calc_opts:
|
||||
fc_calc_opts = f"{fc_calc_opts}, cutoff = {cutoff_pair_distance}"
|
||||
elif fc_calc_opts is None:
|
||||
fc_calc_opts = f"cutoff = {cutoff_pair_distance}"
|
||||
|
||||
return fc_calc_opts
|
||||
|
|
|
@ -34,4 +34,4 @@
|
|||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
__version__ = "3.12.2"
|
||||
__version__ = "3.13.0"
|
||||
|
|
|
@ -16,7 +16,7 @@ dependencies = [
|
|||
"matplotlib",
|
||||
"h5py",
|
||||
"spglib",
|
||||
"phonopy>=2.35,<2.36",
|
||||
"phonopy>=2.36,<2.37",
|
||||
]
|
||||
license = { file = "LICENSE" }
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ def test_random_disps_agno2(
|
|||
is_plusminus=is_plusminus,
|
||||
)
|
||||
|
||||
for d, n_d in zip((ph3.displacements, ph3.phonon_displacements), (92, 4)):
|
||||
for d, n_d in zip((ph3.displacements, ph3.phonon_displacements), (96, 4)):
|
||||
if number_of_snapshots == "auto":
|
||||
assert len(d) == n_d * (is_plusminus + 1)
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue