Full Python Module Specification
For convenience, we include all documented functions/classes of the
diverge python library in this file.
- class diverge.ArgUnion
- diverge.alloc_array(shape, dtype='complex128_t')
allocate an array of given data type and shape such that it is not cleared by the python garbage collector
- Parameters:
shape – all dimensions (in C ordering)
dtype – data type. can be
"complex128_t","rs_hopping_t","rs_vertex_t", or"tu_formfactor_t". data type name must be passed as python string.
- diverge.autoflow(hoppings=None, vertex=None, nk=None, nkf=None, lattice=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]), no=1, SU2=1, nspin=1, sites=[[0, 0, 0]], model_output='model.dvg', post_output='post.dvg', flow_output='flow.dat', rs_symmetries=None, orb_symmetries=None, mode='tu', npatches_ibz=6, formfactor_maxdist=2.01, channels='PCD', ibz_path=[], maxvert=50.0, mu=None, nu=None)
Function for the simplest possible FRG flow.
Can be used to get familiar with the library, or to do some extremely rapid coding for a ‘standard’ FRG run. Outputs to three files by default and has some drastic simplifications built in, with no control left to the user. You are strongly advised to (a) build on top of this function or (b) use the actual API for actual (serious) projects.
- Parameters:
hoppings –
rs_hopping_tarray with the hopping elements. Created bydiverge.zeros((n_hop,), dtype=diverge.rs_hopping_t). required.vertex –
rs_vertex_tarray with the interaction elements. Created bydiverge.zeros((n_vert,), dtype=diverge.rs_vertex_t). required.nk – length 3 integer tuple for the momentum mesh. required.
nkf – length 3 integer tuple for the refined momentum mesh, default: refinement factor 15
lattice – (3,3) float64 array for the lattice vectors in C ordering, default:
np.eye(3)no – number of orbitals, default: 1
SU2 – use \(SU(2)\) symmetry, default: 1
nspin – number of spin degrees of freedom (\(n_\mathrm{spin}\)), default: 1 (since SU(2) is active)
sites – (n_orb, 3) float64 array for the positions in C ordering (see
diverge_model_t.positions), default:[[0,0,0]]model_output – string for the model output file (see
diverge_model_to_file()), default:"model.dvg"post_output – string for the postprocessing output file (see
diverge_postprocess_and_write()), default:"post.dvg"flow_output – string for the flow output file (see Flow), default:
"flow.dat"rs_symmetries – (n_sym, 3, 3) array or None. use these matrices as real-space symmetries (see Symmetries), default: None
orb_symmetries – (n_sym, n_orb, n_orb) array or None. use these matrices as orbital symmetries, default: None
mode – string for backend selection, default:
"tu"npatches_ibz – in case
mode == "patch", the number of patches to look for in the IBZ (seediverge_model_internals_patch()), default: 6formfactor_maxdist – in case
mode == "tu", the formfactor cutoff distance (seediverge_model_internals_tu()), default 2.01channels – string that holds the diagrammatic channels that should be included in the FRG flow (see
diverge_flow_step_init()), default:"PCD"ibz_path – array that holds the crystalc coordinates of the high symmetry path for band structures (see
diverge_model_t.ibz_path), default: []maxvert – value of maximum vertex element that is considered ‘diverged’ (see
diverge_euler_t).mu – chemical potential \(\mu\) (see
diverge_model_set_chempot()), default: Nonenu – filling value \(\nu\) between zero and one (see
diverge_model_set_filling()), default: None
- diverge.complex128_t
alias of
struct_complex128_t
- diverge.complex64_t
alias of
struct_complex64_t
- diverge.constants_t
alias of
struct_constants_t
- diverge.euler_t
alias of
struct_euler_t
- diverge.flow_step_t
alias of
struct_flow_step_t
- diverge.flow_step_vertex_t
alias of
struct_flow_step_vertex_t
- class diverge.generate_symm_maps_precision_t
- diverge.generate_symm_trafo(n_spin, orbs, syms)
python version of the symmetry transformation
- Parameters:
n_spin – number of spins
orbs – np.array( …, dtype=site_descr_t )
syms – np.array( …, dtype=sym_op_t )
- Returns:
rs_trafo; (3,3) double array
orb_trafo; (n_spin*orbs.size, n_spin*orbs.size)
complex128_tarray
- diverge.gf_complex_t
alias of
struct_complex128_t
- diverge.info()
print information on the shared library
- diverge.internals_t
alias of
struct_internals_t
- diverge.kmesh_to_bands_PY(model, crs=False)
get the ipz_path indices of a
diverge_model_tin a pythonic way, wrapping bothdiverge_kmesh_to_bands()anddiverge_kmesh_to_bands_crs().- Parameters:
model – diverge model structure
crs – use the coarse mesh?
- Returns:
a tuple
(n_per_segment, pts, n_pts), wheren_per_segmentis the number of indices per ibz_path segment,ptsis the array of all indices, andn_ptsthe length ofpts.- Return type:
(numpy array of type
index_t, numpy array of typeindex_t, integer)
- diverge.lattice_t
alias of
struct_lattice_t
- diverge.model_internals_any_PY(model, mode, np_ibz=None, max_dist=None)
wraps
diverge_model_internals_any()with varargs substituted by kwargs; np_ibz or max_dist.
- diverge.model_output_conf_t
alias of
struct_model_output_conf_t
- diverge.model_t
alias of
struct_model_t
- diverge.model_to_file_PY(model, filename, **kwargs)
function that wraps
diverge_model_to_file_finegrained()in a pythonic way.- Parameters:
model – diverge model
filename – output file name
**kwargs – keyword arguments, where each member of
diverge_model_output_conf_tcan be passed as kwarg in the formkey=val. Defaults are those returned bydiverge_model_output_conf_defaults_CPP().
- diverge.mom_patching_t
alias of
struct_mom_patching_t
- class diverge.mpi_stdout_logger(fname, mode='w')
direct output to stdout and a file at the same time. usage:
stdout_ = sys.stdout sys.stdout = mpi_stdout_logger(filename) # some code with print() statements sys.stdout = stdout_
- diverge.patching_find_fs_pts_PY(model, energies, nbands, np_ibz, np_ibz_search)
returns a numpy array of
index_twith the indices of the found patches. wrapsdiverge_patching_find_fs_pts_C()in a pythonic way.- Parameters:
model –
diverge_model_tpointerenergies – either None or pointer to a double (64bit) floating point array that holds energies for nbands bands on the mesh defined in the model, i.e. an (nk, nb) array
nbands – number of bands to use. if energies is None, must coincide with the number of bands defined in the model
np_ibz – number of patches that should be found in the IBZ
np_ibz_search – number of points that are considered for the patch search
- diverge.postprocess_and_write_PY(step, filename, **kwargs)
wraps
diverge_postprocess_and_write_finegrained()in a convenient pythonic way.- Parameters:
step –
diverge_flow_step_tpointerfilename – string where to save the postprocessing results
**kwargs – each member of
diverge_postprocess_conf_tcan be passed as kwarg (key1 = val1, key2 = val2, …). The defaults are those returned bydiverge_postprocess_conf_defaults_CPP().
- diverge.postprocess_conf_t
alias of
struct_postprocess_conf_t
- diverge.print(*args, **kwargs)
wraps the python print function to work with MPI
- diverge.read_W90_PY(fname, nspin, swap_orbitals=False)
returns a numpy array of
rs_hopping_twith the hoppings from W90 file. Wrapsdiverge_read_W90_C()s.t. no messy pointer stuff must be done manually from within python.- Parameters:
fname – filename to read W90 data from (usually …_hr.dat)
nspin – default value 0 amounts to SU(2) symmetric model. if nspin != 0, abs(nspin) = (S+1/2)*2 with S the physical spin (i.e., for S=1/2 we have abs(nspin)=2). the sign determines whether the spin index is the one which increases memory slowly (negative) for fast (positive)
- diverge.rs_hopping_t
alias of
struct_rs_hopping_t
- diverge.rs_vertex_t
alias of
struct_rs_vertex_t
- diverge.run_tests(args=[])
run all unit tests shipped with divERGe to check health, wraps
diverge_run_tests()without pointer stuff for the argc/argv parameters.Note: You must initialize the library before calling this function!
- Parameters:
args – list of strings to pass as an argument to CATCH (the testing framework). To enable a specific test filter, set args=[‘[filter]’]. For example, the BHK tests can be run with args=[‘[BHK]’].
- diverge.site_descr_t
alias of
struct_site_descr_t
- class diverge.struct_complex128_t
- class diverge.struct_complex64_t
- class diverge.struct_constants_t
- class diverge.struct_euler_t
- class diverge.struct_flow_step_t
- class diverge.struct_flow_step_vertex_t
- class diverge.struct_internals_t
- class diverge.struct_lattice_t
- class diverge.struct_model_output_conf_t
- class diverge.struct_model_t
- class diverge.struct_mom_patching_t
- class diverge.struct_postprocess_conf_t
- class diverge.struct_rs_hopping_t
- class diverge.struct_rs_vertex_t
- class diverge.struct_site_descr_t
- class diverge.struct_sym_op_t
- class diverge.struct_timing_t
- class diverge.struct_tu_formfactor_t
- class diverge.supercell_configure_t
- diverge.sym_op_t
alias of
struct_sym_op_t
- diverge.timing_t
alias of
struct_timing_t
- diverge.tu_formfactor_t
alias of
struct_tu_formfactor_t
- diverge.view_array(mem, dtype=<class 'numpy.complex128'>, shape=(1, ))
give an array view on existing memory
- Parameters:
dtype – data type that the view is using
shape – all dimensions (in C ordering) that the view is using