Made get_FORCE_SETS_lines support sets of forces input for type-2 dataset, too.

This commit is contained in:
Atsushi Togo 2019-10-17 18:30:45 +09:00
parent b664c8a098
commit c8f1ae768c
1 changed files with 6 additions and 4 deletions

View File

@ -53,15 +53,17 @@ def get_FORCE_SETS_lines(dataset, forces=None):
"""Generate FORCE_SETS string
See the format of dataset in the docstring of
Phonopy.set_displacement_dataset. Optionally for the type-1 (traditional)
format, forces can be given. In this case, sets of forces are
unnecessary to be stored in the dataset.
Phonopy.set_displacement_dataset. Optionally, sets of forces of supercells
can be given. In this case, these forces are unnecessary to be stored
in the dataset.
"""
if 'first_atoms' in dataset:
return _get_FORCE_SETS_lines_type1(dataset, forces=forces)
elif 'forces' in dataset:
elif 'displacements' in dataset:
if forces is not None:
dataset['forces'] = forces
return _get_FORCE_SETS_lines_type2(dataset)