Update of document and docstring for the method from grid address to grid point

This commit is contained in:
Atsushi Togo 2018-09-10 17:14:59 +02:00
parent 2b1b48e383
commit 22437d5f5d
2 changed files with 36 additions and 4 deletions

View File

@ -322,3 +322,19 @@ For example, :math:`\kappa_{\lambda,{xx}}` is calculated by::
Out[9]:
array([ 1.02050201e+03, 1.02050201e+03, 1.02050201e+03,
4.40486209e-15, 0.00000000e+00, -4.40486209e-15])
How to know grid point number corresponding to grid address
------------------------------------------------------------
Runngin with ``--write-gamma``, hdf5 files are written out file names
with grid point numbers such as ``kappa-m202020-g4200.hdf5``. You may
want to know the grid point number with given grid address. This is
done using ``get_grid_point_from_address`` as follows::
In [1]: from phono3py.phonon3.triplets import get_grid_point_from_address
In [2]: get_grid_point_from_address([0, 10, 10], [20, 20, 20])
Out[2]: 4200
Here the first argument of this method is the grid address and the
second argument is the mesh numbers.

View File

@ -29,10 +29,6 @@ def get_triplets_at_q(grid_point,
Mesh numbers
dtype='intc'
shape=(3,)
mesh : array_like
Mesh numbers
dtype='intc'
shape=(3,)
point_group : array_like
Rotation matrices in real space. Note that those in reciprocal space
mean these matrices transposed (local terminology).
@ -186,6 +182,26 @@ def get_grid_point_from_address_py(address, mesh):
def get_grid_point_from_address(address, mesh):
"""Grid point number is given by grid address.
Parameters
----------
address : array_like
Grid address.
dtype='intc'
shape=(3,)
mesh : array_like
Mesh numbers.
dtype='intc'
shape=(3,)
Returns
-------
int
Grid point number.
"""
return spg.get_grid_point_from_address(address, mesh)