mirror of https://github.com/phonopy/phonopy.git
Iteration loop is made to loosen crystal structure geometry tolerance until match for finding atomic permutation by symmetry
This commit is contained in:
parent
fb5254a90e
commit
61f29b8a51
|
@ -358,7 +358,11 @@ static PyObject * py_compute_permutation(PyObject *self, PyObject *args)
|
|||
num_pos,
|
||||
symprec);
|
||||
|
||||
return Py_BuildValue("i", is_found);
|
||||
if (is_found) {
|
||||
Py_RETURN_TRUE;
|
||||
} else {
|
||||
Py_RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static PyObject * py_gsv_copy_smallest_vectors(PyObject *self, PyObject *args)
|
||||
|
@ -1563,7 +1567,6 @@ static int compute_permutation(int * rot_atom,
|
|||
|
||||
for (i = 0; i < num_pos; i++) {
|
||||
if (rot_atom[i] < 0) {
|
||||
printf("Encounter some problem in compute_permutation.\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -857,11 +857,25 @@ def _compute_permutation_c(positions_a, # scaled positions
|
|||
|
||||
try:
|
||||
import phonopy._phonopy as phonoc
|
||||
is_found = phonoc.compute_permutation(permutation,
|
||||
lattice,
|
||||
positions_a,
|
||||
positions_b,
|
||||
symprec)
|
||||
tolerance = symprec
|
||||
for _ in range(20):
|
||||
is_found = phonoc.compute_permutation(permutation,
|
||||
lattice,
|
||||
positions_a,
|
||||
positions_b,
|
||||
tolerance)
|
||||
if is_found:
|
||||
break
|
||||
else:
|
||||
tolerance *= 1.05
|
||||
|
||||
if tolerance / symprec > 1.5:
|
||||
import warnings
|
||||
msg = ("Crystal structure is distorted in a tricky way so that "
|
||||
"phonopy could not handle the crystal symmetry properly. "
|
||||
"It is recommended to symmetrize crystal structure well "
|
||||
"and then re-start phonon calculation from scratch.")
|
||||
warnings.warn(msg)
|
||||
|
||||
if not is_found:
|
||||
permutation_error()
|
||||
|
|
Loading…
Reference in New Issue