diff --git a/tests/io/orca/inpgen/test_multxyz.py b/tests/io/orca/inpgen/test_multxyz.py index f67bd57..cee8c68 100644 --- a/tests/io/orca/inpgen/test_multxyz.py +++ b/tests/io/orca/inpgen/test_multxyz.py @@ -49,5 +49,11 @@ def test_multxyz_num(mult_xyz): def test_multxyz_struct(exp_inpgen): + """ + Generate struct struct struct struct struct. + + Args: + exp_inpgen: (todo): write your description + """ waex.cookies.gen_base(f"{exp_inpgen}") pass diff --git a/tests/io/orca/inpgen/test_orcainpgen.py b/tests/io/orca/inpgen/test_orcainpgen.py index 555dd82..46925f4 100644 --- a/tests/io/orca/inpgen/test_orcainpgen.py +++ b/tests/io/orca/inpgen/test_orcainpgen.py @@ -34,6 +34,12 @@ def prep_inpgen(tmpdir_factory): def test_keywords(datadir): + """ + Parse a yaml file. + + Args: + datadir: (str): write your description + """ ymlt = waio.inp.inpGenerator(datadir / "orcaBlockKey.yml") string = f""" ! NUMGRAD @@ -48,6 +54,12 @@ def test_keywords(datadir): def test_blocks(datadir): + """ + Parse the yaml text + + Args: + datadir: (str): write your description + """ ymlt = waio.inp.inpGenerator(datadir / "orcaBlockKey.yml") string = """ %method @@ -70,6 +82,12 @@ def test_blocks(datadir): def test_geom_constraint(prep_inpgen): + """ + Test if geomagnetic geomagnetic geom + + Args: + prep_inpgen: (bool): write your description + """ string = f""" %geom Scan @@ -101,6 +119,12 @@ def test_geom_constraint(prep_inpgen): def test_geom_scaniter(prep_inpgen): + """ + Parse geomagnetic geomagnetic file. geom + + Args: + prep_inpgen: (todo): write your description + """ string = f""" %geom Scan @@ -129,6 +153,12 @@ def test_geom_scaniter(prep_inpgen): def test_geom_maxiter(prep_inpgen): + """ + Parse a geom file and - like object. + + Args: + prep_inpgen: (todo): write your description + """ string = f""" %geom maxiter = 300 @@ -147,20 +177,44 @@ def test_geom_maxiter(prep_inpgen): def test_brokensym(prep_inpgen): + """ + Generate all brokens. + + Args: + prep_inpgen: (todo): write your description + """ waex.cookies.gen_base(f"{prep_inpgen}/expbrsym.yml") pass def test_nobrsym(prep_inpgen): + """ + Èi̇·åıĸæńįģä¸ĭ¶æģ + + Args: + prep_inpgen: (bool): write your description + """ waex.cookies.gen_base(f"{prep_inpgen}/nbrsym.yml") pass def test_viz(datadir): + """ + Test if the given datadir exists. + + Args: + datadir: (str): write your description + """ pass def test_geom_scans(datadir): + """ + Parse geom + + Args: + datadir: (str): write your description + """ ymlt = waio.inp.inpGenerator(datadir / "orcaGeom.yml") string = f""" %geom diff --git a/tests/io/orca/singles/test_sp.py b/tests/io/orca/singles/test_sp.py index 311e79e..f82ce08 100644 --- a/tests/io/orca/singles/test_sp.py +++ b/tests/io/orca/singles/test_sp.py @@ -19,12 +19,24 @@ def test_orca_get_sp_e(datadir): + """ + R calculate eigenvalue of the eigenvalue isca. + + Args: + datadir: (str): write your description + """ sEnerg = waio.orca.orcaVis(ofile=datadir / "orca_qcisdt.out") np.testing.assert_almost_equal(sEnerg.fin_sp_e.m, -1.01010039) pass def test_orca_runinfo(datadir): + """ + Test run information. + + Args: + datadir: (str): write your description + """ se = waio.orca.orcaVis(ofile=datadir / "orca_qcisdt.out") se.runinfo = waio.orca.getRunInfo(Path("H2_test/QCISD/spin_01/ENERGY/3-21G/")) assert se.runinfo == { @@ -43,6 +55,12 @@ def test_orca_runinfo(datadir): def test_orca_mdci_e_bounds(datadir): + """ + Calculate the surface energy. + + Args: + datadir: (str): write your description + """ sEnerg = waio.orca.orcaVis(ofile=datadir / "orca_qcisdt.out") with pytest.raises(ValueError): sEnerg.single_energy_surface(npoints=34) @@ -50,6 +68,12 @@ def test_orca_mdci_e_bounds(datadir): def test_orca_energ_error(datadir): + """ + Calculate surface surface surface and surface surface. + + Args: + datadir: (str): write your description + """ sEnerg = waio.orca.orcaVis(ofile=datadir / "orca_qcisdt.out") with pytest.raises(NotImplementedError): sEnerg.single_energy_surface(etype="Squid") @@ -57,6 +81,12 @@ def test_orca_energ_error(datadir): def test_orca_energ_empty(datadir): + """ + R calculate surface surface surface surface. + + Args: + datadir: (str): write your description + """ warnings.filterwarnings("ignore") sEnerg = waio.orca.orcaVis(ofile=datadir / "orca_uhf.out") with pytest.raises(ValueError): @@ -203,6 +233,12 @@ def test_orca_mdci_e_mtrip_yvals(datadir): def test_mult_energy_surf(datadir): + """ + Calculate the energy of the surface energy of the energy. + + Args: + datadir: (str): write your description + """ sEnerg = waio.orca.orcaVis(ofile=datadir / "orca_qcisdt.out") eDat = sEnerg.single_energy_surface("MDCI w/o Triples", 33) eDatMDCI = sEnerg.single_energy_surface("MDCI") @@ -214,6 +250,12 @@ def test_mult_energy_surf(datadir): def test_mult_energy_surf_subset(datadir): + """ + Determine the energy of the energy of - energy. + + Args: + datadir: (str): write your description + """ sEnerg = waio.orca.orcaVis(ofile=datadir / "orca_qcisdt.out") eDatAll = sEnerg.mult_energy_surface(etype=["MDCI", "SCF Energy"]) assert "Actual Energy" not in eDatAll.columns @@ -223,6 +265,12 @@ def test_mult_energy_surf_subset(datadir): def test_mult_energy_surf_single(datadir): + """ + R calculate energy of the energy energy of - energy. + + Args: + datadir: (str): write your description + """ sEnerg = waio.orca.orcaVis(ofile=datadir / "orca_qcisdt.out") eDatSingleL = sEnerg.mult_energy_surface(etype=["MDCI"]) eDatMDCI = sEnerg.single_energy_surface("MDCI") @@ -238,6 +286,12 @@ def test_mult_energy_surf_single(datadir): def test_orca_single_chargepop(datadir): + """ + Test whether the mass isca or not. + + Args: + datadir: (str): write your description + """ spop = waio.orca.orcaVis(ofile=datadir / "orca_qcisdt.out") sdat = spop.single_population_analysis() assert sdat.shape == (4, 5) @@ -249,6 +303,12 @@ def test_orca_single_chargepop(datadir): def test_orca_single_fullpop(datadir): + """ + Perform a single - detector is aca. + + Args: + datadir: (str): write your description + """ spop = waio.orca.orcaVis(ofile=datadir / "orca_uhf.out") sdat = spop.single_population_analysis() assert sdat.shape == (2, 6) @@ -261,6 +321,12 @@ def test_orca_single_fullpop(datadir): def test_orca_nstep_pop(datadir): + """ + Test if nstep nstep. + + Args: + datadir: (str): write your description + """ spop = waio.orca.orcaVis(ofile=datadir / "ch3f_3ang_b3lyp.out") popdat = spop.single_population_analysis() assert popdat.step.max() == 2 @@ -276,6 +342,12 @@ def test_orca_nstep_pop(datadir): def test_orca_mult_chargepop(datadir): + """ + Test for mult_orca is aca. + + Args: + datadir: (str): write your description + """ spop = waio.orca.orcaVis(ofile=datadir / "orca_qcisdt.out") sdat = spop.mult_population_analysis() assert sdat.shape == (8, 10) @@ -284,6 +356,12 @@ def test_orca_mult_chargepop(datadir): def test_orca_mult_fullpop(datadir): + """ + Perform a mult_orca is a mult_populationca. + + Args: + datadir: (str): write your description + """ spop = waio.orca.orcaVis(ofile=datadir / "orca_uhf.out") sdat = spop.mult_population_analysis() assert sdat.shape == (4, 11) @@ -298,6 +376,12 @@ def test_orca_mult_fullpop(datadir): def test_orca_irspec(datadir): + """ + Test if theca specca spec is a numpy array. + + Args: + datadir: (str): write your description + """ spop = waio.orca.orcaVis(ofile=datadir / "b3lyp_6311g88_h2o.out") sdat = spop.ir_spec() assert sdat.shape == (3, 11) @@ -316,6 +400,12 @@ def test_orca_irspec(datadir): def test_orca_vpt2(datadir): + """ + Test if vpt2 is a 2d array. + + Args: + datadir: (str): write your description + """ spop = waio.orca.orcaVis(ofile=datadir / "orcaVPT2.out") sdat = spop.vpt2_transitions() assert sdat.shape == (3, 9) @@ -348,6 +438,12 @@ def test_orca_vpt2(datadir): def test_calc_htst(datadir): + """ + Calculate the irradiance. + + Args: + datadir: (str): write your description + """ prod = waio.orca.orcaVis(ofile=datadir / "orcaProduct.out") react = waio.orca.orcaVis(ofile=datadir / "orcaReactant.out") ts = waio.orca.orcaVis(ofile=datadir / "orcaTS.out") diff --git a/tests/io/orca/test_io.py b/tests/io/orca/test_io.py index fbd405f..34b8a2e 100644 --- a/tests/io/orca/test_io.py +++ b/tests/io/orca/test_io.py @@ -11,6 +11,12 @@ def test_orca_genEBDA(datadir): + """ + Calculate the orca angle. + + Args: + datadir: (str): write your description + """ magnitude = [ -38.652, -38.853, @@ -44,6 +50,12 @@ def test_orca_genEBDA(datadir): def test_get_final_sp_energy(datadir): + """ + R calculate energy. + + Args: + datadir: (str): write your description + """ expt = waio.orca.orcaExp(expfolder=datadir / "h2") fse = expt.get_final_sp_energy() fse.shape == (27, 6) @@ -100,6 +112,12 @@ def test_get_final_sp_energy(datadir): def test_get_energy_surface_shape(datadir): + """ + R calculate the energy energy of the surface. + + Args: + datadir: (str): write your description + """ expt = waio.orca.orcaExp(expfolder=datadir / "h2") edat = expt.get_energy_surface() assert list(edat.theory.unique()) == [ @@ -125,6 +143,12 @@ def test_get_energy_surface_shape(datadir): @pytest.mark.filterwarnings("ignore::UserWarning") def test_get_energy_surface_empty(datadir): + """ + R calculate surface surface surface energy. + + Args: + datadir: (str): write your description + """ expt = waio.orca.orcaExp(expfolder=datadir / "h2") with pytest.raises(ValueError): expt.get_energy_surface(etype=["MDCI", "Actual Energy"]) @@ -132,6 +156,12 @@ def test_get_energy_surface_empty(datadir): def test_get_energy_surface_shape_more(datadir): + """ + R calculate energy energy energy for energy. + + Args: + datadir: (str): write your description + """ otheory = ["RHF", "RHF MP2", "UHF", "UHF MP2", "QCISD(T)"] expt = waio.orca.orcaExp( expfolder=datadir / "multiword_energy", order_theory=otheory @@ -167,6 +197,12 @@ def test_get_energy_surface_shape_more(datadir): def test_get_pop(datadir): + """ + Calculate test. + + Args: + datadir: (str): write your description + """ oth = ["UHF", "UKS BLYP", "UKS B3LYP"] expt = waio.orca.orcaExp(expfolder=datadir / "multxyz_pop", order_theory=oth) popdat = expt.get_population() @@ -201,6 +237,12 @@ def test_get_pop(datadir): def test_get_ir_freq(datadir): + """ + Get the ir_get frequency. + + Args: + datadir: (str): write your description + """ oth = ["HF", "MP2", "B3LYP"] expt = waio.orca.orcaExp(expfolder=datadir / "ir_spec", order_theory=oth) vdat = expt.get_ir_spec() @@ -215,6 +257,12 @@ def test_get_ir_freq(datadir): def test_vpt2_transitions(datadir): + """ + Test if vpt2 cross - transformer. + + Args: + datadir: (str): write your description + """ oth = ["HF", "MP2", "B3LYP"] expt = waio.orca.orcaExp(expfolder=datadir / "vpt2_h2o", order_theory=oth) vdat = expt.get_vpt2_transitions() diff --git a/tests/io/xyz/test_xyz.py b/tests/io/xyz/test_xyz.py index cfc2b6f..1da14ac 100644 --- a/tests/io/xyz/test_xyz.py +++ b/tests/io/xyz/test_xyz.py @@ -5,6 +5,12 @@ def test_xyz(datadir): + """ + Test the x y z coordinates of the x y coordinates. + + Args: + datadir: (str): write your description + """ sx = waio.xyz.xyzIO(datadir / "h2mol.xyz") assert sx.comment_line == "XYZ file generated by Avogadro.\n" sx.comment_line = "new" @@ -43,18 +49,36 @@ def test_write_xyz(tmp_path, datadir): def test_slugxyz(datadir): + """ + Test if the given datadir is set + + Args: + datadir: (str): write your description + """ sx = waio.xyz.xyzIO(datadir / "h2mol.xyz") assert sx.slug == "H2_h2mol" pass def test_sysxyz(datadir): + """ + Test if the system test test test files. + + Args: + datadir: (str): write your description + """ sx = waio.xyz.xyzIO(datadir / "h2mol.xyz") assert sx.system == "H2" pass def test_counts(datadir): + """ + Count the number of test counts in a given datadir. + + Args: + datadir: (str): write your description + """ sx = waio.xyz.xyzIO(datadir / "h2mol.xyz") assert sx.counts == {"H": 2} pass diff --git a/wailord/io/inp.py b/wailord/io/inp.py index c1b89da..68221ef 100644 --- a/wailord/io/inp.py +++ b/wailord/io/inp.py @@ -55,6 +55,13 @@ class inpGenerator: def __init__(self, filename): + """ + Initialize geomagnetic object. + + Args: + self: (todo): write your description + filename: (str): write your description + """ self.qc = None self.xyz = [] self.xyzpath = None @@ -73,6 +80,12 @@ def __init__(self, filename): self.scripts = [] def __repr__(self): + """ + Return a repr representation of a repr__. + + Args: + self: (todo): write your description + """ return f"{self.konfik.show_config()}" def read_yml(self): @@ -272,6 +285,13 @@ def parse_blocks(self, blocks): return "".join(blines) def parse_keywords(self, keywords): + """ + Parse a list of keywords. + + Args: + self: (todo): write your description + keywords: (str): write your description + """ keylines = [] for kl in keywords: keylines.append(f"\n! {kl}") @@ -288,6 +308,13 @@ def parse_yml(self): pass def parse_viz(self, viz): + """ + Parse a viz string. + + Args: + self: (todo): write your description + viz: (todo): write your description + """ if viz.chemcraft is True: string = """ @@ -300,6 +327,13 @@ def parse_viz(self, viz): return textwrap.dedent(string) def parse_scf(self, scf): + """ + Parse a scf file. + + Args: + self: (todo): write your description + scf: (todo): write your description + """ textlines = [] textlines.append("\n%scf\n") if "brokensym" in scf: @@ -337,6 +371,13 @@ def parse_params(self, params): return "".join(textlines) def params_slot(self, thing): + """ + Deter parameters for a thing. + + Args: + self: (todo): write your description + thing: (str): write your description + """ if not "xyz" in thing or thing["xyz"] is not True: raise TypeError("Currently only supports xyz") atype, anum, axis, name = itemgetter("atype", "anum", "axis", "name")(thing) @@ -351,6 +392,14 @@ def params_slot(self, thing): return xyzblock, comment def params_value(self, thing, comment): + """ + Return the value of a thing. + + Args: + self: (todo): write your description + thing: (int): write your description + comment: (str): write your description + """ name, val = itemgetter("name", "value")(thing) return f"\t{name} = {val} {comment}\n" @@ -387,6 +436,12 @@ def genharness(self, basename, slow=False): pass def parse_qc(self): + """ + Parse qc qc. + + Args: + self: (todo): write your description + """ qcList = list( itertt.chain(self.qc.style, self.qc.calculations, self.qc.basis_sets) ) @@ -516,10 +571,23 @@ class simpleInput: """ Base class for representing the simple input line""" def __init__(self, data): + """ + Initialize the object. + + Args: + self: (todo): write your description + data: (todo): write your description + """ self.contents = None return def __repr__(self): + """ + Return a repr representation of a repr__. + + Args: + self: (todo): write your description + """ return f"!{contents}" @@ -527,11 +595,24 @@ class blockInput: """Base class representing block inputs""" def __init__(self, data): + """ + Initialize the data object. + + Args: + self: (todo): write your description + data: (todo): write your description + """ self.keyword = None self.lines = None return def __repr__(self): + """ + Return a repr representation of this object. + + Args: + self: (todo): write your description + """ string = f""" %block {keyword} {lines} @@ -544,11 +625,24 @@ class coordBlock: """Base class for the coordinate block""" def __init__(self, data): + """ + Initialize the data object. + + Args: + self: (todo): write your description + data: (todo): write your description + """ self.keyword = None self.lines = None return def __repr__(self): + """ + Return a repr representation of this object. + + Args: + self: (todo): write your description + """ string = f""" *block {keyword} {lines} diff --git a/wailord/io/orca.py b/wailord/io/orca.py index 70c56d6..272bee2 100644 --- a/wailord/io/orca.py +++ b/wailord/io/orca.py @@ -348,6 +348,12 @@ def __init__( self.handle_exp(expfolder) def __repr__(self): + """ + Return a repr representation of this object. + + Args: + self: (todo): write your description + """ string = f""" Experiment: {self.inpconf} Outputs: {self.orclist} @@ -576,9 +582,22 @@ def __init__(self, ofile): self.get_final_e() def __repr__(self): + """ + Return a repr representation of a repr__. + + Args: + self: (todo): write your description + """ return f"{self.ofile}" def get_evals(self, ofile): + """ + Get evals from file + + Args: + self: (todo): write your description + ofile: (str): write your description + """ with open(self.ofile) as of: flines = of.readlines() for line in flines: @@ -587,6 +606,13 @@ def get_evals(self, ofile): return def get_final_e(self, dat=False): + """ + Calculate e ( e ) + + Args: + self: (todo): write your description + dat: (str): write your description + """ with open(self.ofile) as of: fInp = of.read() try: @@ -603,6 +629,12 @@ def get_final_e(self, dat=False): pass def final_sp_e(self): + """ + Finalize sp sp sp sp sp sp sp sp sp sp sp sp sp sp sp sp sp sp sp sp_e. + + Args: + self: (todo): write your description + """ erow = self.runinfo erow["final_sp_energy"] = self.fin_sp_e.m erow["unit"] = self.fin_sp_e.u diff --git a/wailord/io/xyz.py b/wailord/io/xyz.py index c236c63..b6a9465 100644 --- a/wailord/io/xyz.py +++ b/wailord/io/xyz.py @@ -52,6 +52,12 @@ class xyzVisitor(NodeVisitor): """This class extends NodeVisitor""" def __init__(self): + """ + Initialize the calculation + + Args: + self: (todo): write your description + """ self.natoms = None self.coord_block = None self.clines = [] @@ -59,6 +65,12 @@ def __init__(self): self.meta = None def __repr__(self): + """ + Return a repr representation of a repr__. + + Args: + self: (todo): write your description + """ return f"{self.meta}" def visit_meta(self, node, visited_children): @@ -92,6 +104,14 @@ def visit_atype(self, node, visited_children): return node.text def generic_visit(self, node, visited_children): + """ + Visit function for the given visitor. + + Args: + self: (todo): write your description + node: (todo): write your description + visited_children: (todo): write your description + """ return node.text or visited_children @@ -99,6 +119,13 @@ class xyzIO: """This class handles xyz files at a user level""" def __init__(self, filename): + """ + Initialize file + + Args: + self: (todo): write your description + filename: (str): write your description + """ self.filename = filename self.comment_line = "Generated by wailord" self.xyzdat = None @@ -108,9 +135,21 @@ def __init__(self, filename): self.read() def __repr__(self): + """ + Return a repr representation of a repr__. + + Args: + self: (todo): write your description + """ return f"XYZ file {self.filename}" def read(self): + """ + Reads a geometries object. + + Args: + self: (todo): write your description + """ with open(self.filename) as fp: dat = fp.readlines() self.comment_line = dat[1] @@ -128,15 +167,35 @@ def read(self): @property def comment_line(self): + """ + Return a new comment line. + + Args: + self: (todo): write your description + """ return self._comment_line @comment_line.setter def comment_line(self, cl): + """ + Add a comment. + + Args: + self: (todo): write your description + cl: (str): write your description + """ if len(cl.split("\n")) > 1: cl.replace("\n", " ") self._comment_line = cl def write(self, outname): + """ + Write the x y z coordinates to a file. + + Args: + self: (todo): write your description + outname: (str): write your description + """ with open(outname, "w") as op: # Recreate the comment line outdat = str(self.xyzdat).split("\n") diff --git a/wailord_templates/basicExperiment/hooks/pre_gen_project.py b/wailord_templates/basicExperiment/hooks/pre_gen_project.py index 574c55b..4a2aec2 100755 --- a/wailord_templates/basicExperiment/hooks/pre_gen_project.py +++ b/wailord_templates/basicExperiment/hooks/pre_gen_project.py @@ -5,6 +5,11 @@ def main(): + """ + Main function. + + Args: + """ try: import wailord except ImportError as error: