Model#

Utilities for model.

Create model#

create model view, info, and basis.

create_model(model_list, topdir=None, symbolic=True, parallel=True, verbose=False, pdf=True, formatter=True, view_mode=None, qtdraw=True)[source]#

create model view, info, and basis.

Parameters:
  • model_list (dict or list) -- minimal model information.

  • topdir (str, optional) -- top directory for output.

  • symbolic (bool, optional) -- output in sympy format ?

  • parallel (bool, optional) -- use parallel code.

  • verbose (bool, optional) -- verbose parallel info.

  • pdf (bool, optional) -- create pdf/tex file.

  • formatter (bool, optional) -- format by using black.

  • view_mode (str, optional) -- mode for QtDraw, standard/arrow/debug. if None, option in the model is used.

  • qtdraw (bool, optional) -- use QtDraw ?

Create model#

construct model from matrx dict.

construct_samb_matrix(matrix_dict, k_grid=None)[source]#

construct SAMB matrix from matrix dict.

Parameters:
  • matrix_dict (dict) -- matrix dict from _matrix.py file.

  • k_grid (NSArray, optional) -- k_grid points (reduced coordinate).

Returns:

basis matrix, [#bases, #k, dim, dim].

Return type:

ndarray

construct_samb_matrix_k(matrix_dict, k_grid=None)[source]#

construct SAMB matrix from matrix dict.

Parameters:
  • matrix_dict (dict) -- matrix dict from _matrix_k.py file.

  • k_grid (NSArray, optional) -- k_grid points (reduced coordinate).

Returns:

basis matrix, [#bases, #k, dim, dim].

Return type:

ndarray

convert_samb_to_matrix_set(Z, param=None)[source]#

convert SAMB to a set of matrix.

Parameters:
  • Z (ndarray) -- samb matrix, [#bases, #k, dim, dim].

  • param (list, optional) -- parameter set(s), [z_j] for crystal or [z_j]/[[z_j]] for molecule.

Returns:

matrix, [#params/#k, dim, dim].

Return type:

ndarray

MaterialModel#

MaterialModel manages model information of cluster or crystal system.

class MaterialModel(dic, mpm)[source]#

Bases: dict

initialize the class.

Parameters:
  • dic (dict) -- model info. dict.

  • mpm (MultiPieManager) -- MultiPie manager.

create_view(scale=True, mode=None)[source]#

create QtDraw file.

Parameters:
  • scale (bool, optional) -- objects are scaled by means of volume.

  • mode (str, optional) -- view mode, standard/arrow/debug. if None, option in the model is used.

Returns:

QtDraw dict.

Return type:

dict

classmethod regularize(d)[source]#

regularize minimal model dict.

Parameters:

d (dict) -- dict of model.

Returns:

regularized model dict.

Return type:

dict

Symmetry-adapted Model#

SymmetryAdaptedModel manages symmetry adapted multipole basis set for cluster or crystal system.

class SymmetryAdaptedModel(model, mpm, head)[source]#

Bases: dict

initialize the class.

Parameters:
  • model (dict) -- model information of cluster or crystal system.

  • mpm (MultiPieManager) -- MultiPie manager.

  • head (list or str) -- heads of SAMB to be created.

create_dict()[source]#

create dictionary containing information and data of atomic, site-cluster, bond-cluster, uniform, (structure), Z(combined), Zk(fourier transform of Z).

Returns:

information and data of multipole bases.

Return type:

dict

create_matrix(fmt='sympy')[source]#

convert combined multipoles from dictionary to numerical matrix form (real-space).

Parameters:

fmt (str, optional) -- sympy/value.

Returns:

matrix form of combined multipoles, z_dict/z_full.

Return type:

dict

Note

z_dict = { "z_#" : {(n1, n2, n3, a, b): matrix element}, R=(n1,n2,n3) is a lattice vector.

create_matrix_k(full=False, fmt='sympy')[source]#

convert combined multipoles from dictionary to numerical matrix form (momentum-space).

Parameters:
  • full (bool, optional) -- full matrix format ?

  • fmt (str, optional) -- sympy/value.

Returns:

matrix form of combined multipoles, z_dict/z_full.

Return type:

dict

Note

z_dict = { "z_#" : [(i, j, ""/c###/s###, v)] } z_full = { "z_#" : NSArray(matrix) }

fourier_transform()[source]#

convert combined multipoles from dictionary to numerical matrix form (real-space).

Returns:

matrix form of combined multipoles, z_dict/z_full.

Return type:

dict

Note

z_dict = { "z_#" : {(n1, n2, n3, a, b): matrix element}, R=(n1,n2,n3) is a lattice vector.

MultiPie manager#

FileManager manages current directory and formatter.

class MultiPieManager(topdir=None, verbose=False, symbolic=True, formatter=True, pdf=True, parallel=True, qtdraw=True)[source]#

Bases: object

initialize the class.

Parameters:
  • topdir (str) -- top directory for output, ends without slash.

  • verbose (bool, optional) -- verbose parallel info. ?

  • symbolic (bool, optional) -- output in sympy format ?

  • formatter (bool, optional) -- format by using black ?

  • pdf (bool, optional) -- create pdf/tex file ?

  • parallel (bool, optional) -- use parallel code ?

  • qtdraw (bool, optional) -- use QtDraw ?

create_subdir(subdir)[source]#

create sub directory under topdir.

elapsed(from_stamp=True)[source]#

elapsed time.

Parameters:

from_stamp (bool, optional) -- if True, return difference from lap.

Returns:

elapsed time.

Return type:

float

filename(filename, full=True)[source]#

get (full) file name.

Parameters:
  • filename (str) -- file name.

  • full (bool, optional) -- with full path ?

Returns:

full file name (with full path).

Return type:

str

log(text, stamp='', end=None, file=None)[source]#

write log if verbose is True.

Parameters:
  • text (str) -- text to write.

  • stamp (str or None, optional) -- attach elapsed time if "start" or "", otherwise no stamp is attached.

  • end (str, optional) -- same as print end option.

  • file (str, optional) -- same as print file option.

read(file_dict)[source]#

read dict file or dict itself.

Parameters:

file_dict (str or dict) -- filename of dict. or dict.

Returns:

read dict.

Return type:

dict

set_group(group)[source]#

set group (and point group).

Parameters:

group (str or int or TagGroup) -- group.

Notes

  • space/point group can be accessed by self.group property.

  • associated point group can be accessed by self.point_group property.

set_stamp()[source]#

set current time.

write(filename, dic, header=None, var=None)[source]#

write dict to file.

Parameters:
  • filename (str) -- file name.

  • dic (dict) -- dict to write.

  • header (str, optional) -- header of dict.

  • var (str, optional) -- variable name for dict.