From 8b3f265b67b5bfe3ae03b8f0997b003feea1101a Mon Sep 17 00:00:00 2001 From: Atsushi Togo Date: Wed, 22 Jul 2020 15:40:36 +0900 Subject: [PATCH] Updated document, installation, and packaging related files. --- .travis.yml | 2 +- build-wheels.sh | 4 +- conda/meta.yaml | 8 +- dev-requirements.txt | 1 - doc/changelog.rst | 10 + doc/conf.py | 4 +- doc/index.rst | 1 + doc/install.rst | 134 +++-------- doc/phonopy-load.rst | 59 +++++ doc/phonopy-module.rst | 2 + doc/setting-tags.rst | 1 + example/NaCl/NaCl-band-gv.py | 2 +- example/NaCl/NaCl-band.py | 2 +- example/NaCl/NaCl-dynmat.py | 2 +- example/NaCl/NaCl-gv.py | 2 +- example/NaCl/NaCl-read_write_fc.py | 4 +- example/NaCl/NaCl-yaml.py | 2 +- example/NaCl/NaCl.py | 2 +- example/NaCl/phonopy_disp.yaml | 356 +++++++++++++++++++++++++++++ phonopy/api_phonopy.py | 11 +- phonopy/cui/phonopy_argparse.py | 4 + phonopy/cui/phonopy_script.py | 27 ++- requirements.txt | 1 + 23 files changed, 503 insertions(+), 138 deletions(-) create mode 100644 doc/phonopy-load.rst create mode 100644 example/NaCl/phonopy_disp.yaml diff --git a/.travis.yml b/.travis.yml index bd5b2c98..10f2ddbe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,7 +55,7 @@ before_install: source $(conda info --root)/etc/profile.d/conda.sh; fi; - conda install --yes -c conda-forge python=$TRAVIS_PYTHON_VERSION; -- conda install --yes -c conda-forge gcc_linux-64 gxx_linux-64 matplotlib pyyaml scipy numpy spglib h5py setuptools_scm conda-build pip pytest; +- conda install --yes -c conda-forge gcc_linux-64 gxx_linux-64 matplotlib-base pyyaml scipy numpy spglib h5py setuptools_scm conda-build pip pytest; - if [[ "$TRAVIS_PYTHON_VERSION" != "2.7" ]]; then pip install cp2k-input-tools; fi; diff --git a/build-wheels.sh b/build-wheels.sh index a59f8625..c8b806b7 100755 --- a/build-wheels.sh +++ b/build-wheels.sh @@ -4,7 +4,7 @@ set -e -x yum install -y hdf5 freetype freetype-devel pkgconfig libpng-devel for PYBIN in /opt/python/*/bin; do - if [[ ! $PYBIN == *"34"* ]]; then + if [[ ! $PYBIN == *"34"* ]] && [[ ! $PYBIN == *"39"* ]]; then "${PYBIN}/pip" install -r /io/dev-requirements.txt "${PYBIN}/pip" wheel /io/ -w wheelhouse/ fi @@ -17,7 +17,7 @@ done # Install packages and test for PYBIN in /opt/python/*/bin/; do - if [[ ! $PYBIN == *"34"* ]]; then + if [[ ! $PYBIN == *"34"* ]] && [[ ! $PYBIN == *"39"* ]]; then "${PYBIN}/pip" install phonopy --no-index -f /io/wheelhouse (cd "$HOME"; "${PYBIN}/nosetests" phonopy) fi diff --git a/conda/meta.yaml b/conda/meta.yaml index 542809dc..7f693fc6 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -28,19 +28,19 @@ requirements: build: - python - numpy - - matplotlib - - pyyaml - - h5py - setuptools + - pip - spglib run: - python + - pip - numpy - - matplotlib + - matplotlib-base - pyyaml - h5py - spglib + - scipy test: # Python imports diff --git a/dev-requirements.txt b/dev-requirements.txt index dfa073a3..24ce15ab 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,2 +1 @@ -nose numpy diff --git a/doc/changelog.rst b/doc/changelog.rst index 4e0ac391..1a5b8397 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -3,6 +3,16 @@ Change Log ========== +July-22-2020: Version 2.7.0 +--------------------------- +* Spglib was removed from phonopy source code tree. Now phonopy + depends on spglib. So spglib has to be installed separately. But + for normal cases, it is handled by the package manager. +* A new way of using phonopy from command line is proposed at + :ref:`phonopy_load_command`. +* Slightly changed the behaviour of ``--include-all`` option to that + force constants are not stored when force sets are stored. + May-3-2020: Version 2.6.1 ------------------------- * Release for pypi and conda packaging diff --git a/doc/conf.py b/doc/conf.py index 2edf7b58..607bf681 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -45,9 +45,9 @@ copyright = u'2009, Atsushi Togo' # built documents. # # The short X.Y version. -version = '2.6' +version = '2.7' # The full version, including alpha/beta/rc tags. -release = '2.6.1' +release = '2.7.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/doc/index.rst b/doc/index.rst index d87e9994..df10528f 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -92,6 +92,7 @@ Documentation auxiliary-tools external-tools phonopy-module + phonopy-load formulation citation reference diff --git a/doc/install.rst b/doc/install.rst index 70753ca8..1e9d6d37 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -3,6 +3,8 @@ Installation ============= +**From phonopy v2.7.0, spglib has to be installed separately.** + .. contents:: :depth: 3 :local: @@ -18,7 +20,7 @@ system is set-up (see `details about conda setting up of phonopy is super easy for any of Linux, MacOSX, and Windows. To install:: - % conda install -c conda-forge phonopy h5py + % conda install -c conda-forge phonopy This phonopy's conda package is prepared and maintained by Paweł T. Jochym at conda-forge channel (please be aware that this is @@ -41,7 +43,7 @@ environment). % conda create -n phonopy -c conda-forge python=3 % conda activate phonopy - % conda install -c conda-forge phonopy h5py + % conda install -c conda-forge phonopy To exit from this conda's environment:: @@ -72,28 +74,6 @@ To use this phonopy, entering this environment is necessary like below. | __/ | | | | (_) | | \___|_| |_| \___/|_| -Using pip ---------- - -Installation of phonopy via pip is not very recommended. :ref:`install_conda` -as rewritten above is recommended. - -Phonopy pip wheel is not prepared for most of the systems. So before -installing phonopy using pip, Python C-API compilation environment has -to be prepared. Then phonopy is installed using pip by:: - - % pip install phonopy - -If you see the error message like below in the installation process:: - - _phonopy.c:35:20: fatal error: Python.h: No such file or directory - -development tools for building python module are additionally -necessary and are installed using OS's package management system, -e.g.,:: - - sudo apt-get install python-dev - .. _install_from_source: From source code @@ -104,9 +84,10 @@ System requirement The procedure to setup phonopy is explained in this section. It is supposed that phonopy is installed on the recent linux distribution -like Ubuntu or Fedora with Python version 2.6 or later. Python version -3.4 or later is expected to work. Mac OS X users may use conda packages. -Windows users should use conda packages as well. +like Ubuntu or Fedora with Python version 2.7 or later. Python version +3.4 or later is expected to work. Mac OS X users may use conda +(conda-forge channel) packages. Windows users should use conda +(conda-forge channel) packages as well. Prepare the following Python libraries: @@ -120,27 +101,25 @@ And optionally the following: * cp2k-input-tools, for the CP2K force calculator backend +Installing required packages by conda +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -By Ubuntu package manager -^^^^^^^^^^^^^^^^^^^^^^^^^^ +The python libraries can be installed using conda. Conda packages are +distributed in binary. Minimum setup of conda envrironment is done by +miniconda, which is downloaded at https://conda.io/miniconda.html. It +is strongly recommended to create conda's virtual environment by +``conda create -n `` as written above. The installation of +necessary libraries is done as follows:: -The most recommended system is Ubuntu linux version 14.04 (64-bit) or -later. The python libraries are installed by:: + % conda install -c conda-forge numpy scipy h5py pyyaml matplotlib-base spglib - % sudo apt-get install python-dev python-numpy python-matplotlib python-yaml python-h5py +If you need a compiler, for usual 64-bit linux system:: -``python-scipy`` is also required to use ``phonopy-qha`` or -``DEBYE_MODEL`` tag. + % conda install -c conda-forge gcc_linux-64 -By conda -^^^^^^^^^ +For macOS:: -The python libraries may be also installed using pip or -conda. Conda packages are distributed in binary and recommended often -more than pip. The installation of necessary libraries is done as -follows:: - - % conda install numpy scipy h5py pyyaml matplotlib + % conda install -c conda-forge clang_osx-64 .. _install_setup_py: @@ -152,76 +131,23 @@ special compiler or special options, phonopy is built using setup.py. In this case, manual modification of ``setup.py`` may be needed. -1. Download the source code at +1. Get the source code from github - https://pypi.python.org/pypi/phonopy + :: - and extract it:: + % git clone https://github.com/phonopy/phonopy.git + % cd phonopy + % git checkout master - % tar xvfz phonopy-1.11.12.31.tar.gz - % cd phonopy-1.11.12.31 - - The other option is using git to clone the phonopy repository from github:: - - % git clone https://github.com/phonopy/phonopy.git - % cd phonopy - -2. Set up C-libraries for python C-API and python codes. This can be - done as follows: - - Run ``setup.py`` script:: - - % python setup.py install --user - - Watching carefully where the phonopy commands and library are - installed. Those locations can be ``~/.local/bin`` and - ``~/.local/lib`` directories, respectively. - -3. Assuming the installation location is those shown in the step 2, - set ``$PATH`` and ``$PYTHONPATH``:: - - export PYTHONPATH=~/.local/lib:$PYTHONPATH - export PATH=~/.local/bin:$PATH - - or if ``PYTHONPATH`` is not yet set in your system:: - - export PYTHONPATH=~/.local/lib - export PATH=~/.local/bin:$PATH - - in your ``.bashrc`` (or maybe ``.bash_profile``), ``.zshenv``, or - other script for the other shells. +2. Run ``setup.py`` script + :: + % python setup.py build + % pip install -e . .. _install_trouble_shooting: - -Multithreading support ------------------------ - -Two kinds of multithreadings can be used in phonopy. - -1. Multithreaded BLAS linked numpy - - Phonopy uses numpy to run singular value decomposition in the - calculation of force constants and diagonalizaion of dynamical - matrices. For these, numpy internally calls the LAPACK - routines. Therefore if a user installs a numpy that is linked with - multithreaded BLAS, these parts are multithreaded. For example, MKL - linked numpy is easily installed using conda. - -2. OpenMP support in phonopy and spglib - - OpenMP are applied in the symmetry finding of spglib and the - distribution of symmetry reduced force constants elements to full - force constants elements in phonopy. When a chosen supercell is - very large and there are many cores on a computer, these parts may - work well to reduce the computational time. In the default phonopy - setting, this is not activated. To enable this, it is necessary to - build phonopy using modified ``setup.py`` in which ``with_openmp = - False`` must be changed to ``with_openmp = True``. For this, - currently only gcc is supported. - Trouble shooting ----------------- diff --git a/doc/phonopy-load.rst b/doc/phonopy-load.rst new file mode 100644 index 00000000..260319e1 --- /dev/null +++ b/doc/phonopy-load.rst @@ -0,0 +1,59 @@ +.. _phonopy_load_command: + +phonopy-load command +==================== + +At phonopy v2.7.0, ``phonopy-load`` command is installed. This behaves +similarly to ``phonopy.load`` (:ref:`phonopy_load`) in the phonopy +python module. The main aim of introducing this command is to provide +uniform usage over many different force calculators. Once +``phonopy_disp.yaml`` is created, the later operations will be the +same using this command. + +The following default behaviours are changed from that of those +of ``phonopy`` command: + +1. ``phonopy_xxx.yaml`` type file is always necessary by a way of (2) + or (3). +2. The first argument of the command is used to give a ``phonopy_xxx.yaml`` + type file. +3. The file names of ``phonopy_params.yaml``, ``phonopy_disp.yaml``, + ``phonopy.yaml`` are the default file + names and these files are searched in the current directory. The + preference order is as given here. +4. ``-c`` option (read crystal structure) does not exist. +5. Use of dommand options is recommended, but phonopy configuration + file can be read using ``--config`` option. +6. If parameters for non-analytical term correction (NAC) are + found, NAC is automatically enabled. This can be disabled by + ``--nonac`` option. +7. When force constants are calculated from displacements and forces + dataset, force constants are automatically symmetrized. To disable + this, ``--no-sym-fc`` option is used. + +Examples +-------- + +In the NaCl-qe example, + +:: + + % phonopy --qe -d --dim 2 2 2 --pa auto -c NaCl.in + % phonopy -f NaCl-00{1,2}.out + +With these commands, ``phonopy_disp.yaml`` and ``FORCE_SETS`` are +created. After this step, it is unnecessary to specify ``--qe`` option +to run with ``phonopy-load``. The following command works to draw band +structure. + +:: + + % phonopy-load --band auto -p + +Data in ``FORCE_SETS`` and ``BORN`` stored in +``phonopy_xxx.yaml`` file can be used as follows:: + + % phonopy-load --include-all + % mkdir test && cd test + % mv ../phonopy.yaml phonopy_data.yaml + % phonopy-load phonopy_data.yaml --band auto -p diff --git a/doc/phonopy-module.rst b/doc/phonopy-module.rst index e129df85..6b3af337 100644 --- a/doc/phonopy-module.rst +++ b/doc/phonopy-module.rst @@ -191,6 +191,8 @@ written in the yaml file, the argument ``settings`` is set as follows:: phonon.save(settings={'force_constants': True}) +.. _phonopy_load: + Shortcut to load input files (``phonopy.load``) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/doc/setting-tags.rst b/doc/setting-tags.rst index eabb9869..8d4e2547 100644 --- a/doc/setting-tags.rst +++ b/doc/setting-tags.rst @@ -1576,3 +1576,4 @@ This is set by default when the ``phonopy`` script is run in ``displacements`` m All available data covered by the other ``include`` flags can be written to the yaml summary file using the ``--include-all`` flag or by setting ``INCLUDE_ALL = .TRUE.``. +Force constants are not stored when force sets are stored. diff --git a/example/NaCl/NaCl-band-gv.py b/example/NaCl/NaCl-band-gv.py index a1c01425..5016a891 100644 --- a/example/NaCl/NaCl-band-gv.py +++ b/example/NaCl/NaCl-band-gv.py @@ -11,7 +11,7 @@ def append_band(bands, q_start, q_end): bands.append(band) -phonon = phonopy.load(unitcell_filename="POSCAR", +phonon = phonopy.load(unitcell_filename="POSCAR-unitcell", born_filename="BORN", force_sets_filename="FORCE_SETS", supercell_matrix=[[2, 0, 0], diff --git a/example/NaCl/NaCl-band.py b/example/NaCl/NaCl-band.py index 8822ed51..5672b035 100644 --- a/example/NaCl/NaCl-band.py +++ b/example/NaCl/NaCl-band.py @@ -7,7 +7,7 @@ phonon = phonopy.load(supercell_matrix=[[2, 0, 0], primitive_matrix=[[0, 0.5, 0.5], [0.5, 0, 0.5], [0.5, 0.5, 0]], - unitcell_filename="POSCAR", + unitcell_filename="POSCAR-unitcell", force_sets_filename="FORCE_SETS", born_filename="BORN") points = get_band_qpoints( diff --git a/example/NaCl/NaCl-dynmat.py b/example/NaCl/NaCl-dynmat.py index e79dd537..c62193fc 100644 --- a/example/NaCl/NaCl-dynmat.py +++ b/example/NaCl/NaCl-dynmat.py @@ -10,7 +10,7 @@ phonon = phonopy.load(supercell_matrix=[[2, 0, 0], primitive_matrix=[[0, 0.5, 0.5], [0.5, 0, 0.5], [0.5, 0.5, 0]], - unitcell_filename="POSCAR", + unitcell_filename="POSCAR-unitcell", force_sets_filename="FORCE_SETS", born_filename="BORN") diff --git a/example/NaCl/NaCl-gv.py b/example/NaCl/NaCl-gv.py index d0afaf57..337c00e2 100644 --- a/example/NaCl/NaCl-gv.py +++ b/example/NaCl/NaCl-gv.py @@ -2,7 +2,7 @@ import numpy as np import phonopy import matplotlib.pyplot as plt -phonon = phonopy.load(unitcell_filename="POSCAR", +phonon = phonopy.load(unitcell_filename="POSCAR-unitcell", born_filename="BORN", force_sets_filename="FORCE_SETS", supercell_matrix=[[2, 0, 0], diff --git a/example/NaCl/NaCl-read_write_fc.py b/example/NaCl/NaCl-read_write_fc.py index 4313f504..a5ba476f 100644 --- a/example/NaCl/NaCl-read_write_fc.py +++ b/example/NaCl/NaCl-read_write_fc.py @@ -7,7 +7,7 @@ phonon = phonopy.load(supercell_matrix=[[2, 0, 0], primitive_matrix=[[0, 0.5, 0.5], [0.5, 0, 0.5], [0.5, 0.5, 0]], - unitcell_filename="POSCAR", + unitcell_filename="POSCAR-unitcell", force_sets_filename="FORCE_SETS", born_filename="BORN") write_FORCE_CONSTANTS(phonon.get_force_constants(), @@ -16,5 +16,5 @@ write_FORCE_CONSTANTS(phonon.get_force_constants(), force_constants = parse_FORCE_CONSTANTS() phonon.force_constants = force_constants phonon.symmetrize_force_constants() -write_FORCE_CONSTANTS(phonon.get_force_constants(), +write_FORCE_CONSTANTS(phonon.force_constants, filename="FORCE_CONSTANTS_NEW") diff --git a/example/NaCl/NaCl-yaml.py b/example/NaCl/NaCl-yaml.py index 9fd1fbbc..6f4524be 100644 --- a/example/NaCl/NaCl-yaml.py +++ b/example/NaCl/NaCl-yaml.py @@ -7,7 +7,7 @@ phonon = phonopy.load(supercell_matrix=[[2, 0, 0], primitive_matrix=[[0, 0.5, 0.5], [0.5, 0, 0.5], [0.5, 0.5, 0]], - unitcell_filename="POSCAR", + unitcell_filename="POSCAR-unitcell", force_sets_filename="FORCE_SETS", born_filename="BORN") phpy_yaml = PhonopyYaml(calculator='vasp', diff --git a/example/NaCl/NaCl.py b/example/NaCl/NaCl.py index 5133bc5a..27ee432a 100644 --- a/example/NaCl/NaCl.py +++ b/example/NaCl/NaCl.py @@ -13,7 +13,7 @@ def append_band(bands, q_start, q_end): # NaCl crystal structure is read from POSCAR. -unitcell = read_vasp("POSCAR") +unitcell = read_vasp("POSCAR-unitcell") # This can be given via a PhonopyAtoms class as follows: # unitcell = PhonopyAtoms(symbols=(['Na'] * 4 + ['Cl'] * 4), # cell=(np.eye(3) * 5.6903014761756712), diff --git a/example/NaCl/phonopy_disp.yaml b/example/NaCl/phonopy_disp.yaml new file mode 100644 index 00000000..2f7d82ec --- /dev/null +++ b/example/NaCl/phonopy_disp.yaml @@ -0,0 +1,356 @@ +phonopy: + version: 2.7.0 + frequency_unit_conversion_factor: 15.633302 + symmetry_tolerance: 1.00000e-05 + configuration: + cell_filename: "POSCAR-unitcell" + create_displacements: ".true." + primitive_axes: "auto" + dim: "2 2 2" + +physical_unit: + atomic_mass: "AMU" + length: "angstrom" + force_constants: "eV/angstrom^2" + +space_group: + type: "Fm-3m" + number: 225 + Hall_symbol: "-F 4 2 3" + +primitive_matrix: +- [ 0.000000000000000, 0.500000000000000, 0.500000000000000 ] +- [ 0.500000000000000, 0.000000000000000, 0.500000000000000 ] +- [ 0.500000000000000, 0.500000000000000, 0.000000000000000 ] + +supercell_matrix: +- [ 2, 0, 0 ] +- [ 0, 2, 0 ] +- [ 0, 0, 2 ] + +primitive_cell: + lattice: + - [ 0.000000000000000, 2.845150738087836, 2.845150738087836 ] # a + - [ 2.845150738087836, 0.000000000000000, 2.845150738087836 ] # b + - [ 2.845150738087836, 2.845150738087836, 0.000000000000000 ] # c + points: + - symbol: Na # 1 + coordinates: [ 0.000000000000000, 0.000000000000000, 0.000000000000000 ] + mass: 22.989769 + - symbol: Cl # 2 + coordinates: [ 0.500000000000000, 0.500000000000000, 0.500000000000000 ] + mass: 35.453000 + reciprocal_lattice: # without 2pi + - [ -0.175737613233118, 0.175737613233118, 0.175737613233118 ] # a* + - [ 0.175737613233118, -0.175737613233118, 0.175737613233118 ] # b* + - [ 0.175737613233118, 0.175737613233118, -0.175737613233118 ] # c* + +unit_cell: + lattice: + - [ 5.690301476175671, 0.000000000000000, 0.000000000000000 ] # a + - [ 0.000000000000000, 5.690301476175671, 0.000000000000000 ] # b + - [ 0.000000000000000, 0.000000000000000, 5.690301476175671 ] # c + points: + - symbol: Na # 1 + coordinates: [ 0.000000000000000, 0.000000000000000, 0.000000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 2 + coordinates: [ 0.000000000000000, 0.500000000000000, 0.500000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 3 + coordinates: [ 0.500000000000000, 0.000000000000000, 0.500000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 4 + coordinates: [ 0.500000000000000, 0.500000000000000, 0.000000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Cl # 5 + coordinates: [ 0.500000000000000, 0.500000000000000, 0.500000000000000 ] + mass: 35.453000 + reduced_to: 5 + - symbol: Cl # 6 + coordinates: [ 0.500000000000000, 0.000000000000000, 0.000000000000000 ] + mass: 35.453000 + reduced_to: 5 + - symbol: Cl # 7 + coordinates: [ 0.000000000000000, 0.500000000000000, 0.000000000000000 ] + mass: 35.453000 + reduced_to: 5 + - symbol: Cl # 8 + coordinates: [ 0.000000000000000, 0.000000000000000, 0.500000000000000 ] + mass: 35.453000 + reduced_to: 5 + +supercell: + lattice: + - [ 11.380602952351342, 0.000000000000000, 0.000000000000000 ] # a + - [ 0.000000000000000, 11.380602952351342, 0.000000000000000 ] # b + - [ 0.000000000000000, 0.000000000000000, 11.380602952351342 ] # c + points: + - symbol: Na # 1 + coordinates: [ 0.000000000000000, 0.000000000000000, 0.000000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 2 + coordinates: [ 0.500000000000000, 0.000000000000000, 0.000000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 3 + coordinates: [ 0.000000000000000, 0.500000000000000, 0.000000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 4 + coordinates: [ 0.500000000000000, 0.500000000000000, 0.000000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 5 + coordinates: [ 0.000000000000000, 0.000000000000000, 0.500000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 6 + coordinates: [ 0.500000000000000, 0.000000000000000, 0.500000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 7 + coordinates: [ 0.000000000000000, 0.500000000000000, 0.500000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 8 + coordinates: [ 0.500000000000000, 0.500000000000000, 0.500000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 9 + coordinates: [ 0.000000000000000, 0.250000000000000, 0.250000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 10 + coordinates: [ 0.500000000000000, 0.250000000000000, 0.250000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 11 + coordinates: [ 0.000000000000000, 0.750000000000000, 0.250000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 12 + coordinates: [ 0.500000000000000, 0.750000000000000, 0.250000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 13 + coordinates: [ 0.000000000000000, 0.250000000000000, 0.750000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 14 + coordinates: [ 0.500000000000000, 0.250000000000000, 0.750000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 15 + coordinates: [ 0.000000000000000, 0.750000000000000, 0.750000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 16 + coordinates: [ 0.500000000000000, 0.750000000000000, 0.750000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 17 + coordinates: [ 0.250000000000000, 0.000000000000000, 0.250000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 18 + coordinates: [ 0.750000000000000, 0.000000000000000, 0.250000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 19 + coordinates: [ 0.250000000000000, 0.500000000000000, 0.250000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 20 + coordinates: [ 0.750000000000000, 0.500000000000000, 0.250000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 21 + coordinates: [ 0.250000000000000, 0.000000000000000, 0.750000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 22 + coordinates: [ 0.750000000000000, 0.000000000000000, 0.750000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 23 + coordinates: [ 0.250000000000000, 0.500000000000000, 0.750000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 24 + coordinates: [ 0.750000000000000, 0.500000000000000, 0.750000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 25 + coordinates: [ 0.250000000000000, 0.250000000000000, 0.000000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 26 + coordinates: [ 0.750000000000000, 0.250000000000000, 0.000000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 27 + coordinates: [ 0.250000000000000, 0.750000000000000, 0.000000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 28 + coordinates: [ 0.750000000000000, 0.750000000000000, 0.000000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 29 + coordinates: [ 0.250000000000000, 0.250000000000000, 0.500000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 30 + coordinates: [ 0.750000000000000, 0.250000000000000, 0.500000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 31 + coordinates: [ 0.250000000000000, 0.750000000000000, 0.500000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Na # 32 + coordinates: [ 0.750000000000000, 0.750000000000000, 0.500000000000000 ] + mass: 22.989769 + reduced_to: 1 + - symbol: Cl # 33 + coordinates: [ 0.250000000000000, 0.250000000000000, 0.250000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 34 + coordinates: [ 0.750000000000000, 0.250000000000000, 0.250000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 35 + coordinates: [ 0.250000000000000, 0.750000000000000, 0.250000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 36 + coordinates: [ 0.750000000000000, 0.750000000000000, 0.250000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 37 + coordinates: [ 0.250000000000000, 0.250000000000000, 0.750000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 38 + coordinates: [ 0.750000000000000, 0.250000000000000, 0.750000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 39 + coordinates: [ 0.250000000000000, 0.750000000000000, 0.750000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 40 + coordinates: [ 0.750000000000000, 0.750000000000000, 0.750000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 41 + coordinates: [ 0.250000000000000, 0.000000000000000, 0.000000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 42 + coordinates: [ 0.750000000000000, 0.000000000000000, 0.000000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 43 + coordinates: [ 0.250000000000000, 0.500000000000000, 0.000000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 44 + coordinates: [ 0.750000000000000, 0.500000000000000, 0.000000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 45 + coordinates: [ 0.250000000000000, 0.000000000000000, 0.500000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 46 + coordinates: [ 0.750000000000000, 0.000000000000000, 0.500000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 47 + coordinates: [ 0.250000000000000, 0.500000000000000, 0.500000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 48 + coordinates: [ 0.750000000000000, 0.500000000000000, 0.500000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 49 + coordinates: [ 0.000000000000000, 0.250000000000000, 0.000000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 50 + coordinates: [ 0.500000000000000, 0.250000000000000, 0.000000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 51 + coordinates: [ 0.000000000000000, 0.750000000000000, 0.000000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 52 + coordinates: [ 0.500000000000000, 0.750000000000000, 0.000000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 53 + coordinates: [ 0.000000000000000, 0.250000000000000, 0.500000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 54 + coordinates: [ 0.500000000000000, 0.250000000000000, 0.500000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 55 + coordinates: [ 0.000000000000000, 0.750000000000000, 0.500000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 56 + coordinates: [ 0.500000000000000, 0.750000000000000, 0.500000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 57 + coordinates: [ 0.000000000000000, 0.000000000000000, 0.250000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 58 + coordinates: [ 0.500000000000000, 0.000000000000000, 0.250000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 59 + coordinates: [ 0.000000000000000, 0.500000000000000, 0.250000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 60 + coordinates: [ 0.500000000000000, 0.500000000000000, 0.250000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 61 + coordinates: [ 0.000000000000000, 0.000000000000000, 0.750000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 62 + coordinates: [ 0.500000000000000, 0.000000000000000, 0.750000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 63 + coordinates: [ 0.000000000000000, 0.500000000000000, 0.750000000000000 ] + mass: 35.453000 + reduced_to: 33 + - symbol: Cl # 64 + coordinates: [ 0.500000000000000, 0.500000000000000, 0.750000000000000 ] + mass: 35.453000 + reduced_to: 33 + +displacements: +- atom: 1 + displacement: + [ 0.0100000000000000, 0.0000000000000000, 0.0000000000000000 ] +- atom: 33 + displacement: + [ 0.0100000000000000, 0.0000000000000000, 0.0000000000000000 ] diff --git a/phonopy/api_phonopy.py b/phonopy/api_phonopy.py index 55cacaf9..e3c0024c 100644 --- a/phonopy/api_phonopy.py +++ b/phonopy/api_phonopy.py @@ -1243,7 +1243,6 @@ class Phonopy(object): axs = ImageGrid(fig, 111, # similar to subplot(111) nrows_ncols=(1, n), axes_pad=0.11, - add_all=True, label_mode="L") self._band_structure.plot(axs) return plt @@ -1622,21 +1621,16 @@ class Phonopy(object): axs = ImageGrid(fig, 111, # similar to subplot(111) nrows_ncols=(1, n), axes_pad=0.11, - add_all=True, label_mode="L") self._band_structure.plot(axs[:-1]) if pdos_indices is None: - freqs = self._total_dos.frequency_points - dos = self._total_dos.dos self._total_dos.plot(axs[-1], xlabel="", ylabel="", draw_grid=False, flip_xy=True) else: - freqs = self._pdos.frequency_points - dos = self._pdos.projected_dos self._pdos.plot(axs[-1], indices=pdos_indices, xlabel="", @@ -2507,10 +2501,7 @@ class Phonopy(object): else: animation.write_v_sim(amplitude=amplitude_, factor=self._factor) - if (anime_type == 'arc' or - anime_type == 'xyz' or - anime_type == 'jmol' or - anime_type == 'poscar'): + if anime_type in ('arc', 'xyz', 'jmol', 'poscar'): if band_index is None or amplitude is None or num_div is None: msg = ("Parameters are not correctly set for animation.") raise RuntimeError(msg) diff --git a/phonopy/cui/phonopy_argparse.py b/phonopy/cui/phonopy_argparse.py index 20ea39ff..fa9e278a 100644 --- a/phonopy/cui/phonopy_argparse.py +++ b/phonopy/cui/phonopy_argparse.py @@ -117,6 +117,10 @@ def get_parser(fc_symmetry=False, parser.add_argument( "-c", "--cell", dest="cell_filename", metavar="FILE", default=None, help="Read unit cell") + if load_phonopy_yaml: + parser.add_argument( + "--config", dest="conf_filename", metavar="FILE", default=None, + help="Phonopy configuration file") parser.add_argument( "--cutoff-freq", "--cutoff-frequency", dest="cutoff_frequency", type=float, default=None, diff --git a/phonopy/cui/phonopy_script.py b/phonopy/cui/phonopy_script.py index ec4cb86a..0426f20f 100644 --- a/phonopy/cui/phonopy_script.py +++ b/phonopy/cui/phonopy_script.py @@ -1336,28 +1336,43 @@ def read_phonopy_settings(args, argparse_control, log_level): """Read phonopy settings""" load_phonopy_yaml = argparse_control.get('load_phonopy_yaml', False) + conf_filename = None - if len(args.filename) > 0: - file_exists(args.filename[0], log_level) - if load_phonopy_yaml: + if load_phonopy_yaml: + if args.conf_filename: + conf_filename = args.conf_filename + phonopy_conf_parser = PhonopyConfParser( + filename=args.conf_filename, args=args, + default_settings=argparse_control) + else: phonopy_conf_parser = PhonopyConfParser( args=args, default_settings=argparse_control) + if len(args.filename) > 0: + file_exists(args.filename[0], log_level) cell_filename = args.filename[0] else: + cell_filename = phonopy_conf_parser.settings.cell_filename + else: + if len(args.filename) > 0: if is_file_phonopy_yaml(args.filename[0]): phonopy_conf_parser = PhonopyConfParser(args=args) cell_filename = args.filename[0] else: + conf_filename = args.filename[0] phonopy_conf_parser = PhonopyConfParser( filename=args.filename[0], args=args) cell_filename = phonopy_conf_parser.settings.cell_filename - else: - phonopy_conf_parser = PhonopyConfParser(args=args) - cell_filename = phonopy_conf_parser.settings.cell_filename + else: + phonopy_conf_parser = PhonopyConfParser(args=args) + cell_filename = phonopy_conf_parser.settings.cell_filename confs = phonopy_conf_parser.confs.copy() settings = phonopy_conf_parser.settings + if log_level > 0 and conf_filename is not None: + print("Phonopy configuration was read from \"%s\"." % + conf_filename) + return settings, confs, cell_filename diff --git a/requirements.txt b/requirements.txt index 7899dd59..86eba9f8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ numpy==1.16.5 PyYAML==5.1.2 matplotlib==2.2.4 h5py==2.10.0 +spglib==1.15.1