Skip to content

Commit

Permalink
Update manual
Browse files Browse the repository at this point in the history
  • Loading branch information
abelcarreras committed Nov 5, 2017
1 parent 1c9ab4a commit 591f38a
Show file tree
Hide file tree
Showing 33 changed files with 543 additions and 453 deletions.
73 changes: 63 additions & 10 deletions data/band_structure.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
from aiida import load_dbenv, is_dbenv_loaded
if not is_dbenv_loaded():
load_dbenv()

from aiida.orm import Data


class BandStructureData(Data):
"""
Store the band structure.
Store the band structure data
"""

def __init__(self, *args, **kwargs):
super(BandStructureData, self).__init__(*args, **kwargs)

def get_number_of_bands(self):
"""
:return: Number of bands
"""

if 'nbands' in self.get_attrs():
return self.get_attr('nbands')
Expand All @@ -25,6 +34,12 @@ def get_number_of_points(self):


def set_bands(self, ranges):
"""
Set the list of q-points the form the path in the reciprocal space
:param ranges: a 3D array that contains a list q-points in phonopy format: array[n_paths:n_qpoints:3]
:return:
"""

import tempfile
import numpy
Expand All @@ -41,6 +56,12 @@ def set_bands(self, ranges):
self._set_attr('npoints', len(ranges[0]))

def set_labels(self, band_labels):
"""
Set the labels of the high symmetry points in the reciprocal space that delimite the paths.
:param band_labels: Array (or list of lists) in seekpath format: array[n_paths:2]
:return:
"""

import tempfile
import numpy
Expand All @@ -55,7 +76,7 @@ def set_labels(self, band_labels):

def set_unitcell(self, unitcell):
"""
:param unitcell: Numpy Array that contains the unitcell matrix (Lattice vectors in columns)
:param unitcell: Numpy Array that contains the unitcell matrix (Lattice vectors in rows)
:return:
"""

Expand All @@ -71,6 +92,14 @@ def set_unitcell(self, unitcell):
self.add_path(f.name, 'unitcell.npy')

def set_band_structure_phonopy(self, band_structure_phonopy):
"""
Set the phonon band structure data obtained as output from phonopy. This includes the list of q-points,
q-points distances, and phonon frequencies. If q-points and distances are already set, this functions
checks consistency and stores only the phonon frequencies.
:param band_structure_phonopy: phonopy get_band_structure() function output.
:return:
"""

import tempfile
import numpy
Expand Down Expand Up @@ -99,7 +128,15 @@ def set_band_structure_phonopy(self, band_structure_phonopy):
self.add_path(f.name, element[0])

def set_band_structure_gruneisen(self, band_structure_gruneisen):
"""
Set the mode Gruneisen band structure data obtained as output from phonopy. This includes the list of q-points,
q-points distances, and phonon frequencies and mode gruneisen parameter.
If q-points and distances are already set, this functions checks consistency and stores only
the phonon frequencies and mode Gruneisen parameters.
:param band_structure_phonopy: phonopy get_band_structure() function output.
:return:
"""
import tempfile
import numpy

Expand Down Expand Up @@ -128,7 +165,9 @@ def set_band_structure_gruneisen(self, band_structure_gruneisen):

def get_unitcell(self):
"""
Return the unitcell in the node as a numpy array
Returns the unitcell matrix as a numpy array (Lattice vectors in rows)
:return: numpy array containing the unit cell matrix
"""
import numpy

Expand All @@ -141,7 +180,9 @@ def get_unitcell(self):

def get_distances(self, band=None):
"""
Return the distances in the node as a numpy array
Returns the distances as a numpy array
:return: numpy array containing the q-point distances (in Angstroms^-1)
"""
import numpy as np

Expand Down Expand Up @@ -173,7 +214,9 @@ def get_distances(self, band=None):

def get_frequencies(self, band=None):
"""
Return the frequencies in the node as a numpy array
Return the frequencies as a numpy array
:return: numpy array containing the phonon frequencies
"""
import numpy

Expand All @@ -189,7 +232,9 @@ def get_frequencies(self, band=None):

def get_gamma(self, band=None):
"""
Return the frequencies in the node as a numpy array
Return the mode Gruneisen parameters as a numpy array
:return: numpy array containing the mode Gruneisen parameters
"""
import numpy

Expand All @@ -206,7 +251,7 @@ def get_gamma(self, band=None):

def get_eigenvalues(self, band=None):
"""
Return the frequencies in the node as a numpy array
Return the eigenvalues as a numpy array
"""
import numpy

Expand All @@ -223,7 +268,9 @@ def get_eigenvalues(self, band=None):

def get_bands(self, band=None):
"""
Return the bands in the node as a numpy array
Return the bands as a numpy array
:return: numpy array containing a list of q-points in phonopy format: array[n_paths:n_points:3]
"""
import numpy

Expand All @@ -240,7 +287,10 @@ def get_bands(self, band=None):

def get_band_ranges(self, band=None):
"""
Return the bands in the node as a numpy array
Return the band ranges (only the limiting q-points of each path). This is used in phonopy's
gruneisen BandStructure class
:return: numpy array containing a list of 2 q-points for each path: array[n_paths:2:3]
"""
import numpy

Expand All @@ -256,8 +306,11 @@ def get_band_ranges(self, band=None):

def get_labels(self, band=None):
"""
Return the band labels in the node as a numpy array
Return the labels of the high symmetry points that limit each path as a numpy array
:return: numpy array containing a list of 2 labels for each path: array[n_paths:2]
"""

import numpy

fname = 'band_labels.npy'
Expand Down
25 changes: 14 additions & 11 deletions data/force_constants.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
from aiida import load_dbenv, is_dbenv_loaded
if not is_dbenv_loaded():
load_dbenv()

from aiida.orm import Data


Expand All @@ -12,15 +16,14 @@ def __init__(self, *args, **kwargs):

def get_shape(self):
"""
Return the shape of an array (read from the value cached in the
properties for efficiency reasons).
Return the shape of the force constants. This correspond to the number of atoms
:param name: The name of the array.
"""
return self.get_attr("shape")

def get_array(self):
"""
Return the force constants stored in the node as a numpy array
Return the force constants as a numpy array in phonopy format
"""
import numpy

Expand All @@ -31,10 +34,10 @@ def get_array(self):

def set_array(self, array):
"""
Store the force constants as a numpy array. Possibly overwrite the array
Store the force constants as a numpy array. Overwrites the array
if it already existed.
Internally, it is stored as a force_constants.npy file in numpy format.
:param array: The numpy array to store.
:param array: The numpy array containing the force constants to store.
"""

import tempfile
Expand All @@ -59,7 +62,7 @@ def set_array(self, array):

def get_epsilon(self):
"""
Return dielectric tensor stored in the node as a numpy array
Return dielectric tensor as a numpy array
"""
import numpy

Expand All @@ -74,7 +77,7 @@ def get_epsilon(self):

def get_born_charges(self):
"""
Return born charges stored in the node as a numpy array
Return born charges as a numpy array
"""
import numpy

Expand All @@ -97,9 +100,9 @@ def epsilon_and_born_exist(self):

def set_born_charges(self, array):
"""
Store Born charges as a numpy array. Possibly overwrite the array
Store Born charges as a numpy array. Overwrites the array
if it already existed.
Internally, it is stored as a force_constants.npy file in numpy format.
Internally, it is stored as a born_charges.npy file in numpy format.
:param array: The numpy array to store.
"""

Expand All @@ -118,9 +121,9 @@ def set_born_charges(self, array):

def set_epsilon(self, array):
"""
Store the dielectric tensor as a numpy array. Possibly overwrite the array
Store the dielectric tensor as a numpy array. Overwrites the array
if it already existed.
Internally, it is stored as a force_constants.npy file in numpy format.
Internally, it is stored as a epsilon.npy file in numpy format.
:param array: The numpy array to store.
"""

Expand Down
4 changes: 4 additions & 0 deletions data/force_sets.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
from aiida import load_dbenv, is_dbenv_loaded
if not is_dbenv_loaded():
load_dbenv()

from aiida.orm import Data


Expand Down
12 changes: 7 additions & 5 deletions data/phonon_dos.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from aiida.orm import Data
from aiida import load_dbenv, is_dbenv_loaded
if not is_dbenv_loaded():
load_dbenv()

from aiida.orm import Data

class PhononDosData(Data):
"""
Expand Down Expand Up @@ -30,7 +33,7 @@ def _get_equivalent_atom_list(self):

def get_dos(self):
"""
Return the force constants stored in the node as a numpy array
Return the density of states stored as a numpy array
"""
import numpy

Expand All @@ -41,7 +44,7 @@ def get_dos(self):

def get_number_of_partial_dos(self, full=False):
"""
Return the force constants stored in the node as a numpy array
Return the number of partial density of states (corresponds to the number of atoms in the primitive cell)
"""
import numpy

Expand All @@ -56,7 +59,7 @@ def get_number_of_partial_dos(self, full=False):

def get_partial_dos(self, full=False):
"""
Return the force constants stored in the node as a numpy array
Return a numpy that contains the partial density of states of each atom in the primitive cell
"""
import numpy

Expand All @@ -80,7 +83,6 @@ def get_frequencies(self):

return array


def get_atom_labels(self, full=False):
"""
Store the phonon dos as a numpy array.
Expand Down
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = aiida-phonopy
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

0 comments on commit 591f38a

Please sign in to comment.