示例#1
0
    def input_gen_gauss(self,
                        charge=None,
                        spin_multiplicity=None,
                        title=None,
                        functional='HF',
                        basis_set='6-31G(d)',
                        route_parameters=SUGGESTED_route_parameters,
                        input_parameters=None,
                        link0_parameters=None,
                        dieze_tag='#P',
                        gen_basis=None):

        ginobj_mono_a = GaussianInput(self.mono_a, charge, spin_multiplicity,
                                      title, functional, basis_set,
                                      route_parameters, input_parameters,
                                      link0_parameters, dieze_tag, gen_basis)

        ginobj_mono_b = GaussianInput(self.mono_a, charge, spin_multiplicity,
                                      title, functional, basis_set,
                                      route_parameters, input_parameters,
                                      link0_parameters, dieze_tag, gen_basis)

        dimer_sites = self.mono_a.sites + self.mono_b.sites
        dimer_pmgmol = Molecule.from_sites(dimer_sites)
        ginobj_dimer = GaussianInput(dimer_pmgmol, charge, spin_multiplicity,
                                     title, functional, basis_set,
                                     route_parameters, input_parameters,
                                     link0_parameters, dieze_tag, gen_basis)
        return ginobj_mono_a.to_string(
            cart_coords=True), ginobj_mono_b.to_string(
                cart_coords=True), ginobj_dimer.to_string(cart_coords=True)
示例#2
0
    def test_no_molecule_func_bset_charge_mult(self):
        """
        Test that we can write inputs files without a geometry,
        functional, basis set, charge or multiplicity
        (mainly for postprocessing jobs where this info is read from .chk)
        """
        gau_str = "#P chkbasis geom=allcheck guess=(only,read) pop=naturalorbital\n"
        gau_str += "\n"
        gau_str += "Restart"

        input_file = GaussianInput(
            None,
            charge=None,
            spin_multiplicity=None,
            functional=None,
            basis_set=None,
            route_parameters={
                "chkbasis": None,
                "geom": "allcheck",
                "guess": {
                    "only": None,
                    "read": None
                },
                "pop": "naturalorbital",
            },
        )
        input_str = input_file.to_string().strip()
        self.assertEqual(input_str, gau_str)
示例#3
0
    def test_no_molecule(self):
        """Test that we can write input files without a geometry"""

        # Makes a file without geometry
        input_file = GaussianInput(None, charge=0, spin_multiplicity=2)
        input_str = input_file.to_string().strip()
        self.assertTrue(input_str.endswith("0 2"))
示例#4
0
    def test_no_molecule(self):
        """Test that we can write output files without a geometry"""

        # Note that we must manually specify charge
        with self.assertRaises(ValueError):
            GaussianInput(None)

        # Makes a file without geometry
        input_file = GaussianInput(None, charge=0, spin_multiplicity=2)
        input_str = input_file.to_string().strip()
        self.assertTrue(input_str.endswith("0 2"))
示例#5
0
    def test_gen_basis(self):
        gau_str = """#N B3LYP/Gen Pseudo=Read

Test

0 1
C
H 1 B1
H 1 B2 2 A2
H 1 B3 2 A3 3 D3
H 1 B4 2 A4 4 D4

B1=1.089000
B2=1.089000
A2=109.471221
B3=1.089000
A3=109.471213
D3=120.000017
B4=1.089000
A4=109.471213
D4=119.999966

C 0
6-31G(d,p)
****
H 0
6-31G
****



"""
        mol = Molecule(["C", "H", "H", "H", "H"], self.coords)
        gen_basis = "C 0\n6-31G(d,p)\n****\nH 0\n6-31G\n****"
        gau = GaussianInput(
            mol,
            functional="B3LYP",
            gen_basis=gen_basis,
            dieze_tag="#N",
            route_parameters={"Pseudo": "Read"},
            title="Test",
        )
        self.assertEqual(gau.to_string(cart_coords=False), gau_str)
示例#6
0
    def test_gen_basis(self):
        gau_str = """#N B3LYP/Gen Pseudo=Read

Test

0 1
C
H 1 B1
H 1 B2 2 A2
H 1 B3 2 A3 3 D3
H 1 B4 2 A4 4 D4

B1=1.089000
B2=1.089000
A2=109.471221
B3=1.089000
A3=109.471213
D3=120.000017
B4=1.089000
A4=109.471213
D4=119.999966

C 0
6-31G(d,p)
****
H 0
6-31G
****



"""
        mol = Molecule(["C", "H", "H", "H", "H"], self.coords)
        gen_basis = "C 0\n6-31G(d,p)\n****\nH 0\n6-31G\n****"
        gau = GaussianInput(mol, functional="B3LYP", gen_basis=gen_basis,
                            dieze_tag="#N", route_parameters={"Pseudo": "Read"},
                            title="Test")
        self.assertEqual(gau.to_string(cart_coords=False), gau_str)
示例#7
0
    def gen_input(self,
                  step_size,
                  nrings,
                  maxnbq,
                  height=1.7,
                  normaldirection=0,
                  charge=None,
                  spin_multiplicity=None,
                  title=None,
                  functional='HF',
                  basis_set='6-31G(d)',
                  route_parameters=None,
                  input_parameters=None,
                  link0_parameters=None,
                  dieze_tag='#P',
                  gen_basis=None):
        """
        this will return two lists of gauss input string, xticks, xnumbers, pt_idx(ring idx) for plotting

        pts are cart coords for bqs

        return None if failed

        one problem is if the number of ghost atoms cannot be too large, so the param maxnbq is introduced as
        the max number of ghost atoms that is allowed to show in one input file
        for other param docs see nics_line_scan_path and pymatgen.io.gassian
        """
        pts, pt_idx, xnumbers, xticks = self.nics_line_scan_path(
            step_size, nrings, height, normaldirection)
        sigma_mol_msites = self.nics_sigma_structure(normal_idx=1 -
                                                     normaldirection)
        sigma_pmgmol = Molecule.from_sites(sigma_mol_msites)
        total_pmgmol = self.omol.pmgmol
        chunksize = maxnbq

        total_ginobj = GaussianInput(total_pmgmol, charge, spin_multiplicity,
                                     title, functional, basis_set,
                                     route_parameters, input_parameters,
                                     link0_parameters, dieze_tag, gen_basis)
        sigma_ginobj = GaussianInput(sigma_pmgmol, charge, spin_multiplicity,
                                     title, functional, basis_set,
                                     route_parameters, input_parameters,
                                     link0_parameters, dieze_tag, gen_basis)

        total_outs_list = []
        sigma_outs_list = []
        if len(pts) > maxnbq:
            pts_sep_list = [
                pts[i * chunksize:(i + 1) * chunksize]
                for i in range((len(pts) + chunksize - 1) // chunksize)
            ]
            for idx in range(len(pts_sep_list)):
                total_outs = total_ginobj.to_string(cart_coords=True)
                total_outs = self.add_bqlines(total_outs, pts_sep_list[idx])
                sigma_outs = sigma_ginobj.to_string(cart_coords=True)
                sigma_outs = self.add_bqlines(sigma_outs, pts_sep_list[idx])

                total_outs_list.append(total_outs)
                sigma_outs_list.append(sigma_outs)
        else:  # is this redundant?
            total_outs = total_ginobj.to_string(cart_coords=True)
            total_outs = self.add_bqlines(total_outs, pts)
            sigma_outs = sigma_ginobj.to_string(cart_coords=True)
            sigma_outs = self.add_bqlines(sigma_outs, pts)
            total_outs_list.append(total_outs)
            sigma_outs_list.append(sigma_outs)
        return sigma_outs_list, total_outs_list, xticks, xnumbers, pt_idx, pts