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.
+"""
+
importnumpyasnpfromnumpy.linalgimportinv
@@ -119,67 +122,30 @@
fromgrogupy.utilitiesimportcommutator
-
-[docs]
-defparallel_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
- returninv(SK*eran.reshape(eset,1,1)-HK)
-
-
-
-
-[docs]
-defsequential_GK(HK,SK,eran,eset):
-"""Calculates the Greens function by inversion.
+
+[docs]
+defonsite_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
- forjinrange(eset):
- Gk[j]=inv(SK*eran[j]-HK)
-
- returnGk
+ returnmatrix[...,idx1,:][...,idx2]
-[docs]
+[docs]defcalc_Vu(H,Tu):"""Calculates the local perturbation in case of a spin rotation.
@@ -203,45 +169,8 @@
-
-[docs]
-defremove_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
- forpairinpairs:
- delpair["Gij"]
- delpair["Gij_tmp"]
- delpair["Gji"]
- delpair["Gji_tmp"]
- formag_entinmagnetic_entities:
- delmag_ent["Gii"]
- delmag_ent["Gii_tmp"]
- delmag_ent["Vu1"]
- delmag_ent["Vu2"]
-
- returnpairs,magnetic_entities
-
-
-
-[docs]
+[docs]defbuild_hh_ss(dh):"""It builds the Hamiltonian and Overlap matrix from the sisl.dh class.
@@ -300,7 +229,7 @@
[U.T
-[docs]
-defonsite_projection(matrix,idx1,idx2):
-"""It produces the slices of a matrix for the on site projection.
+
+[docs]
+defparallel_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 """
- returnmatrix[...,idx1,:][...,idx2]
+ # Calculates the Greens function on all the energy levels
+ returninv(SK*eran.reshape(eset,1,1)-HK)
+
+
+
+
+[docs]
+defsequential_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
+ forjinrange(eset):
+ Gk[j]=inv(SK*eran[j]-HK)
+
+ returnGk
+
+
+
+
+[docs]
+defremove_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
+ forpairinpairs:
+ delpair["Gij"]
+ delpair["Gij_tmp"]
+ delpair["Gji"]
+ delpair["Gji_tmp"]
+ formag_entinmagnetic_entities:
+ delmag_ent["Gii"]
+ delmag_ent["Gii_tmp"]
+ delmag_ent["Vu1"]
+ delmag_ent["Vu2"]
+
+ returnpairs,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.
+"""
+
importwarnings
+fromargparseimportArgumentParserfromsysimportgetsizeoffromtimeitimportdefault_timerastimer
@@ -140,48 +144,97 @@
fromgrogupyimport*
-
+[docs]
+defparse_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()
+
+ returncmd_line_args
+
+
+
+
+[docs]
+defmain(simulation_parameters,magnetic_entities,pairs):
+ # runtime information
+ times=dict()
+ times["start_time"]=timer()# MPI parameterscomm=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.
-fromargparseimportArgumentParser
+"""Docstring in io.
+"""
+
frompickleimportdump,loadimportnumpyasnp
-
-default_args=dict(
+fromsisl.ioimportfdfSileSiesta
+
+# 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]
+defread_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")
+ ifInputFileisnotNone:
+ fdf_arguments["infile"]=InputFile
+
+ OutputFile=fdf.get("OutputFile")
+ ifOutputFileisnotNone:
+ fdf_arguments["outfile"]=OutputFile
+
+ ScfXcfOrientation=fdf.get("ScfXcfOrientation")
+ ifScfXcfOrientationisnotNone:
+ fdf_arguments["scf_xcf_orientation"]=np.array(ScfXcfOrientation)
+
+ XCF_Rotation=fdf.get("XCF_Rotation")
+ ifXCF_RotationisnotNone:
+ rotations=[]
+ # iterate over rows
+ forrotinXCF_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")
+ ifKsetisnotNone:
+ fdf_arguments["kset"]=Kset
+
+ Kdirs=fdf.get("INTEGRAL.Kdirs")
+ ifKdirsisnotNone:
+ 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")
+ ifEsetisnotNone:
+ fdf_arguments["eset"]=Eset
+
+ Esetp=fdf.get("INTEGRAL.Esetp")
+ ifEsetpisnotNone:
+ fdf_arguments["esetp"]=Esetp
+
+ ParallelSolver=fdf.get("GREEN.ParallelSolver")
+ ifParallelSolverisnotNone:
+ fdf_arguments["parallel_solver_for_Gk"]=ParallelSolver
+
+ PadawanMode=fdf.get("PadawanMode")
+ ifPadawanModeisnotNone:
+ fdf_arguments["padawan_mode"]=PadawanMode
+
+ Pairs=fdf.get("Pairs")
+ ifPairsisnotNone:
+ pairs=[]
+ # iterate over rows
+ forfdf_pairinPairs:
+ # 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")
+ ifMagneticEntitiesisnotNone:
+ magnetic_entities=[]
+ formag_entinMagneticEntities:
+ row=mag_ent.split()
+ dat=[]
+ forstringinrow:
+ ifstring.find("#")!=-1:
+ break
+ dat.append(string)
+ ifdat[0]in{"Cluster","cluster"}:
+ magnetic_entities.append(dict(atom=[int(_)for_indat[1:]]))
+ continue
+ elifdat[0]in{"AtomShell","Atomshell","atomShell","atomshell"}:
+ magnetic_entities.append(
+ dict(atom=int(dat[1]),l=[int(_)for_indat[2:]])
+ )
+ continue
+ elifdat[0]in{"AtomOrbital","Atomorbital","tomOrbital","atomorbital"}:
+ magnetic_entities.append(
+ dict(atom=int(dat[1]),orb=[int(_)for_indat[2:]])
+ )
+ continue
+ elifdat[0]in{"Orbitals","orbitals"}:
+ magnetic_entities.append(dict(orb=[int(_)for_indat[1:]]))
+ continue
+ else:
+ raiseException("Unrecognizable magnetic entity in .fdf!")
+
+ returnfdf_arguments,magnetic_entities,pairs
+
+
+
+
+[docs]
+defprocess_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
+ forkey,valueinfdf_arguments.values():
+ ifvalueisnotNoneandkeyinaccepted_inputs:
+ default_arguments[key]=value
+
+ # iterate over command_line_arguments and update default arguments
+ forkey,valueincommand_line_arguments.values():
+ ifvalueisnotNoneandkeyinaccepted_inputs:
+ default_arguments[key]=value
+
+ returndefault_arguments
-# cmd_line_args = parser.parse_args()
-[docs]
+[docs]defsave_pickle(outfile,data):"""Saves the data in the outfile with pickle.
@@ -168,7 +332,7 @@
-[docs]
+[docs]defload_pickle(infile):"""Loads the data from the infile with pickle.
@@ -189,8 +353,69 @@
+
+[docs]
+defprint_job_description(simulation_parameters):
+"""It prints the parameters and the description of the job.
+
+
+ Args:
+ simulation_parameters : dict
+ It contains the simulations parameters
+ """
+
+ print(
+ "================================================================================================================================================================"
+ )
+ print("Input file: ")
+ print(simulation_parameters["infile"])
+ print("Output file: ")
+ print(simulation_parameters["outfile"])
+ print(
+ "Number of nodes in the parallel cluster: ",
+ simulation_parameters["parallel_size"],
+ )
+ ifsimulation_parameters["parallel_solver_for_Gk"]:
+ print("solver used for Greens function calculation: parallel")
+ else:
+ print("solver used for Greens function calculation: sequential")
+ print(
+ "================================================================================================================================================================"
+ )
+ print("Cell [Ang]: ")
+ print(simulation_parameters["cell"])
+ print(
+ "================================================================================================================================================================"
+ )
+ print("DFT axis: ")
+ print(simulation_parameters["scf_xcf_orientation"])
+ print("Quantization axis and perpendicular rotation directions:")
+ forrefinsimulation_parameters["ref_xcf_orientations"]:
+ print(ref["o"]," --» ",ref["vw"])
+ print(
+ "================================================================================================================================================================"
+ )
+ print("Parameters for the contour integral:")
+ print("Number of k points: ",simulation_parameters["kset"])
+ print("k point directions: ",simulation_parameters["kdirs"])
+ ifsimulation_parameters["automatic_ebot"]:
+ print(
+ "Ebot: ",
+ simulation_parameters["ebot"],
+ " WARNING: This was automatically determined!",
+ )
+ else:
+ print("Ebot: ",simulation_parameters["ebot"])
+ print("Eset: ",simulation_parameters["eset"])
+ print("Esetp: ",simulation_parameters["esetp"])
+ print(
+ "================================================================================================================================================================"
+ )
+
+
+
-[docs]
+[docs]defprint_parameters(simulation_parameters):"""It prints the simulation parameters for the grogu out.
@@ -239,7 +464,7 @@
-[docs]
+[docs]defprint_atoms_and_pairs(magnetic_entities,pairs):"""It prints the pair and magnetic entity information for the grogu out.
@@ -330,7 +555,7 @@
-[docs]
+[docs]defprint_runtime_information(times):"""It prints the runtime information for the grogu out.
@@ -364,67 +589,6 @@
f"Calculate energies and magnetic components: {times['end_time']-times['green_function_inversion_time']:.3f} s")
-
-
-
-[docs]
-defprint_job_description(simulation_parameters):
-"""It prints the parameters and the description of the job.
-
-
- Args:
- simulation_parameters : dict
- It contains the simulations parameters
- """
-
- print(
- "================================================================================================================================================================"
- )
- print("Input file: ")
- print(simulation_parameters["infile"])
- print("Output file: ")
- print(simulation_parameters["outfile"])
- print(
- "Number of nodes in the parallel cluster: ",
- simulation_parameters["parallel_size"],
- )
- ifsimulation_parameters["parallel_solver_for_Gk"]:
- print("solver used for Greens function calculation: parallel")
- else:
- print("solver used for Greens function calculation: sequential")
- print(
- "================================================================================================================================================================"
- )
- print("Cell [Ang]: ")
- print(simulation_parameters["cell"])
- print(
- "================================================================================================================================================================"
- )
- print("DFT axis: ")
- print(simulation_parameters["scf_xcf_orientation"])
- print("Quantization axis and perpendicular rotation directions:")
- forrefinsimulation_parameters["ref_xcf_orientations"]:
- print(ref["o"]," --» ",ref["vw"])
- print(
- "================================================================================================================================================================"
- )
- print("Parameters for the contour integral:")
- print("Number of k points: ",simulation_parameters["kset"])
- print("k point directions: ",simulation_parameters["kdirs"])
- ifsimulation_parameters["automatic_ebot"]:
- print(
- "Ebot: ",
- simulation_parameters["ebot"],
- " WARNING: This was automatically determined!",
- )
- else:
- print("Ebot: ",simulation_parameters["ebot"])
- print("Eset: ",simulation_parameters["eset"])
- print("Esetp: ",simulation_parameters["esetp"])
- print(
- "================================================================================================================================================================"
- )
-
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.
+"""
+
importnumpyasnp
-[docs]
+[docs]defblow_up_orbindx(orb_indices):"""Function to blow up orbital indices to make SPIN BOX indices.
@@ -136,7 +139,7 @@
-[docs]
+[docs]defparse_magnetic_entity(dh,atom=None,l=None,**kwargs):"""Function to define orbital indexes of a given magnetic entity.
@@ -215,7 +218,7 @@
-[docs]
+[docs]defcalculate_anisotropy_tensor(mag_ent):"""Calculates the renormalized anisotropy tensor from the energies.
@@ -248,7 +251,7 @@
-[docs]
+[docs]defcalculate_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.
+"""
+
importnumpyasnpfromscipy.specialimportroots_legendrefromsisl.io.siestaimporteigSileSiesta
@@ -124,7 +127,7 @@
-[docs]
+[docs]defcommutator(a,b):"""Shorthand for commutator.
@@ -147,7 +150,7 @@
# define some useful functions
-[docs]
+[docs]defhsk(H,ss,sc_off,k=(0,0,0)):"""Speed up Hk and Sk generation.
@@ -186,7 +189,7 @@
-[docs]
+[docs]defmake_kset(dirs="xyz",NUMK=20):"""Simple k-grid generator to sample the Brillouin zone.
@@ -227,7 +230,7 @@
-[docs]
+[docs]defmake_contour(emin=-20,emax=0.0,enum=42,p=150):"""A more sophisticated contour generator.
@@ -276,7 +279,7 @@
-[docs]
+[docs]deftau_u(u):"""Pauli matrix in direction u.
@@ -300,7 +303,7 @@
#
-[docs]
+[docs]defcrossM(u):"""Definition for the cross-product matrix.
@@ -319,7 +322,7 @@
-[docs]
+[docs]defRotM(theta,u,eps=1e-10):"""Definition of rotation matrix with angle theta around direction u.
@@ -352,7 +355,7 @@
-[docs]
+[docs]defRotMa2b(a,b,eps=1e-10):"""Definition of rotation matrix rotating unit vector a to unit vector b.
@@ -382,7 +385,7 @@
-[docs]
+[docs]defread_siesta_emin(eigfile):"""It reads the lowest energy level from the siesta run.
@@ -405,7 +408,7 @@