mirror of https://github.com/phonopy/phono3py.git
Refine behaviour of symfc-memsize
This commit is contained in:
parent
4a735f317e
commit
e10b20260a
|
@ -457,7 +457,6 @@ def run_pypolymlp_to_compute_forces(
|
|||
fc_calculator: Optional[str] = None,
|
||||
fc_calculator_options: Optional[str] = None,
|
||||
cutoff_pair_distance: Optional[float] = None,
|
||||
random_displacements: Optional[str] = None,
|
||||
symfc_memory_size: Optional[float] = None,
|
||||
mlp_filename: Optional[str] = None,
|
||||
log_level: int = 0,
|
||||
|
@ -542,8 +541,8 @@ def run_pypolymlp_to_compute_forces(
|
|||
fc_calculator=fc_calculator,
|
||||
fc_calculator_options=fc_calculator_options,
|
||||
cutoff_pair_distance=cutoff_pair_distance,
|
||||
random_displacements=random_displacements,
|
||||
symfc_memory_size=symfc_memory_size,
|
||||
random_displacements=number_of_snapshots,
|
||||
supercell=ph3py.supercell,
|
||||
primitive=ph3py.primitive,
|
||||
symmetry=ph3py.symmetry,
|
||||
|
|
|
@ -94,8 +94,8 @@ def create_phono3py_supercells(
|
|||
fc_calculator=settings.fc_calculator,
|
||||
fc_calculator_options=settings.fc_calculator_options,
|
||||
cutoff_pair_distance=settings.cutoff_pair_distance,
|
||||
random_displacements=settings.random_displacements,
|
||||
symfc_memory_size=settings.symfc_memory_size,
|
||||
random_displacements=settings.random_displacements,
|
||||
supercell=ph3.supercell,
|
||||
primitive=ph3.primitive,
|
||||
symmetry=ph3.symmetry,
|
||||
|
|
|
@ -598,15 +598,27 @@ def _store_force_constants(ph3py: Phono3py, settings: Phono3pySettings, log_leve
|
|||
|
||||
load_fc2_and_fc3(ph3py, log_level=log_level)
|
||||
|
||||
cutoff_pair_distance = determine_cutoff_pair_distance(
|
||||
fc_calculator=settings.fc_calculator,
|
||||
fc_calculator_options=settings.fc_calculator_options,
|
||||
cutoff_pair_distance=settings.cutoff_pair_distance,
|
||||
)
|
||||
cutoff_pair_distance = None
|
||||
if settings.use_pypolymlp:
|
||||
cutoff_pair_distance = ph3py.dataset.get("cutoff_distance")
|
||||
if cutoff_pair_distance is None:
|
||||
cutoff_pair_distance = determine_cutoff_pair_distance(
|
||||
fc_calculator=settings.fc_calculator,
|
||||
fc_calculator_options=settings.fc_calculator_options,
|
||||
cutoff_pair_distance=settings.cutoff_pair_distance,
|
||||
symfc_memory_size=settings.symfc_memory_size,
|
||||
random_displacements=settings.random_displacements,
|
||||
supercell=ph3py.supercell,
|
||||
primitive=ph3py.primitive,
|
||||
log_level=log_level,
|
||||
)
|
||||
if cutoff_pair_distance is None:
|
||||
cutoff_pair_distance = ph3py.dataset.get("cutoff_distance")
|
||||
|
||||
(fc_calculator, fc_calculator_options) = get_fc_calculator_params(
|
||||
settings.fc_calculator,
|
||||
settings.fc_calculator_options,
|
||||
settings.cutoff_pair_distance,
|
||||
cutoff_pair_distance,
|
||||
log_level=(not read_fc3) * 1,
|
||||
)
|
||||
try:
|
||||
|
@ -1186,7 +1198,6 @@ def main(**argparse_control):
|
|||
fc_calculator=settings.fc_calculator,
|
||||
fc_calculator_options=settings.fc_calculator_options,
|
||||
cutoff_pair_distance=settings.cutoff_pair_distance,
|
||||
random_displacements=settings.random_displacements,
|
||||
symfc_memory_size=settings.symfc_memory_size,
|
||||
prepare_dataset=prepare_dataset,
|
||||
log_level=log_level,
|
||||
|
|
|
@ -214,8 +214,8 @@ def determine_cutoff_pair_distance(
|
|||
fc_calculator: Optional[str] = None,
|
||||
fc_calculator_options: Optional[str] = None,
|
||||
cutoff_pair_distance: Optional[float] = None,
|
||||
random_displacements: Optional[str] = None,
|
||||
symfc_memory_size: Optional[float] = None,
|
||||
random_displacements: Optional[Union[int, str]] = None,
|
||||
supercell: Optional[PhonopyAtoms] = None,
|
||||
primitive: Optional[Primitive] = None,
|
||||
symmetry: Optional[Symmetry] = None,
|
||||
|
@ -228,8 +228,12 @@ def determine_cutoff_pair_distance(
|
|||
cutoff_pair_distance,
|
||||
symfc_memory_size,
|
||||
)
|
||||
if random_displacements == "auto" and _symfc_memory_size is not None:
|
||||
if fc_calculator != "symfc":
|
||||
if random_displacements is not None and random_displacements != "auto":
|
||||
_symfc_memory_size = None
|
||||
if _symfc_memory_size is not None:
|
||||
if fc_calculator is None:
|
||||
pass
|
||||
elif fc_calculator != "symfc":
|
||||
raise RuntimeError(
|
||||
"Estimation of cutoff_pair_distance by memory size is only "
|
||||
"available for symfc calculator."
|
||||
|
|
|
@ -230,7 +230,7 @@ def test_phono3py_load_with_pypolymlp_nacl():
|
|||
|
||||
# Stage2 (cutoff test)
|
||||
argparse_control = _get_phono3py_load_args(
|
||||
cwd / ".." / "phono3py.yaml",
|
||||
cwd_called / "phono3py.yaml",
|
||||
fc_calculator="symfc",
|
||||
fc_calculator_options="|cutoff=4.0",
|
||||
random_displacements="auto",
|
||||
|
@ -263,7 +263,7 @@ def test_phono3py_load_with_pypolymlp_nacl():
|
|||
|
||||
# Stage3 (memsize test)
|
||||
argparse_control = _get_phono3py_load_args(
|
||||
cwd / ".." / "phono3py.yaml",
|
||||
cwd_called / "phono3py.yaml",
|
||||
fc_calculator="symfc",
|
||||
fc_calculator_options="|memsize=0.05",
|
||||
random_displacements="auto",
|
||||
|
|
|
@ -29,7 +29,6 @@ def test_determine_cutoff_pair_distance_with_memsize(aln_cell: PhonopyAtoms) ->
|
|||
cutoff = determine_cutoff_pair_distance(
|
||||
fc_calculator="symfc",
|
||||
fc_calculator_options="|memsize=0.1",
|
||||
random_displacements="auto",
|
||||
supercell=ph3.supercell,
|
||||
primitive=ph3.primitive,
|
||||
symmetry=ph3.symmetry,
|
||||
|
@ -39,7 +38,6 @@ def test_determine_cutoff_pair_distance_with_memsize(aln_cell: PhonopyAtoms) ->
|
|||
|
||||
cutoff = determine_cutoff_pair_distance(
|
||||
fc_calculator="symfc",
|
||||
random_displacements="auto",
|
||||
symfc_memory_size=0.2,
|
||||
supercell=ph3.supercell,
|
||||
primitive=ph3.primitive,
|
||||
|
@ -51,7 +49,6 @@ def test_determine_cutoff_pair_distance_with_memsize(aln_cell: PhonopyAtoms) ->
|
|||
cutoff = determine_cutoff_pair_distance(
|
||||
fc_calculator="symfc",
|
||||
fc_calculator_options="|memsize=0.1",
|
||||
random_displacements="auto",
|
||||
symfc_memory_size=0.2,
|
||||
supercell=ph3.supercell,
|
||||
primitive=ph3.primitive,
|
||||
|
@ -64,7 +61,6 @@ def test_determine_cutoff_pair_distance_with_memsize(aln_cell: PhonopyAtoms) ->
|
|||
cutoff = determine_cutoff_pair_distance(
|
||||
fc_calculator="alm",
|
||||
fc_calculator_options="|memsize=0.1",
|
||||
random_displacements="auto",
|
||||
symfc_memory_size=0.2,
|
||||
supercell=ph3.supercell,
|
||||
primitive=ph3.primitive,
|
||||
|
|
Loading…
Reference in New Issue