mirror of https://github.com/phonopy/phono3py.git
Merge branch 'develop'
This commit is contained in:
commit
7806f7eb67
|
@ -11,7 +11,7 @@ repos:
|
|||
exclude: ^example/AlN-LDA/
|
||||
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.9.7
|
||||
rev: v0.9.9
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: [ "--fix", "--show-fixes" ]
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
# Change Log
|
||||
|
||||
## Mar-4-2025: Version 3.15.0
|
||||
|
||||
- Release to follow the change of phonopy
|
||||
|
||||
## Mar-1-2025: Version 3.14.1
|
||||
|
||||
- Release to follow the change of phonopy
|
||||
|
|
|
@ -58,9 +58,9 @@ copyright = "2015, Atsushi Togo"
|
|||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = "3.14"
|
||||
version = "3.15"
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = "3.14.1"
|
||||
release = "3.15.0"
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
|
|
@ -64,7 +64,7 @@ in the distribution from GitHub or PyPI.
|
|||
`phono3py_params.yaml`. Use {ref}`--cf3 <cf3_option>` and {ref}`--sp
|
||||
<sp_option>` option simultaneously.
|
||||
4. Develop MLPs. By default, 90 and 10 percents of the dataset are used for the
|
||||
training and test, respectively. At this step `phono3py.pmlp` is saved.
|
||||
training and test, respectively. At this step `polymlp.yaml` is saved.
|
||||
5. Generate displacements in supercells either systematic or random displacements.
|
||||
6. Evaluate MLPs for forces of the supercells generated in step 5.
|
||||
7. Calculate force constants from displacement-force dataset from steps 5 and 6.
|
||||
|
@ -217,7 +217,7 @@ Regression: model selection ...
|
|||
- alpha = 1.000e-01 : rmse (train, test) = 0.00002 0.00002
|
||||
- alpha = 1.000e+00 : rmse (train, test) = 0.00002 0.00002
|
||||
- alpha = 1.000e+01 : rmse (train, test) = 0.00002 0.00002
|
||||
MLPs were written into "phono3py.pmlp"
|
||||
MLPs were written into "polymlp.yaml"
|
||||
------------------------------ pypolymlp end -------------------------------
|
||||
Generate displacements (--rd or -d) for proceeding to phonon calculations.
|
||||
Summary of calculation was written in "phono3py.yaml".
|
||||
|
@ -231,7 +231,7 @@ Summary of calculation was written in "phono3py.yaml".
|
|||
|
||||
Information about the development of MLPs using pypolymlp is provided between
|
||||
the `pypolymlp start` and `pypolymlp end` sections. The polynomial MLPs are
|
||||
saved in the `phono3py.pmlp` file, which can be reused in subsequent phono3py
|
||||
saved in the `polymlp.yaml` file, which can be reused in subsequent phono3py
|
||||
executions with the `--pypolymlp` option when only displacements (and no forces)
|
||||
are provided.
|
||||
|
||||
|
@ -240,7 +240,7 @@ are provided.
|
|||
|
||||
With the `-d` option, displacements are systematically generated while taking
|
||||
crystal symmetry into account. When running with the `--pypolymlp` option, MLPs
|
||||
are read from `phono3py.pmlp` if the file exists. In this case, training data is
|
||||
are read from `polymlp.yaml` if the file exists. In this case, training data is
|
||||
no longer required, and files such as `phono3py.yaml` can be used as the input
|
||||
structure file.
|
||||
|
||||
|
@ -274,7 +274,7 @@ NAC parameters were read from "phono3py.yaml".
|
|||
Pypolymlp is a generator of polynomial machine learning potentials.
|
||||
Please cite the paper: A. Seko, J. Appl. Phys. 133, 011101 (2023).
|
||||
Pypolymlp is developed at https://github.com/sekocha/pypolymlp.
|
||||
Load MLPs from "phono3py.pmlp".
|
||||
Load MLPs from "polymlp.yaml".
|
||||
------------------------------ pypolymlp end -------------------------------
|
||||
Generate displacements
|
||||
Displacement distance: 0.01
|
||||
|
@ -318,7 +318,7 @@ Random displacements are generated by specifying {ref}`--rd
|
|||
<random_displacements_option>` option. To compute force constants with random
|
||||
displacements, an external force constants calculator is necessary. By default,
|
||||
symfc is used unless another force constants solver is explicitly specified.
|
||||
When running with the `--pypolymlp` option, MLPs are read from `phono3py.pmlp`
|
||||
When running with the `--pypolymlp` option, MLPs are read from `polymlp.yaml`
|
||||
if the file exists. In this case, training data is no longer required, and files
|
||||
such as `phono3py.yaml` can be used as the input structure file.
|
||||
|
||||
|
@ -352,7 +352,7 @@ NAC parameters were read from "phono3py.yaml".
|
|||
Pypolymlp is a generator of polynomial machine learning potentials.
|
||||
Please cite the paper: A. Seko, J. Appl. Phys. 133, 011101 (2023).
|
||||
Pypolymlp is developed at https://github.com/sekocha/pypolymlp.
|
||||
Load MLPs from "phono3py.pmlp".
|
||||
Load MLPs from "polymlp.yaml".
|
||||
------------------------------ pypolymlp end -------------------------------
|
||||
Generate random displacements
|
||||
Twice of number of snapshots will be generated for plus-minus displacements.
|
||||
|
@ -406,10 +406,10 @@ displacements. Note that to achieve accurate force constants, the actual number
|
|||
of generated supercells is twice the specified number. If `--rd` is omitted,
|
||||
systematic displacements are introduced.
|
||||
|
||||
Once the file `phono3py.pmlp` is obtained, force constants can be calculated
|
||||
using MLPs from `phono3py.pmlp`. After removing the `fc3.hdf5` and `fc2.hdf5`
|
||||
files, `phono3py-load` will detect `phono3py.pmlp` and then compute the force
|
||||
constants by loading the MLPs from `phono3py.pmlp` as follows:
|
||||
Once the file `polymlp.yaml` is obtained, force constants can be calculated
|
||||
using MLPs from `polymlp.yaml`. After removing the `fc3.hdf5` and `fc2.hdf5`
|
||||
files, `phono3py-load` will detect `polymlp.yaml` and then compute the force
|
||||
constants by loading the MLPs from `polymlp.yaml` as follows:
|
||||
|
||||
```
|
||||
% phono3py-load --pypolymlp --rd 100 --amplitude 0.005 phono3py.yaml
|
||||
|
@ -441,7 +441,7 @@ NAC parameters were read from "phono3py.yaml".
|
|||
Pypolymlp is a generator of polynomial machine learning potentials.
|
||||
Please cite the paper: A. Seko, J. Appl. Phys. 133, 011101 (2023).
|
||||
Pypolymlp is developed at https://github.com/sekocha/pypolymlp.
|
||||
Load MLPs from "phono3py.pmlp".
|
||||
Load MLPs from "polymlp.yaml".
|
||||
------------------------------ pypolymlp end -------------------------------
|
||||
Generate random displacements
|
||||
Twice of number of snapshots will be generated for plus-minus displacements.
|
||||
|
@ -542,3 +542,14 @@ the next 100 supercells) will be computed and included. With this procedure in
|
|||
mind, it may be convenient to generate a sufficiently large number of supercells
|
||||
with random displacements in advance, such as 1000 supercells, before starting
|
||||
the LTC calculation with pypolymlp.
|
||||
|
||||
## Converting `phono3py.pmlp` to `polymlp.yaml`
|
||||
|
||||
In older versions, polynomial MLPs were stored in `phono3py.pmlp`. This file can
|
||||
be converted to `polymlp.yaml` using the following Python snippet.
|
||||
|
||||
```python
|
||||
from pypolymlp.mlp_dev.pypolymlp import Pypolymlp
|
||||
polymlp = Pypolymlp()
|
||||
polymlp.convert_to_yaml(filename_txt="phono3py.pmlp", filename_yaml="polymlp.yaml”)
|
||||
```
|
||||
|
|
|
@ -525,7 +525,7 @@ def run_pypolymlp_to_compute_forces(
|
|||
random_seed: Optional[int] = None,
|
||||
prepare_dataset: bool = False,
|
||||
cutoff_pair_distance: Optional[float] = None,
|
||||
mlp_filename: str = "phono3py.pmlp",
|
||||
mlp_filename: Optional[str] = None,
|
||||
log_level: int = 0,
|
||||
):
|
||||
"""Run pypolymlp to compute forces."""
|
||||
|
@ -535,27 +535,48 @@ def run_pypolymlp_to_compute_forces(
|
|||
print("Please cite the paper: A. Seko, J. Appl. Phys. 133, 011101 (2023).")
|
||||
print("Pypolymlp is developed at https://github.com/sekocha/pypolymlp.")
|
||||
|
||||
if pathlib.Path(mlp_filename).exists():
|
||||
if log_level:
|
||||
print(f'Load MLPs from "{mlp_filename}".')
|
||||
ph3py.load_mlp(mlp_filename)
|
||||
elif forces_in_dataset(ph3py.mlp_dataset):
|
||||
if log_level:
|
||||
if mlp_params is None:
|
||||
pmlp_params = PypolymlpParams()
|
||||
else:
|
||||
pmlp_params = parse_mlp_params(mlp_params)
|
||||
print("Parameters:")
|
||||
for k, v in asdict(pmlp_params).items():
|
||||
if v is not None:
|
||||
print(f" {k}: {v}")
|
||||
print("Developing MLPs by pypolymlp...", flush=True)
|
||||
ph3py.develop_mlp(params=mlp_params)
|
||||
ph3py.save_mlp(filename=mlp_filename)
|
||||
if log_level:
|
||||
print(f'MLPs were written into "{mlp_filename}"', flush=True)
|
||||
else:
|
||||
raise RuntimeError(f'"{mlp_filename}" is not found.')
|
||||
mlp_loaded = False
|
||||
for mlp_filename in ["polymlp.yaml", "phono3py.pmlp"]:
|
||||
_mlp_filename_list = list(pathlib.Path().glob(f"{mlp_filename}*"))
|
||||
if _mlp_filename_list:
|
||||
_mlp_filename = _mlp_filename_list[0]
|
||||
print(_mlp_filename)
|
||||
if _mlp_filename.suffix not in [
|
||||
".yaml",
|
||||
".pmlp",
|
||||
".xz",
|
||||
".gz",
|
||||
".bz2",
|
||||
"lzma",
|
||||
]:
|
||||
continue
|
||||
if log_level:
|
||||
print(f'Load MLPs from "{mlp_filename}".')
|
||||
ph3py.load_mlp(mlp_filename)
|
||||
mlp_loaded = True
|
||||
if log_level and mlp_filename == "phono3py.pmlp":
|
||||
print(f'Loading MLPs from "{_mlp_filename}" is obsolete.')
|
||||
break
|
||||
|
||||
mlp_filename = "polymlp.yaml"
|
||||
if not mlp_loaded:
|
||||
if forces_in_dataset(ph3py.mlp_dataset):
|
||||
if log_level:
|
||||
if mlp_params is None:
|
||||
pmlp_params = PypolymlpParams()
|
||||
else:
|
||||
pmlp_params = parse_mlp_params(mlp_params)
|
||||
print("Parameters:")
|
||||
for k, v in asdict(pmlp_params).items():
|
||||
if v is not None:
|
||||
print(f" {k}: {v}")
|
||||
print("Developing MLPs by pypolymlp...", flush=True)
|
||||
ph3py.develop_mlp(params=mlp_params)
|
||||
ph3py.save_mlp(filename=mlp_filename)
|
||||
if log_level:
|
||||
print(f'MLPs were written into "{mlp_filename}"', flush=True)
|
||||
else:
|
||||
raise RuntimeError(f'"{mlp_filename}" is not found.')
|
||||
|
||||
if log_level:
|
||||
print("-" * 30 + " pypolymlp end " + "-" * 31, flush=True)
|
||||
|
|
|
@ -1200,7 +1200,7 @@ def main(**argparse_control):
|
|||
)
|
||||
ph3py.save(mlp_eval_filename)
|
||||
|
||||
# pypolymlp dataset is stored in "phono3py.pmlp" and stop here.
|
||||
# pypolymlp dataset is stored in "polymlp.yaml" and stop here.
|
||||
if not prepare_dataset:
|
||||
if log_level:
|
||||
print(
|
||||
|
|
|
@ -34,4 +34,4 @@
|
|||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
__version__ = "3.14.1"
|
||||
__version__ = "3.15.0"
|
||||
|
|
|
@ -16,9 +16,10 @@ dependencies = [
|
|||
"matplotlib",
|
||||
"h5py",
|
||||
"spglib",
|
||||
"phonopy>=2.37.1,<2.38",
|
||||
"phonopy>=2.38.0,<2.39",
|
||||
]
|
||||
license = { file = "LICENSE" }
|
||||
license = "BSD-3-Clause"
|
||||
license-files = ["LICENSE"]
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://phonopy.github.io/phono3py/"
|
||||
|
|
|
@ -122,11 +122,11 @@ def test_phono3py_with_QE_calculator(load_phono3py_yaml):
|
|||
def test_phono3py_load_with_pypolymlp_si():
|
||||
"""Test phono3py-load script with pypolymlp.
|
||||
|
||||
First run generates phono3py.pmlp.
|
||||
Second run uses phono3py.pmlp.
|
||||
First run generates polymlp.yaml.
|
||||
Second run uses polymlp.yaml.
|
||||
|
||||
"""
|
||||
pytest.importorskip("pypolymlp")
|
||||
pytest.importorskip("pypolymlp", minversion="0.9.2")
|
||||
pytest.importorskip("symfc")
|
||||
|
||||
argparse_control = _get_phono3py_load_args(
|
||||
|
@ -159,7 +159,7 @@ def test_phono3py_load_with_pypolymlp_si():
|
|||
"phono3py.yaml",
|
||||
"fc2.hdf5",
|
||||
"fc3.hdf5",
|
||||
"phono3py.pmlp",
|
||||
"polymlp.yaml",
|
||||
"phono3py_mlp_eval_dataset.yaml",
|
||||
):
|
||||
file_path = pathlib.Path(cwd_called / created_filename)
|
||||
|
|
Loading…
Reference in New Issue