diff --git a/docs/source/_build/doctrees/bibliography.doctree b/docs/source/_build/doctrees/bibliography.doctree index 85e57e1..1974d1a 100644 Binary files a/docs/source/_build/doctrees/bibliography.doctree and b/docs/source/_build/doctrees/bibliography.doctree differ diff --git a/docs/source/_build/doctrees/changelog/index.doctree b/docs/source/_build/doctrees/changelog/index.doctree index 72fe063..d8c770e 100644 Binary files a/docs/source/_build/doctrees/changelog/index.doctree and b/docs/source/_build/doctrees/changelog/index.doctree differ diff --git a/docs/source/_build/doctrees/cite.doctree b/docs/source/_build/doctrees/cite.doctree index e33507d..8e98322 100644 Binary files a/docs/source/_build/doctrees/cite.doctree and b/docs/source/_build/doctrees/cite.doctree differ diff --git a/docs/source/_build/doctrees/dev/index.doctree b/docs/source/_build/doctrees/dev/index.doctree index 22fb2aa..31d6493 100644 Binary files a/docs/source/_build/doctrees/dev/index.doctree and b/docs/source/_build/doctrees/dev/index.doctree differ diff --git a/docs/source/_build/doctrees/environment.pickle b/docs/source/_build/doctrees/environment.pickle index 9143607..c3c0e65 100644 Binary files a/docs/source/_build/doctrees/environment.pickle and b/docs/source/_build/doctrees/environment.pickle differ diff --git a/docs/source/_build/doctrees/implementation/environment.doctree b/docs/source/_build/doctrees/implementation/environment.doctree index eb40910..5b63ae5 100644 Binary files a/docs/source/_build/doctrees/implementation/environment.doctree and b/docs/source/_build/doctrees/implementation/environment.doctree differ diff --git a/docs/source/_build/doctrees/implementation/grogupy.core.doctree b/docs/source/_build/doctrees/implementation/grogupy.core.doctree deleted file mode 100644 index 1603524..0000000 Binary files a/docs/source/_build/doctrees/implementation/grogupy.core.doctree and /dev/null differ diff --git a/docs/source/_build/doctrees/implementation/grogupy.doctree b/docs/source/_build/doctrees/implementation/grogupy.doctree index 1ad06f8..d2551f1 100644 Binary files a/docs/source/_build/doctrees/implementation/grogupy.doctree and b/docs/source/_build/doctrees/implementation/grogupy.doctree differ diff --git a/docs/source/_build/doctrees/implementation/grogupy.grogu.doctree b/docs/source/_build/doctrees/implementation/grogupy.grogu.doctree deleted file mode 100644 index 5c6de74..0000000 Binary files a/docs/source/_build/doctrees/implementation/grogupy.grogu.doctree and /dev/null differ diff --git a/docs/source/_build/doctrees/implementation/grogupy.io.doctree b/docs/source/_build/doctrees/implementation/grogupy.io.doctree deleted file mode 100644 index ce8a75b..0000000 Binary files a/docs/source/_build/doctrees/implementation/grogupy.io.doctree and /dev/null differ diff --git a/docs/source/_build/doctrees/implementation/grogupy.magnetism.doctree b/docs/source/_build/doctrees/implementation/grogupy.magnetism.doctree deleted file mode 100644 index 76be708..0000000 Binary files a/docs/source/_build/doctrees/implementation/grogupy.magnetism.doctree and /dev/null differ diff --git a/docs/source/_build/doctrees/implementation/grogupy.utilities.doctree b/docs/source/_build/doctrees/implementation/grogupy.utilities.doctree deleted file mode 100644 index 09270ba..0000000 Binary files a/docs/source/_build/doctrees/implementation/grogupy.utilities.doctree and /dev/null differ diff --git a/docs/source/_build/doctrees/implementation/modules.doctree b/docs/source/_build/doctrees/implementation/modules.doctree index a54b3ca..cf3a011 100644 Binary files a/docs/source/_build/doctrees/implementation/modules.doctree and b/docs/source/_build/doctrees/implementation/modules.doctree differ diff --git a/docs/source/_build/doctrees/index.doctree b/docs/source/_build/doctrees/index.doctree index 681e7c4..9c5b65d 100644 Binary files a/docs/source/_build/doctrees/index.doctree and b/docs/source/_build/doctrees/index.doctree differ diff --git a/docs/source/_build/doctrees/introduction.doctree b/docs/source/_build/doctrees/introduction.doctree index 0c7c742..747b884 100644 Binary files a/docs/source/_build/doctrees/introduction.doctree and b/docs/source/_build/doctrees/introduction.doctree differ diff --git a/docs/source/_build/doctrees/quickstart/index.doctree b/docs/source/_build/doctrees/quickstart/index.doctree index 488c75b..3678996 100644 Binary files a/docs/source/_build/doctrees/quickstart/index.doctree and b/docs/source/_build/doctrees/quickstart/index.doctree differ diff --git a/docs/source/_build/doctrees/tutorials/index.doctree b/docs/source/_build/doctrees/tutorials/index.doctree index 58ff44d..2c00f78 100644 Binary files a/docs/source/_build/doctrees/tutorials/index.doctree and b/docs/source/_build/doctrees/tutorials/index.doctree differ diff --git a/docs/source/_build/html/_modules/grogupy/core.html b/docs/source/_build/html/_modules/grogupy/core.html index 5ebd162..f13bd0b 100644 --- a/docs/source/_build/html/_modules/grogupy/core.html +++ b/docs/source/_build/html/_modules/grogupy/core.html @@ -112,6 +112,9 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +"""Docstring in core. +""" + import numpy as np from numpy.linalg import inv @@ -119,67 +122,30 @@ from grogupy.utilities import commutator -
-[docs] -def parallel_Gk(HK, SK, eran, eset): - """Calculates the Greens function by inversion. - - It calculates the Greens function on all the energy levels at the same time. - - Args: - HK : (NO, NO), np.array_like - Hamiltonian at a given k point - SK : (NO, NO), np.array_like - Overlap Matrix at a given k point - eran : (eset) np.array_like - Energy sample along the contour - eset : int - Number of energy samples along the contour - - Returns: - Gk : (eset, NO, NO), np.array_like - Green's function at a given k point - """ - - # Calculates the Greens function on all the energy levels - return inv(SK * eran.reshape(eset, 1, 1) - HK)
- - - -
-[docs] -def sequential_GK(HK, SK, eran, eset): - """Calculates the Greens function by inversion. +
+[docs] +def onsite_projection(matrix, idx1, idx2): + """It produces the slices of a matrix for the on site projection. - It calculates sequentially over the energy levels. + The slicing is along the last two axes as these contains the orbital indexing. Args: - HK : (NO, NO), np.array_like - Hamiltonian at a given k point - SK : (NO, NO), np.array_like - Overlap Matrix at a given k point - eran : (eset) np.array_like - Energy sample along the contour - eset : int - Number of energy samples along the contour + matrix : (..., :, :) np.array_like + Some matrix + idx : np.array_like + The indexes of the orbitals Returns: - Gk : (eset, NO, NO), np.array_like - Green's function at a given k point + np.array_like + Reduced matrix based on the projection """ - # creates an empty holder - Gk = np.zeros(shape=(eset, HK.shape[0], HK.shape[1]), dtype="complex128") - # fills the holder sequentially by the Greens function on a given energy - for j in range(eset): - Gk[j] = inv(SK * eran[j] - HK) - - return Gk
+ return matrix[..., idx1, :][..., idx2]
-[docs] +[docs] def calc_Vu(H, Tu): """Calculates the local perturbation in case of a spin rotation. @@ -203,45 +169,8 @@ -
-[docs] -def remove_clutter_for_save(pairs, magnetic_entities): - """Removes unimportant data from the dictionaries. - - It is used before saving to throw away data that - is not needed for post processing. - - Args: - pairs : dict - Contains all the pair information - magnetic_entities : dict - Contains all the magnetic entity information - - Returns: - pairs : dict - Contains all the reduced pair information - magnetic_entities : dict - Contains all the reduced magnetic entity information - """ - - # remove clutter from magnetic entities and pair information - for pair in pairs: - del pair["Gij"] - del pair["Gij_tmp"] - del pair["Gji"] - del pair["Gji_tmp"] - for mag_ent in magnetic_entities: - del mag_ent["Gii"] - del mag_ent["Gii_tmp"] - del mag_ent["Vu1"] - del mag_ent["Vu2"] - - return pairs, magnetic_entities
- - -
-[docs] +[docs] def build_hh_ss(dh): """It builds the Hamiltonian and Overlap matrix from the sisl.dh class. @@ -300,7 +229,7 @@ [ U.T
-[docs] +[docs] @ np.block([[h11[:, :, i], h12[:, :, i]], [h21[:, :, i], h22[:, :, i]]]) @ U for i in range(dh.lattice.nsc.prod()) @@ -474,25 +403,99 @@ -
-[docs] -def onsite_projection(matrix, idx1, idx2): - """It produces the slices of a matrix for the on site projection. +
+[docs] +def parallel_Gk(HK, SK, eran, eset): + """Calculates the Greens function by inversion. - The slicing is along the last two axes as these contains the orbital indexing. + It calculates the Greens function on all the energy levels at the same time. Args: - matrix : (..., :, :) np.array_like - Some matrix - idx : np.array_like - The indexes of the orbitals + HK : (NO, NO), np.array_like + Hamiltonian at a given k point + SK : (NO, NO), np.array_like + Overlap Matrix at a given k point + eran : (eset) np.array_like + Energy sample along the contour + eset : int + Number of energy samples along the contour Returns: - np.array_like - Reduced matrix based on the projection + Gk : (eset, NO, NO), np.array_like + Green's function at a given k point """ - return matrix[..., idx1, :][..., idx2]
+ # Calculates the Greens function on all the energy levels + return inv(SK * eran.reshape(eset, 1, 1) - HK)
+ + + +
+[docs] +def sequential_GK(HK, SK, eran, eset): + """Calculates the Greens function by inversion. + + It calculates sequentially over the energy levels. + + Args: + HK : (NO, NO), np.array_like + Hamiltonian at a given k point + SK : (NO, NO), np.array_like + Overlap Matrix at a given k point + eran : (eset) np.array_like + Energy sample along the contour + eset : int + Number of energy samples along the contour + + Returns: + Gk : (eset, NO, NO), np.array_like + Green's function at a given k point + """ + + # creates an empty holder + Gk = np.zeros(shape=(eset, HK.shape[0], HK.shape[1]), dtype="complex128") + # fills the holder sequentially by the Greens function on a given energy + for j in range(eset): + Gk[j] = inv(SK * eran[j] - HK) + + return Gk
+ + + +
+[docs] +def remove_clutter_for_save(pairs, magnetic_entities): + """Removes unimportant data from the dictionaries. + + It is used before saving to throw away data that + is not needed for post processing. + + Args: + pairs : dict + Contains all the pair information + magnetic_entities : dict + Contains all the magnetic entity information + + Returns: + pairs : dict + Contains all the reduced pair information + magnetic_entities : dict + Contains all the reduced magnetic entity information + """ + + # remove clutter from magnetic entities and pair information + for pair in pairs: + del pair["Gij"] + del pair["Gij_tmp"] + del pair["Gji"] + del pair["Gji_tmp"] + for mag_ent in magnetic_entities: + del mag_ent["Gii"] + del mag_ent["Gii_tmp"] + del mag_ent["Vu1"] + del mag_ent["Vu2"] + + return pairs, magnetic_entities
diff --git a/docs/source/_build/html/_modules/grogupy/grogu.html b/docs/source/_build/html/_modules/grogupy/grogu.html index 233f699..903290d 100644 --- a/docs/source/_build/html/_modules/grogupy/grogu.html +++ b/docs/source/_build/html/_modules/grogupy/grogu.html @@ -112,7 +112,11 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +"""Docstring in grogupy. +""" + import warnings +from argparse import ArgumentParser from sys import getsizeof from timeit import default_timer as timer @@ -140,48 +144,97 @@ from grogupy import * -
-[docs] -def main(): - # runtime information - times = dict() - times["start_time"] = timer() +
+[docs] +def parse_command_line(): + """This function can read input from the command line.""" - # input output stuff - ###################################################################### - ###################################################################### - ###################################################################### + parser = ArgumentParser() - infile = "/Users/danielpozsar/Downloads/nojij/Fe3GeTe2/monolayer/soc/lat3_791/Fe3GeTe2.fdf" - outfile = "./Fe3GeTe2_notebook" + parser.add_argument( + "-i", + "--input", + dest="infile", + default=None, + type=str, + help="Input file name", + required=True, + ) + parser.add_argument( + "-o", + "--output", + dest="outfile", + default=None, + type=str, + help="Output file name", + ) - magnetic_entities = [ - dict(atom=3, l=2), - dict(atom=4, l=2), - dict(atom=5, l=2), - ] - pairs = [ - dict(ai=0, aj=1, Ruc=np.array([0, 0, 0])), - dict(ai=0, aj=2, Ruc=np.array([0, 0, 0])), - dict(ai=1, aj=2, Ruc=np.array([0, 0, 0])), - dict(ai=0, aj=2, Ruc=np.array([-1, -1, 0])), - dict(ai=1, aj=2, Ruc=np.array([-1, -1, 0])), - dict(ai=0, aj=2, Ruc=np.array([-1, 0, 0])), - dict(ai=1, aj=2, Ruc=np.array([-1, 0, 0])), - dict(ai=1, aj=2, Ruc=np.array([-2, 0, 0])), - dict(ai=1, aj=2, Ruc=np.array([-3, 0, 0])), - ] - simulation_parameters = default_args - simulation_parameters["infile"] = infile - simulation_parameters["outfile"] = outfile - simulation_parameters["kset"] = 20 - simulation_parameters["kdirs"] = "xy" - simulation_parameters["eset"] = 600 - simulation_parameters["esetp"] = 10000 + # parser.add_argument('--scf-orientation', dest = 'scf_xcf_orientation', default = None, help = 'Output file name') + # parser.add_argument('--ref-orientation', dest = 'ref_xcf_orientations', default = None, help = 'Output file name') - ###################################################################### - ###################################################################### - ###################################################################### + parser.add_argument( + "--kset", + dest="kset", + default=None, + type=int, + help="k-space resolution of calculation", + ) + parser.add_argument( + "--kdirs", + dest="kdirs", + default=None, + type=str, + help="Definition of k-space dimensionality", + ) + parser.add_argument( + "--ebot", + dest="ebot", + default=None, + type=float, + help="Bottom energy of the contour", + ) + parser.add_argument( + "--eset", + dest="eset", + default=None, + type=int, + help="Number of energy points on the contour", + ) + parser.add_argument( + "--eset-p", + dest="esetp", + default=None, + type=int, + help="Parameter tuning the distribution on the contour", + ) + + parser.add_argument( + "--parallel-green", + dest="parallel_solver_for_Gk", + default=None, + type=bool, + help="Whether to use the parallel or sequential solver for Greens function", + ) + parser.add_argument( + "--padawan-mode", + dest="padawan_mode", + default=None, + type=bool, + help="If it is on it turns on extra helpful information for new users", + ) + + cmd_line_args = parser.parse_args() + + return cmd_line_args
+ + + +
+[docs] +def main(simulation_parameters, magnetic_entities, pairs): + # runtime information + times = dict() + times["start_time"] = timer() # MPI parameters comm = MPI.COMM_WORLD @@ -555,7 +608,62 @@ if __name__ == "__main__": - main() + # loading parameters + # it is not clear how to give grogu.fdf path... + command_line_arguments = parse_command_line() + fdf_arguments, magnetic_entities, pairs = read_fdf(command_line_arguments["infile"]) + + # right now we do not use any of these input, but it shows + # the order of priority when processing arguments + default_arguments = False + fdf_arguments = False + command_line_arguments = False + simulation_parameters = process_input_args( + default_arguments, fdf_arguments, command_line_arguments, ACCEPTED_INPUTS + ) + + #################################################################################################### + # This is the input file for now # + #################################################################################################### + magnetic_entities = [ + dict(atom=3, l=2), + dict(atom=4, l=2), + dict(atom=5, l=2), + ] + pairs = [ + dict(ai=0, aj=1, Ruc=np.array([0, 0, 0])), + dict(ai=0, aj=2, Ruc=np.array([0, 0, 0])), + dict(ai=1, aj=2, Ruc=np.array([0, 0, 0])), + dict(ai=0, aj=2, Ruc=np.array([-1, -1, 0])), + dict(ai=1, aj=2, Ruc=np.array([-1, -1, 0])), + dict(ai=0, aj=2, Ruc=np.array([-1, 0, 0])), + dict(ai=1, aj=2, Ruc=np.array([-1, 0, 0])), + dict(ai=1, aj=2, Ruc=np.array([-2, 0, 0])), + dict(ai=1, aj=2, Ruc=np.array([-3, 0, 0])), + ] + simulation_parameters = dict() + simulation_parameters["infile"] = ( + "/Users/danielpozsar/Downloads/nojij/Fe3GeTe2/monolayer/soc/lat3_791/Fe3GeTe2.fdf" + ) + simulation_parameters["outfile"] = "./Fe3GeTe2_notebook" + simulation_parameters["scf_xcf_orientation"] = np.array([0, 0, 1]) + simulation_parameters["ref_xcf_orientations"] = [ + dict(o=np.array([1, 0, 0]), vw=[np.array([0, 1, 0]), np.array([0, 0, 1])]), + dict(o=np.array([0, 1, 0]), vw=[np.array([1, 0, 0]), np.array([0, 0, 1])]), + dict(o=np.array([0, 0, 1]), vw=[np.array([1, 0, 0]), np.array([0, 1, 0])]), + ] + simulation_parameters["kset"] = 20 + simulation_parameters["kdirs"] = "xy" + simulation_parameters["ebot"] = None + simulation_parameters["eset"] = 600 + simulation_parameters["esetp"] = 10000 + simulation_parameters["parallel_solver_for_Gk"] = False + simulation_parameters["padawan_mode"] = True + #################################################################################################### + # This is the input file for now # + #################################################################################################### + + main(simulation_parameters, magnetic_entities, pairs)
diff --git a/docs/source/_build/html/_modules/grogupy/io.html b/docs/source/_build/html/_modules/grogupy/io.html index 96ec00d..f765126 100644 --- a/docs/source/_build/html/_modules/grogupy/io.html +++ b/docs/source/_build/html/_modules/grogupy/io.html @@ -112,12 +112,30 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from argparse import ArgumentParser +"""Docstring in io. +""" + from pickle import dump, load import numpy as np - -default_args = dict( +from sisl.io import fdfSileSiesta + +# list of accepted input parameters +ACCEPTED_INPUTS = [ + "infile", + "outfile", + "scf_xcf_orientation", + "ref_xcf_orientations", + "kset", + "kdirs", + "ebot", + "eset", + "esetp", + "parallel_solver_for_Gk", + "padawan_mode", +] + +default_arguments = dict( infile=None, outfile=None, scf_xcf_orientation=np.array([0, 0, 1]), @@ -135,22 +153,168 @@ padawan_mode=True, ) -# parser = ArgumentParser() -# parser.add_argument('--input' , dest = 'infile' , default=None , help = 'Input file name') -# parser.add_argument('--output' , dest = 'outfile', default=None , help = 'Output file name') +
+[docs] +def read_fdf(path): + """It reads the simulation parameters, magnetic entities and pairs from the fdf. -# parser.add_argument('--kset' , dest = 'kset' , default = 2 , type=int , help = 'k-space resolution of Jij calculation') -# parser.add_argument('--kdirs' , dest = 'kdirs' , default = 'xyz' , help = 'Definition of k-space dimensionality') -# parser.add_argument('--ebot' , dest = 'ebot' , default = None , type=float, help = 'Bottom energy of the contour') -# parser.add_argument('--eset' , dest = 'eset' , default = 42 , type=int , help = 'Number of energy points on the contour') -# parser.add_argument('--eset-p' , dest = 'esetp' , default = 1000 , type=int , help = 'Parameter tuning the distribution on the contour') + Args: + path : string + The path to the .fdf file + + Returns: + fdf_arguments : dict + The read input arguments from the fdf file + magnetic_entities : list + It contains the dictionaries associated with the magnetic entities + pairs : dict + It contains the dictionaries associated with the pair information + """ + + # read fdf file + fdf = fdfSileSiesta(path) + fdf_arguments = dict() + + InputFile = fdf.get("InputFile") + if InputFile is not None: + fdf_arguments["infile"] = InputFile + + OutputFile = fdf.get("OutputFile") + if OutputFile is not None: + fdf_arguments["outfile"] = OutputFile + + ScfXcfOrientation = fdf.get("ScfXcfOrientation") + if ScfXcfOrientation is not None: + fdf_arguments["scf_xcf_orientation"] = np.array(ScfXcfOrientation) + + XCF_Rotation = fdf.get("XCF_Rotation") + if XCF_Rotation is not None: + rotations = [] + # iterate over rows + for rot in XCF_Rotation: + # convert row to dictionary + dat = np.array(rot.split()[:9], dtype=float) + o = dat[:3] + vw = dat[3:].reshape(2, 3) + rotations.append(dict(o=o, vw=vw)) + fdf_arguments["ref_xcf_orientations"] = rotations + + Kset = fdf.get("INTEGRAL.Kset") + if Kset is not None: + fdf_arguments["kset"] = Kset + + Kdirs = fdf.get("INTEGRAL.Kdirs") + if Kdirs is not None: + fdf_arguments["kdirs"] = Kdirs + + # This is permitted because it means automatic Ebot definition + fdf_arguments["ebot"] = fdf.get("INTEGRAL.Ebot") + + Eset = fdf.get("INTEGRAL.Eset") + if Eset is not None: + fdf_arguments["eset"] = Eset + + Esetp = fdf.get("INTEGRAL.Esetp") + if Esetp is not None: + fdf_arguments["esetp"] = Esetp + + ParallelSolver = fdf.get("GREEN.ParallelSolver") + if ParallelSolver is not None: + fdf_arguments["parallel_solver_for_Gk"] = ParallelSolver + + PadawanMode = fdf.get("PadawanMode") + if PadawanMode is not None: + fdf_arguments["padawan_mode"] = PadawanMode + + Pairs = fdf.get("Pairs") + if Pairs is not None: + pairs = [] + # iterate over rows + for fdf_pair in Pairs: + # convert data + dat = np.array(fdf_pair.split()[:5], dtype=int) + # create pair dictionary + my_pair = dict(ai=dat[0], aj=dat[1], Ruc=np.array(dat[2:])) + pairs.append(my_pair) + + MagneticEntities = fdf.get("MagneticEntities") + if MagneticEntities is not None: + magnetic_entities = [] + for mag_ent in MagneticEntities: + row = mag_ent.split() + dat = [] + for string in row: + if string.find("#") != -1: + break + dat.append(string) + if dat[0] in {"Cluster", "cluster"}: + magnetic_entities.append(dict(atom=[int(_) for _ in dat[1:]])) + continue + elif dat[0] in {"AtomShell", "Atomshell", "atomShell", "atomshell"}: + magnetic_entities.append( + dict(atom=int(dat[1]), l=[int(_) for _ in dat[2:]]) + ) + continue + elif dat[0] in {"AtomOrbital", "Atomorbital", "tomOrbital", "atomorbital"}: + magnetic_entities.append( + dict(atom=int(dat[1]), orb=[int(_) for _ in dat[2:]]) + ) + continue + elif dat[0] in {"Orbitals", "orbitals"}: + magnetic_entities.append(dict(orb=[int(_) for _ in dat[1:]])) + continue + else: + raise Exception("Unrecognizable magnetic entity in .fdf!") + + return fdf_arguments, magnetic_entities, pairs
+ + + +
+[docs] +def process_input_args( + default_arguments, + fdf_arguments, + command_line_arguments, + accepted_inputs=ACCEPTED_INPUTS, +): + """It returns the final simulation parameters based on the inputs. + + The merging is done in the order of priority: + 1. command line arguments + 2. fdf arguments + 3. default arguments + + Args: + default_arguments : dict + Default arguments from grogupy + fdf_arguments : dict + Arguments read from the fdf input file + command_line_arguments : dict + Arguments from the command line + + Returns: + dict + The final simulation parameters + """ + + # iterate over fdf_arguments and update default arguments + for key, value in fdf_arguments.values(): + if value is not None and key in accepted_inputs: + default_arguments[key] = value + + # iterate over command_line_arguments and update default arguments + for key, value in command_line_arguments.values(): + if value is not None and key in accepted_inputs: + default_arguments[key] = value + + return default_arguments
-# cmd_line_args = parser.parse_args()
-[docs] +[docs] def save_pickle(outfile, data): """Saves the data in the outfile with pickle. @@ -168,7 +332,7 @@
-[docs] +[docs] def load_pickle(infile): """Loads the data from the infile with pickle. @@ -189,8 +353,69 @@ + + + + diff --git a/docs/source/_build/html/_modules/grogupy/magnetism.html b/docs/source/_build/html/_modules/grogupy/magnetism.html index c2ce206..0038c4c 100644 --- a/docs/source/_build/html/_modules/grogupy/magnetism.html +++ b/docs/source/_build/html/_modules/grogupy/magnetism.html @@ -112,11 +112,14 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +"""Docstring in magnetism. +""" + import numpy as np
-[docs] +[docs] def blow_up_orbindx(orb_indices): """Function to blow up orbital indices to make SPIN BOX indices. @@ -136,7 +139,7 @@
-[docs] +[docs] def spin_tracer(M): """Spin tracer utility. @@ -173,7 +176,7 @@
-[docs] +[docs] def parse_magnetic_entity(dh, atom=None, l=None, **kwargs): """Function to define orbital indexes of a given magnetic entity. @@ -215,7 +218,7 @@
-[docs] +[docs] def calculate_anisotropy_tensor(mag_ent): """Calculates the renormalized anisotropy tensor from the energies. @@ -248,7 +251,7 @@
-[docs] +[docs] def calculate_exchange_tensor(pair): """Calculates the exchange tensor from the energies. diff --git a/docs/source/_build/html/_modules/grogupy/utilities.html b/docs/source/_build/html/_modules/grogupy/utilities.html index 54e615b..50243b0 100644 --- a/docs/source/_build/html/_modules/grogupy/utilities.html +++ b/docs/source/_build/html/_modules/grogupy/utilities.html @@ -112,6 +112,9 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +"""Docstring in utilities. +""" + import numpy as np from scipy.special import roots_legendre from sisl.io.siesta import eigSileSiesta @@ -124,7 +127,7 @@
-[docs] +[docs] def commutator(a, b): """Shorthand for commutator. @@ -147,7 +150,7 @@ # define some useful functions
-[docs] +[docs] def hsk(H, ss, sc_off, k=(0, 0, 0)): """Speed up Hk and Sk generation. @@ -186,7 +189,7 @@
-[docs] +[docs] def make_kset(dirs="xyz", NUMK=20): """Simple k-grid generator to sample the Brillouin zone. @@ -227,7 +230,7 @@
-[docs] +[docs] def make_contour(emin=-20, emax=0.0, enum=42, p=150): """A more sophisticated contour generator. @@ -276,7 +279,7 @@
-[docs] +[docs] def tau_u(u): """Pauli matrix in direction u. @@ -300,7 +303,7 @@ #
-[docs] +[docs] def crossM(u): """Definition for the cross-product matrix. @@ -319,7 +322,7 @@
-[docs] +[docs] def RotM(theta, u, eps=1e-10): """Definition of rotation matrix with angle theta around direction u. @@ -352,7 +355,7 @@
-[docs] +[docs] def RotMa2b(a, b, eps=1e-10): """Definition of rotation matrix rotating unit vector a to unit vector b. @@ -382,7 +385,7 @@
-[docs] +[docs] def read_siesta_emin(eigfile): """It reads the lowest energy level from the siesta run. @@ -405,7 +408,7 @@
-[docs] +[docs] def int_de_ke(traced, we): """It numerically integrates the traced matrix. diff --git a/docs/source/_build/html/_sources/implementation/grogupy.core.rst.txt b/docs/source/_build/html/_sources/implementation/grogupy.core.rst.txt deleted file mode 100644 index 0634729..0000000 --- a/docs/source/_build/html/_sources/implementation/grogupy.core.rst.txt +++ /dev/null @@ -1,7 +0,0 @@ -grogupy.core module -=================== - -.. automodule:: grogupy.core - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/_build/html/_sources/implementation/grogupy.grogu.rst.txt b/docs/source/_build/html/_sources/implementation/grogupy.grogu.rst.txt deleted file mode 100644 index c51783a..0000000 --- a/docs/source/_build/html/_sources/implementation/grogupy.grogu.rst.txt +++ /dev/null @@ -1,7 +0,0 @@ -grogupy.grogu module -==================== - -.. automodule:: grogupy.grogu - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/_build/html/_sources/implementation/grogupy.io.rst.txt b/docs/source/_build/html/_sources/implementation/grogupy.io.rst.txt deleted file mode 100644 index b0f4f60..0000000 --- a/docs/source/_build/html/_sources/implementation/grogupy.io.rst.txt +++ /dev/null @@ -1,7 +0,0 @@ -grogupy.io module -================= - -.. automodule:: grogupy.io - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/_build/html/_sources/implementation/grogupy.magnetism.rst.txt b/docs/source/_build/html/_sources/implementation/grogupy.magnetism.rst.txt deleted file mode 100644 index a510e36..0000000 --- a/docs/source/_build/html/_sources/implementation/grogupy.magnetism.rst.txt +++ /dev/null @@ -1,7 +0,0 @@ -grogupy.magnetism module -======================== - -.. automodule:: grogupy.magnetism - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/_build/html/_sources/implementation/grogupy.rst.txt b/docs/source/_build/html/_sources/implementation/grogupy.rst.txt index 211bd28..18af50d 100644 --- a/docs/source/_build/html/_sources/implementation/grogupy.rst.txt +++ b/docs/source/_build/html/_sources/implementation/grogupy.rst.txt @@ -4,14 +4,45 @@ grogupy package Submodules ---------- -.. toctree:: - :maxdepth: 4 - - grogupy.core - grogupy.grogu - grogupy.io - grogupy.magnetism - grogupy.utilities +grogupy.core module +------------------- + +.. automodule:: grogupy.core + :members: + :undoc-members: + :show-inheritance: + +grogupy.grogu module +-------------------- + +.. automodule:: grogupy.grogu + :members: + :undoc-members: + :show-inheritance: + +grogupy.io module +----------------- + +.. automodule:: grogupy.io + :members: + :undoc-members: + :show-inheritance: + +grogupy.magnetism module +------------------------ + +.. automodule:: grogupy.magnetism + :members: + :undoc-members: + :show-inheritance: + +grogupy.utilities module +------------------------ + +.. automodule:: grogupy.utilities + :members: + :undoc-members: + :show-inheritance: Module contents --------------- diff --git a/docs/source/_build/html/_sources/implementation/grogupy.utilities.rst.txt b/docs/source/_build/html/_sources/implementation/grogupy.utilities.rst.txt deleted file mode 100644 index d4b00f7..0000000 --- a/docs/source/_build/html/_sources/implementation/grogupy.utilities.rst.txt +++ /dev/null @@ -1,7 +0,0 @@ -grogupy.utilities module -======================== - -.. automodule:: grogupy.utilities - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/_build/html/genindex.html b/docs/source/_build/html/genindex.html index 7e8d1b9..65abc8a 100644 --- a/docs/source/_build/html/genindex.html +++ b/docs/source/_build/html/genindex.html @@ -111,11 +111,11 @@

B

@@ -123,17 +123,17 @@

C

@@ -152,14 +152,14 @@ grogupy.core
  • grogupy.grogu
  • @@ -168,21 +168,21 @@ grogupy.io
  • grogupy.magnetism
  • grogupy.utilities
  • @@ -191,7 +191,7 @@

    H

    @@ -199,7 +199,7 @@

    I

    @@ -207,7 +207,7 @@

    L

    @@ -215,11 +215,11 @@

    M

    @@ -244,7 +244,7 @@

    O

    @@ -252,19 +252,23 @@

    P

    @@ -272,15 +276,17 @@

    R

    @@ -288,15 +294,15 @@

    S

    @@ -304,7 +310,7 @@

    T

    diff --git a/docs/source/_build/html/implementation/environment.html b/docs/source/_build/html/implementation/environment.html index 8be167f..43d6a63 100644 --- a/docs/source/_build/html/implementation/environment.html +++ b/docs/source/_build/html/implementation/environment.html @@ -22,7 +22,7 @@ - + @@ -103,7 +103,7 @@
    diff --git a/docs/source/_build/html/implementation/grogupy.core.html b/docs/source/_build/html/implementation/grogupy.core.html deleted file mode 100644 index eee07d1..0000000 --- a/docs/source/_build/html/implementation/grogupy.core.html +++ /dev/null @@ -1,322 +0,0 @@ - - - - - - - - - grogupy.core module — grogupy 1.0.0 documentation - - - - - - - - - - - - - - - - - - - -
    - - -
    - -
    -
    -
    - -
    -
    -
    -
    - -
    -

    grogupy.core module

    -
    -
    -grogupy.core.build_hh_ss(dh)[source]
    -

    It builds the Hamiltonian and Overlap matrix from the sisl.dh class.

    -

    It restructures the data in the SPIN BOX representation, where NS is -the number of supercells and NO is the number of orbitals.

    -
    -
    Args:
    -
    dhsisl.physics.Hamiltonian

    Hamiltonian read in by sisl

    -
    -
    -
    -
    Returns:
    -
    hh(NS, NO, NO) np.array_like

    Hamiltonian in SPIN BOX representation

    -
    -
    ss(NS, NO, NO) np.array_like

    Overlap matrix in SPIN BOX representation

    -
    -
    -
    -
    -
    - -
    -
    -grogupy.core.calc_Vu(H, Tu)[source]
    -

    Calculates the local perturbation in case of a spin rotation.

    -
    -
    Args:
    -
    H(NO, NO) np.array_like

    Hamiltonian

    -
    -
    Tu(NO, NO) array_like

    Rotation around u

    -
    -
    -
    -
    Returns:
    -
    Vu1(NO, NO) np.array_like

    First order perturbed matrix

    -
    -
    Vu2(NO, NO) np.array_like

    Second order perturbed matrix

    -
    -
    -
    -
    -
    - -
    -
    -grogupy.core.onsite_projection(matrix, idx1, idx2)[source]
    -

    It produces the slices of a matrix for the on site projection.

    -

    The slicing is along the last two axes as these contains the orbital indexing.

    -
    -
    Args:
    -
    matrix(…, :, :) np.array_like

    Some matrix

    -
    -
    idxnp.array_like

    The indexes of the orbitals

    -
    -
    -
    -
    Returns:
    -
    np.array_like

    Reduced matrix based on the projection

    -
    -
    -
    -
    -
    - -
    -
    -grogupy.core.parallel_Gk(HK, SK, eran, eset)[source]
    -

    Calculates the Greens function by inversion.

    -

    It calculates the Greens function on all the energy levels at the same time.

    -
    -
    Args:
    -
    HK(NO, NO), np.array_like

    Hamiltonian at a given k point

    -
    -
    SK(NO, NO), np.array_like

    Overlap Matrix at a given k point

    -
    -
    eran(eset) np.array_like

    Energy sample along the contour

    -
    -
    esetint

    Number of energy samples along the contour

    -
    -
    -
    -
    Returns:
    -
    Gk(eset, NO, NO), np.array_like

    Green’s function at a given k point

    -
    -
    -
    -
    -
    - -
    -
    -grogupy.core.remove_clutter_for_save(pairs, magnetic_entities)[source]
    -

    Removes unimportant data from the dictionaries.

    -

    It is used before saving to throw away data that -is not needed for post processing.

    -
    -
    Args:
    -
    pairsdict

    Contains all the pair information

    -
    -
    magnetic_entitiesdict

    Contains all the magnetic entity information

    -
    -
    -
    -
    Returns:
    -
    pairsdict

    Contains all the reduced pair information

    -
    -
    magnetic_entitiesdict

    Contains all the reduced magnetic entity information

    -
    -
    -
    -
    -
    - -
    -
    -grogupy.core.sequential_GK(HK, SK, eran, eset)[source]
    -

    Calculates the Greens function by inversion.

    -

    It calculates sequentially over the energy levels.

    -
    -
    Args:
    -
    HK(NO, NO), np.array_like

    Hamiltonian at a given k point

    -
    -
    SK(NO, NO), np.array_like

    Overlap Matrix at a given k point

    -
    -
    eran(eset) np.array_like

    Energy sample along the contour

    -
    -
    esetint

    Number of energy samples along the contour

    -
    -
    -
    -
    Returns:
    -
    Gk(eset, NO, NO), np.array_like

    Green’s function at a given k point

    -
    -
    -
    -
    -
    - -
    -
    -grogupy.core.setup_pairs_and_magnetic_entities(magnetic_entities, pairs, dh, simulation_parameters)[source]
    -

    It creates the complete structure of the dictionaries and fills some basic data.

    -

    It creates orbital indexes, spin box indexes, coordinates and tags for magnetic entities. -Furthermore it creates the structures for the energies, the perturbed potentials and -the Greens function calculation. It dose the same for the pairs.

    -
    -
    Args:
    -
    pairsdict

    Contains the initial pair information

    -
    -
    magnetic_entitiesdict

    Contains the initial magnetic entity information

    -
    -
    dhsisl.physics.Hamiltonian

    Hamiltonian read in by sisl

    -
    -
    simulation_parametersdict

    A set of parameters from the simulation

    -
    -
    -
    -
    Returns:
    -
    pairsdict

    Contains the initial information and the complete structure

    -
    -
    magnetic_entitiesdict

    Contains the initial information and the complete structure

    -
    -
    -
    -
    -
    - -
    - - -
    -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/docs/source/_build/html/implementation/grogupy.grogu.html b/docs/source/_build/html/implementation/grogupy.grogu.html deleted file mode 100644 index 4b837a4..0000000 --- a/docs/source/_build/html/implementation/grogupy.grogu.html +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - - grogupy.grogu module — grogupy 1.0.0 documentation - - - - - - - - - - - - - - - - - - - -
    - - -
    - -
    -
    -
    - -
    -
    -
    -
    - -
    -

    grogupy.grogu module

    -
    -
    -grogupy.grogu.main()[source]
    -
    - -
    - - -
    -
    - -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/docs/source/_build/html/implementation/grogupy.html b/docs/source/_build/html/implementation/grogupy.html index 0e3f671..ea0f6f4 100644 --- a/docs/source/_build/html/implementation/grogupy.html +++ b/docs/source/_build/html/implementation/grogupy.html @@ -21,7 +21,7 @@ - + @@ -58,12 +58,52 @@
    • src
    • grogupy package
        -
      • Submodules
          -
        • grogupy.core module
        • -
        • grogupy.grogu module
        • -
        • grogupy.io module
        • -
        • grogupy.magnetism module
        • -
        • grogupy.utilities module
        • +
        • Submodules
        • +
        • grogupy.core module +
        • +
        • grogupy.grogu module +
        • +
        • grogupy.io module +
        • +
        • grogupy.magnetism module +
        • +
        • grogupy.utilities module
        • Module contents
        • @@ -110,57 +150,679 @@

          grogupy package

          Submodules

          - +
          +
          +

          grogupy.core module

          +

          Docstring in core.

          +
          +
          +grogupy.core.build_hh_ss(dh)[source]
          +

          It builds the Hamiltonian and Overlap matrix from the sisl.dh class.

          +

          It restructures the data in the SPIN BOX representation, where NS is +the number of supercells and NO is the number of orbitals.

          +
          +
          Args:
          +
          dhsisl.physics.Hamiltonian

          Hamiltonian read in by sisl

          +
          +
          +
          +
          Returns:
          +
          hh(NS, NO, NO) np.array_like

          Hamiltonian in SPIN BOX representation

          +
          +
          ss(NS, NO, NO) np.array_like

          Overlap matrix in SPIN BOX representation

          +
          +
          +
          +
          +
          + +
          +
          +grogupy.core.calc_Vu(H, Tu)[source]
          +

          Calculates the local perturbation in case of a spin rotation.

          +
          +
          Args:
          +
          H(NO, NO) np.array_like

          Hamiltonian

          +
          +
          Tu(NO, NO) array_like

          Rotation around u

          +
          +
          +
          +
          Returns:
          +
          Vu1(NO, NO) np.array_like

          First order perturbed matrix

          +
          +
          Vu2(NO, NO) np.array_like

          Second order perturbed matrix

          +
          +
          +
          +
          +
          + +
          +
          +grogupy.core.onsite_projection(matrix, idx1, idx2)[source]
          +

          It produces the slices of a matrix for the on site projection.

          +

          The slicing is along the last two axes as these contains the orbital indexing.

          +
          +
          Args:
          +
          matrix(…, :, :) np.array_like

          Some matrix

          +
          +
          idxnp.array_like

          The indexes of the orbitals

          +
          +
          +
          +
          Returns:
          +
          np.array_like

          Reduced matrix based on the projection

          +
          +
          +
          +
          +
          + +
          +
          +grogupy.core.parallel_Gk(HK, SK, eran, eset)[source]
          +

          Calculates the Greens function by inversion.

          +

          It calculates the Greens function on all the energy levels at the same time.

          +
          +
          Args:
          +
          HK(NO, NO), np.array_like

          Hamiltonian at a given k point

          +
          +
          SK(NO, NO), np.array_like

          Overlap Matrix at a given k point

          +
          +
          eran(eset) np.array_like

          Energy sample along the contour

          +
          +
          esetint

          Number of energy samples along the contour

          +
          +
          +
          +
          Returns:
          +
          Gk(eset, NO, NO), np.array_like

          Green’s function at a given k point

          +
          +
          +
          +
          +
          + +
          +
          +grogupy.core.remove_clutter_for_save(pairs, magnetic_entities)[source]
          +

          Removes unimportant data from the dictionaries.

          +

          It is used before saving to throw away data that +is not needed for post processing.

          +
          +
          Args:
          +
          pairsdict

          Contains all the pair information

          +
          +
          magnetic_entitiesdict

          Contains all the magnetic entity information

          +
          +
          +
          +
          Returns:
          +
          pairsdict

          Contains all the reduced pair information

          +
          +
          magnetic_entitiesdict

          Contains all the reduced magnetic entity information

          +
          +
          +
          +
          +
          + +
          +
          +grogupy.core.sequential_GK(HK, SK, eran, eset)[source]
          +

          Calculates the Greens function by inversion.

          +

          It calculates sequentially over the energy levels.

          +
          +
          Args:
          +
          HK(NO, NO), np.array_like

          Hamiltonian at a given k point

          +
          +
          SK(NO, NO), np.array_like

          Overlap Matrix at a given k point

          +
          +
          eran(eset) np.array_like

          Energy sample along the contour

          +
          +
          esetint

          Number of energy samples along the contour

          +
          +
          +
          +
          Returns:
          +
          Gk(eset, NO, NO), np.array_like

          Green’s function at a given k point

          +
          +
          +
          +
          +
          + +
          +
          +grogupy.core.setup_pairs_and_magnetic_entities(magnetic_entities, pairs, dh, simulation_parameters)[source]
          +

          It creates the complete structure of the dictionaries and fills some basic data.

          +

          It creates orbital indexes, spin box indexes, coordinates and tags for magnetic entities. +Furthermore it creates the structures for the energies, the perturbed potentials and +the Greens function calculation. It dose the same for the pairs.

          +
          +
          Args:
          +
          pairsdict

          Contains the initial pair information

          +
          +
          magnetic_entitiesdict

          Contains the initial magnetic entity information

          +
          +
          dhsisl.physics.Hamiltonian

          Hamiltonian read in by sisl

          +
          +
          simulation_parametersdict

          A set of parameters from the simulation

          +
          +
          +
          +
          Returns:
          +
          pairsdict

          Contains the initial information and the complete structure

          +
          +
          magnetic_entitiesdict

          Contains the initial information and the complete structure

          +
          +
          +
          +
          +
          + +
          +
          +

          grogupy.grogu module

          +

          Docstring in grogupy.

          +
          +
          +grogupy.grogu.main(simulation_parameters, magnetic_entities, pairs)[source]
          +
          + +
          +
          +grogupy.grogu.parse_command_line()[source]
          +

          This function can read input from the command line.

          +
          + +
          +
          +

          grogupy.io module

          +

          Docstring in io.

          +
          +
          +grogupy.io.load_pickle(infile)[source]
          +

          Loads the data from the infile with pickle.

          +
          +
          Args:
          +
          infilestr

          Path to infile

          +
          +
          +
          +
          Returns:
          +
          datadict

          A dictionary of data

          +
          +
          +
          +
          +
          + +
          +
          +grogupy.io.print_atoms_and_pairs(magnetic_entities, pairs)[source]
          +

          It prints the pair and magnetic entity information for the grogu out.

          +
          +
          Args:
          +
          magnetic_entitiesdict

          It contains the data on the magnetic entities

          +
          +
          pairsdict

          It contains the data on the pairs

          +
          +
          +
          +
          +
          + +
          +
          +grogupy.io.print_job_description(simulation_parameters)[source]
          +

          It prints the parameters and the description of the job.

          +
          +
          Args:
          +
          simulation_parametersdict

          It contains the simulations parameters

          +
          +
          +
          +
          +
          + +
          +
          +grogupy.io.print_parameters(simulation_parameters)[source]
          +

          It prints the simulation parameters for the grogu out.

          +
          +
          Args:
          +
          simulation_parametersdict

          It contains the simulations parameters

          +
          +
          +
          +
          +
          + +
          +
          +grogupy.io.print_runtime_information(times)[source]
          +

          It prints the runtime information for the grogu out.

          +
          +
          Args:
          +
          timesdict

          It contains the runtime data

          +
          +
          +
          +
          +
          + +
          +
          +grogupy.io.process_input_args(default_arguments, fdf_arguments, command_line_arguments, accepted_inputs=['infile', 'outfile', 'scf_xcf_orientation', 'ref_xcf_orientations', 'kset', 'kdirs', 'ebot', 'eset', 'esetp', 'parallel_solver_for_Gk', 'padawan_mode'])[source]
          +

          It returns the final simulation parameters based on the inputs.

          +

          The merging is done in the order of priority: +1. command line arguments +2. fdf arguments +3. default arguments

          +
          +
          Args:
          +
          default_argumentsdict

          Default arguments from grogupy

          +
          +
          fdf_argumentsdict

          Arguments read from the fdf input file

          +
          +
          command_line_argumentsdict

          Arguments from the command line

          +
          +
          +
          +
          Returns:
          +
          dict

          The final simulation parameters

          +
          +
          +
          +
          +
          + +
          +
          +grogupy.io.read_fdf(path)[source]
          +

          It reads the simulation parameters, magnetic entities and pairs from the fdf.

          +
          +
          Args:
          +
          pathstring

          The path to the .fdf file

          +
          +
          +
          +
          Returns:
          +
          fdf_argumentsdict

          The read input arguments from the fdf file

          +
          +
          magnetic_entitieslist

          It contains the dictionaries associated with the magnetic entities

          +
          +
          pairsdict

          It contains the dictionaries associated with the pair information

          +
          +
          +
          +
          +
          + +
          +
          +grogupy.io.save_pickle(outfile, data)[source]
          +

          Saves the data in the outfile with pickle.

          +
          +
          Args:
          +
          outfilestr

          Path to outfile

          +
          +
          datadict

          Contains the data

          +
          +
          +
          +
          +
          + +
          +
          +

          grogupy.magnetism module

          +

          Docstring in magnetism.

          +
          +
          +grogupy.magnetism.blow_up_orbindx(orb_indices)[source]
          +

          Function to blow up orbital indices to make SPIN BOX indices.

          +
          +
          Args:
          +
          orb_indicesnp.array_like

          These are the indices in ORBITAL BOX

          +
          +
          +
          +
          Returns:
          +
          orb_indicesnp.array_like

          These are the indices in SPIN BOX

          +
          +
          +
          +
          +
          + +
          +
          +grogupy.magnetism.calculate_anisotropy_tensor(mag_ent)[source]
          +

          Calculates the renormalized anisotropy tensor from the energies.

          +

          It uses the grogu convention for output.

          +
          +
          Args:
          +
          mag_entdict

          An element from the magnetic entities

          +
          +
          +
          +
          Returns:
          +
          Knp.array_like

          elements of the anisotropy tensor

          +
          +
          +
          +
          +
          + +
          +
          +grogupy.magnetism.calculate_exchange_tensor(pair)[source]
          +

          Calculates the exchange tensor from the energies.

          +

          It produces the isotropic exchange, the relevant elements +from the Dzyaloshinskii-Morilla (Dm) tensor, the symmetric-anisotropy +and the complete exchange tensor.

          +
          +
          Args:
          +
          pairdict

          An element from the pairs

          +
          +
          +
          +
          Returns:
          +
          J_isofloat

          Isotropic exchange (Tr[J] / 3)

          +
          +
          J_Snp.array_like

          Symmetric-anisotropy (J_S = J - J_iso * I ––> Jxx, Jyy, Jxy, Jxz, Jyz)

          +
          +
          Dnp.array_like

          DM elements (Dx, Dy, Dz)

          +
          +
          Jnp.array_like

          Complete exchange tensor flattened (Jxx, Jxy, Jxz, Jyx, Jyy, Jyz, Jzx, Jzy, Jzz)

          +
          +
          +
          +
          +
          + +
          +
          +grogupy.magnetism.parse_magnetic_entity(dh, atom=None, l=None, **kwargs)[source]
          +

          Function to define orbital indexes of a given magnetic entity.

          +
          +
          Args:
          +
          dhsisl.physics.Hamiltonian

          Hamiltonian from sisl

          +
          +
          atominteger or list of integers, optional

          Defining atom (or atoms) in the unit cell forming the magnetic entity. Defaults to None

          +
          +
          linteger, optional

          Defining the angular momentum channel. Defaults to None

          +
          +
          +
          +
          Returns:
          +
          list

          The orbital indexes of the given magnetic entity

          +
          +
          +
          +
          +
          + +
          +
          +grogupy.magnetism.spin_tracer(M)[source]
          +

          Spin tracer utility.

          +

          This takes an operator with the orbital-spin sequence: +orbital 1 up, +orbital 1 down, +orbital 2 up, +orbital 2 down, +that is in the SPIN-BOX representation, +and extracts orbital dependent Pauli traces.

          +
          +
          Args:
          +
          Mnp.array_like

          Traceable matrix

          +
          +
          +
          +
          Returns:
          +
          dict

          It contains the traced matrix with “x”, “y”, “z” and “c”

          +
          +
          +
          +
          +
          + +
          +
          +

          grogupy.utilities module

          +

          Docstring in utilities.

          +
          +
          +grogupy.utilities.RotM(theta, u, eps=1e-10)[source]
          +

          Definition of rotation matrix with angle theta around direction u.

          +
          +
          Args:
          +
          thetafloat

          The angle of rotation

          +
          +
          unp.array_like

          The rotation axis

          +
          +
          epsfloat, optional

          Cutoff for small elements in the resulting matrix. Defaults to 1e-10

          +
          +
          +
          +
          Returns:
          +
          np.array_like

          The rotation matrix

          +
          +
          +
          +
          +
          + +
          +
          +grogupy.utilities.RotMa2b(a, b, eps=1e-10)[source]
          +

          Definition of rotation matrix rotating unit vector a to unit vector b.

          +

          Function returns array R such that R @ a = b holds.

          +
          +
          Args:
          +
          anp.array_like

          First vector

          +
          +
          bnp.array_like

          Second vector

          +
          +
          epsfloat, optional

          Cutoff for small elements in the resulting matrix. Defaults to 1e-10

          +
          +
          +
          +
          Returns:
          +
          np.array_like

          The rotation matrix with the above property

          +
          +
          +
          +
          +
          + +
          +
          +grogupy.utilities.commutator(a, b)[source]
          +

          Shorthand for commutator.

          +

          Commutator of two matrices in the mathematical sense.

          +
          +
          Args:
          +
          anp.array_like

          The first matrix

          +
          +
          bnp.array_like

          The second matrix

          +
          +
          +
          +
          Returns:
          +
          np.array_like

          The commutator of a and b

          +
          +
          +
          +
          +
          + +
          +
          +grogupy.utilities.crossM(u)[source]
          +

          Definition for the cross-product matrix.

          +

          It acts as a cross product with vector u.

          +
          +
          Args:
          +
          ulist or np.array_like

          The second vector in the cross product

          +
          +
          +
          +
          Returns:
          +
          np.array_like

          The matrix that represents teh cross product with a vector

          +
          +
          +
          +
          +
          + +
          +
          +grogupy.utilities.hsk(H, ss, sc_off, k=(0, 0, 0))[source]
          +

          Speed up Hk and Sk generation.

          +

          Calculates the Hamiltonian and the Overlap matrix at a given k point. It is faster that the sisl version.

          +
          +
          Args:
          +
          Hnp.array_like

          Hamiltonian in spin box form

          +
          +
          ssnp.array_like

          Overlap matrix in spin box form

          +
          +
          sc_offlist

          supercell indexes of the Hamiltonian

          +
          +
          ktuple, optional

          The k point where the matrices are set up. Defaults to (0, 0, 0)

          +
          +
          +
          +
          Returns:
          +
          np.array_like

          Hamiltonian at the given k point

          +
          +
          np.array_like

          Overlap matrix at the given k point

          +
          +
          +
          +
          +
          + +
          +
          +grogupy.utilities.int_de_ke(traced, we)[source]
          +

          It numerically integrates the traced matrix.

          +

          It is a wrapper from numpy.trapz and it contains the +relevant constants to calculate the energy integral from +equation 93 or 96.

          +
          +
          Args:
          +
          tracednp.array_like

          The trace of a matrix or a matrix product

          +
          +
          wefloat

          The weight of a point on the contour

          +
          +
          +
          +
          Returns:
          +
          float

          The energy calculated from the integral formula

          +
          +
          +
          +
          +
          + +
          +
          +grogupy.utilities.make_contour(emin=-20, emax=0.0, enum=42, p=150)[source]
          +

          A more sophisticated contour generator.

          +

          Calculates the parameters for the complex contour integral. It uses the +Legendre-Gauss quadrature method. It returns a class that contains +the information for the contour integral.

          +
          +
          Args:
          +
          eminint, optional

          Energy minimum of the contour. Defaults to -20

          +
          +
          emaxfloat, optional

          Energy maximum of the contour. Defaults to 0.0, so the Fermi level

          +
          +
          enumint, optional

          Number of sample points along the contour. Defaults to 42

          +
          +
          pint, optional

          Shape parameter that describes the distribution of the sample points. Defaults to 150

          +
          +
          +
          +
          Returns:
          +
          ccont

          Contains all the information for the contour integral

          +
          +
          +
          +
          +
          + +
          +
          +grogupy.utilities.make_kset(dirs='xyz', NUMK=20)[source]
          +

          Simple k-grid generator to sample the Brillouin zone.

          +

          Depending on the value of the dirs +argument k sampling in 1,2 or 3 dimensions is generated. +If dirs argument does not contain either of x, y or z +a kset of a single k-pont at the origin is returned. The total number of k points is the NUMK**(dimensions)

          +
          +
          Args:
          +
          dirsstr, optional

          Directions of the k points in the Brillouin zone. They are the three lattice vectors. Defaults to “xyz”

          +
          +
          NUMKint, optional

          The number of k points in a direction. Defaults to 20

          +
          +
          +
          +
          Returns:
          +
          np.array_like

          An array of k points that uniformly sample the Brillouin zone in the given directions

          +
          +
          +
          +
          +
          + +
          +
          +grogupy.utilities.read_siesta_emin(eigfile)[source]
          +

          It reads the lowest energy level from the siesta run.

          +

          It uses the .EIG file from siesta that contains the eigenvalues.

          +
          +
          Args:
          +
          eigfilestr

          The path to the .EIG file

          +
          +
          +
          +
          Returns:
          +
          float

          The energy minimum

          +
          +
          +
          +
          +
          + +
          +
          +grogupy.utilities.tau_u(u)[source]
          +

          Pauli matrix in direction u.

          +

          Returns the vector u in the basis of the Pauli matrices.

          +
          +
          Args:
          +
          ulist or np.array_like

          The direction

          +
          +
          +
          +
          Returns:
          +
          np.array_like

          Arbitrary direction in the base of the Pauli matrices

          +
          +
          +
          +
          +
          +

          Module contents

          +

          Docstring in init.

          @@ -169,7 +831,7 @@