mirror of https://github.com/phonopy/phono3py.git
Update document for distributing thermal cond. calc.
This commit is contained in:
parent
8a7cefc506
commit
cf6a3b5186
|
@ -280,18 +280,37 @@ axes and is always Gamma-centered.
|
|||
calculation of phonon lifetimes when it is specified, e.g.,
|
||||
``--mesh="11 11 11" --md="2 2 2"``.
|
||||
|
||||
.. _gp_option:
|
||||
|
||||
``--gp``: Grid points by their ID
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
(Setting tag: ``GRID_POINTS``)
|
||||
|
||||
Grid points where imaginary part of self energy is calculated. Indices
|
||||
of grid points are specified by space separated numbers. The mapping
|
||||
table between grid points to its indices is obtained by running with
|
||||
``--loglevel=2`` option.
|
||||
Grid points where imaginary part of self energy is calculated are
|
||||
specified. Indices of grid points are specified by space or comma
|
||||
(``,``) separated numbers. The mapping table between grid points to its
|
||||
indices is obtained by running with ``--loglevel=2`` option.
|
||||
|
||||
``--ga`` option can be used instead of ``--gp`` option. See ``--gp``
|
||||
section.
|
||||
::
|
||||
|
||||
% phono3py --dim="2 2 2" --pa="0 1/2 1/2 1/2 0 1/2 1/2 1/2 0" -c POSCAR-unitcell --mesh="19 19 19" --fc3 --fc2 --br --write_gamma --gp="0 1 2 3 4 5"
|
||||
|
||||
where ``--gp="0 1 2 3 4 5"`` can be also written
|
||||
``--gp="0,1,2,3,4,5"``. There is a similar option as this option,
|
||||
:ref:`--ga option <ga_option>`.
|
||||
|
||||
``--ga`` option may be also useful when a workload of thermal
|
||||
conductivity calculation is expected to be distributed into different
|
||||
computer nodes.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
workload-distribution
|
||||
|
||||
|
||||
.. _ga_option:
|
||||
|
||||
``--ga``: Grid points by address with three integer values
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -307,17 +326,19 @@ grid point. The grid points given by ``--ga`` option are translated to
|
|||
grid point indices as given by ``--gp`` option, and the values given
|
||||
by ``--ga`` option will not be shown in log files.
|
||||
|
||||
.. _wgp_option:
|
||||
|
||||
``--wgp``: Write grid point information
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Irreducible grid point indices are written into
|
||||
``ir_grid_points.yaml``. This information may be used when we want to
|
||||
calculate imaginary part of self energy at each grid point in
|
||||
conjunction with ``--gp`` option. ``grid_address-mxxx.hdf5`` is also
|
||||
written. This file contains all the grid points and their grid
|
||||
addresses in integers. Q-points corresponding to grid points are
|
||||
calculated divided these integers by sampling mesh numbers for
|
||||
respective reciprocal axes.
|
||||
conjunction with :ref:`--gp option <gp_option>`.
|
||||
``grid_address-mxxx.hdf5`` is also written. This file contains all the
|
||||
grid points and their grid addresses in integers. Q-points
|
||||
corresponding to grid points are calculated divided these integers by
|
||||
sampling mesh numbers for respective reciprocal axes.
|
||||
|
||||
``--stp``: Show number of triplets to be calculated for each grid point
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -485,6 +506,8 @@ into file in hdf5 format. The result is written into
|
|||
``--bi`` option. With ``--sigma`` option, ``-sx`` is inserted in front
|
||||
of ``.hdf5``.
|
||||
|
||||
.. _read_gamma_option:
|
||||
|
||||
``--read_gamma``
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
|
@ -528,7 +551,7 @@ grid addresses and sampling mesh numbers given in
|
|||
``grid_address-mxxx.hdf5`` that is obtained by ``--wgp`` option. A
|
||||
python script to obtain q-point triplets is shown below.
|
||||
|
||||
::
|
||||
.. code-block:: python
|
||||
|
||||
import h5py
|
||||
import numpy as np
|
||||
|
@ -541,7 +564,9 @@ python script to obtain q-point triplets is shown below.
|
|||
q = grid_address[triplets] / np.array(mesh, dtype='double')
|
||||
|
||||
Imaginary part of self energy or linewidth/2 is recovered by the
|
||||
following script::
|
||||
following script:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import h5py
|
||||
import numpy as np
|
||||
|
@ -665,6 +690,8 @@ For spectrum like calculations of imaginary part of self energy and
|
|||
JDOS, number of sampling frequency points is controlled by
|
||||
``--num_freq_points`` or ``--freq_pitch``.
|
||||
|
||||
.. _bi_option:
|
||||
|
||||
``--bi``: Specific band index
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
@ -163,7 +163,9 @@ when the number of force files is large. ::
|
|||
|
||||
Using a python script, ``disp_fc3.yaml`` is easily parsed. So
|
||||
it is also easy to create the file list by a python
|
||||
script::
|
||||
script:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
#!/usr/bin/env python
|
||||
import yaml
|
||||
|
|
|
@ -0,0 +1,131 @@
|
|||
.. _workload_distribution:
|
||||
|
||||
Workload distribution
|
||||
======================
|
||||
|
||||
Workload of thermal conductivity calculation can be distributed into
|
||||
computer nodes. The distribution over q-point grid points (:ref:`--gp
|
||||
option <gp_option>`) and phonon bands (:ref:`--bi option <bi_option>`)
|
||||
are supported. Distribution over bands has some overhead in
|
||||
calculation of Fourier transformation of force constants. Below
|
||||
distribution over only grid points is explained. For each computer
|
||||
node, selected irreducible grid points needed for completing thermal
|
||||
conductivity are calculated. Te resulting data for each grid point are
|
||||
stored in its ``kappa-mxxx-gx.hdf5`` file on each node by setting
|
||||
:ref:`--write_gamma option <write_gamma_option>`. Once all data are
|
||||
obtained, those data are collected by :ref:`--read_gamma option
|
||||
<read_gamma_option>`.
|
||||
|
||||
.. contents::
|
||||
:depth: 2
|
||||
:local:
|
||||
|
||||
How to do it
|
||||
------------
|
||||
|
||||
The following example is executed in the ``Si-PBE`` example.
|
||||
|
||||
To avoid re-calculating fc3 and fc2, ``fc3.hdf5`` and ``fc2.hdf5`` are
|
||||
created on a single node::
|
||||
|
||||
% phono3py --dim="2 2 2" --sym_fc3r --sym_fc2 --tsym -c POSCAR-unitcell
|
||||
|
||||
The indices of the irreducible grid points neccesarry for ``--ga``
|
||||
option are found by :ref:`--wgp option <wgp_option>`
|
||||
|
||||
::
|
||||
|
||||
% phono3py --dim="2 2 2" --pa="0 1/2 1/2 1/2 0 1/2 1/2 1/2 0" -c POSCAR-unitcell --mesh="19 19 19" --fc3 --fc2 --br --wgp
|
||||
|
||||
and they are stored in ``ir_grid_points.yaml``.
|
||||
|
||||
::
|
||||
|
||||
% egrep '^- grid_point:' ir_grid_points.yaml|awk '{printf("%d,",$3)}'
|
||||
0,1,2,3,4,5,6,7,8,9,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,60,61,62,63,64,65,66,67,68,69,70,71,72,73,80,81,82,83,84,85,86,87,88,89,90,91,100,101,102,103,104,105,106,107,108,109,120,121,122,123,124,125,126,127,140,141,142,143,144,145,160,161,162,163,180,181,402,403,404,405,406,407,408,409,422,423,424,425,426,427,428,429,430,431,432,433,434,435,442,443,444,445,446,447,448,449,450,451,452,453,462,463,464,465,466,467,468,469,470,471,482,483,484,485,486,487,488,489,502,503,504,505,506,507,522,523,524,525,542,543,804,805,806,807,808,809,824,825,826,827,828,829,830,831,832,833,844,845,846,847,848,849,850,851,864,865,866,867,868,869,884,885,886,887,904,905,1206,1207,1208,1209,1226,1227,1228,1229,1230,1231,1246,1247,1248,1249,1266,1267,1608,1609,1628,1629,
|
||||
|
||||
Some of all the indices are specified and executed as follows::
|
||||
|
||||
% phono3py --dim="2 2 2" --pa="0 1/2 1/2 1/2 0 1/2 1/2 1/2 0" -c POSCAR-unitcell --mesh="19 19 19" --fc3 --fc2 --br --gp="0,1,2,3,4,5,6,7,8,9,20,21,22,23,24,25" --write_gamma
|
||||
|
||||
After finishing calculations on all nodes, the RTA thermal
|
||||
conductivity is computed in a short time from the stored data by
|
||||
|
||||
::
|
||||
|
||||
% phono3py --dim="2 2 2" --pa="0 1/2 1/2 1/2 0 1/2 1/2 1/2 0" -c POSCAR-unitcell --mesh="19 19 19" --fc3 --fc2 --br --read_gamma
|
||||
|
||||
A convenient script
|
||||
--------------------
|
||||
|
||||
The following short script may be used to splitting all irreducible
|
||||
grid point indices into some number (first argument) of sets of grid
|
||||
point indices for workload distribution.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import yaml
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
num = int(sys.argv[1])
|
||||
else:
|
||||
num = 1
|
||||
|
||||
with open("ir_grid_points.yaml") as f:
|
||||
data = yaml.load(f)
|
||||
gps = [gp['grid_point'] for gp in data['ir_grid_points']]
|
||||
gp_lists = [[] for i in range(num)]
|
||||
for i, gp in enumerate(gps):
|
||||
gp_lists[i % num].append(gp)
|
||||
for gp_set in gp_lists:
|
||||
print(",".join(["%d" % gp for gp in gp_set]))
|
||||
|
||||
Supposed that this script is saved as ``divide_gps.py``,
|
||||
|
||||
::
|
||||
|
||||
% python divide_gps.py 20
|
||||
0,30,52,82,120,402,434,468,524,844,1206
|
||||
1,31,53,83,121,403,435,469,525,845,1207
|
||||
2,32,54,84,122,404,442,470,542,846,1208
|
||||
3,33,55,85,123,405,443,471,543,847,1209
|
||||
4,34,60,86,124,406,444,482,804,848,1226
|
||||
5,35,61,87,125,407,445,483,805,849,1227
|
||||
6,36,62,88,126,408,446,484,806,850,1228
|
||||
7,37,63,89,127,409,447,485,807,851,1229
|
||||
8,40,64,90,140,422,448,486,808,864,1230
|
||||
9,41,65,91,141,423,449,487,809,865,1231
|
||||
20,42,66,100,142,424,450,488,824,866,1246
|
||||
21,43,67,101,143,425,451,489,825,867,1247
|
||||
22,44,68,102,144,426,452,502,826,868,1248
|
||||
23,45,69,103,145,427,453,503,827,869,1249
|
||||
24,46,70,104,160,428,462,504,828,884,1266
|
||||
25,47,71,105,161,429,463,505,829,885,1267
|
||||
26,48,72,106,162,430,464,506,830,886,1608
|
||||
27,49,73,107,163,431,465,507,831,887,1609
|
||||
28,50,80,108,180,432,466,522,832,904,1628
|
||||
29,51,81,109,181,433,467,523,833,905,1629
|
||||
|
||||
For example distributing into 20 computer nodes using a queueing
|
||||
system,
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
% j=1; for i in `python divide_gps.py 20`;do echo $i; sed -e s/gps/$i/g -e s/num/$j/g job.sh|qsub; j=$((j+1)); done
|
||||
|
||||
with ``job.sh`` (here for grid-engine):
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
#$ -S /bin/zsh
|
||||
#$ -cwd
|
||||
#$ -N phono3py-num
|
||||
#$ -pe mpi* 16
|
||||
#$ -e err-phono3py-num.log
|
||||
#$ -o std-phono3py-num.log
|
||||
|
||||
phono3py --dim="2 2 2" --pa="0 1/2 1/2 1/2 0 1/2 1/2 1/2 0" -c POSCAR-unitcell --mesh="19 19 19" --fc3 --fc2 --br --gp="gps" --write_gamma
|
||||
|
Loading…
Reference in New Issue