コード例 #1
0
    def setUp(self):
        tasks = [
            NwTask.dft_task(mol,
                            operation="optimize",
                            xc="b3lyp",
                            basis_set="6-31++G*"),
            NwTask.dft_task(mol,
                            operation="freq",
                            xc="b3lyp",
                            basis_set="6-31++G*"),
            NwTask.dft_task(mol,
                            operation="energy",
                            xc="b3lyp",
                            basis_set="6-311++G**"),
            NwTask.dft_task(mol,
                            charge=mol.charge + 1,
                            operation="energy",
                            xc="b3lyp",
                            basis_set="6-311++G**"),
            NwTask.dft_task(mol,
                            charge=mol.charge - 1,
                            operation="energy",
                            xc="b3lyp",
                            basis_set="6-311++G**")
        ]

        self.nwi = NwInput(mol,
                           tasks,
                           geometry_options=["units", "angstroms", "noautoz"],
                           memory_options="total 1000 mb")
        self.nwi_symm = NwInput(
            mol,
            tasks,
            geometry_options=["units", "angstroms", "noautoz"],
            symmetry_options=["c1"])
コード例 #2
0
ファイル: test_nwchem.py プロジェクト: CompRhys/pymatgen
 def test_to_from_dict(self):
     d = self.nwi.as_dict()
     nwi = NwInput.from_dict(d)
     self.assertIsInstance(nwi, NwInput)
     # Ensure it is json-serializable.
     json.dumps(d)
     d = self.nwi_symm.as_dict()
     nwi_symm = NwInput.from_dict(d)
     self.assertIsInstance(nwi_symm, NwInput)
     json.dumps(d)
コード例 #3
0
ファイル: test_nwchem.py プロジェクト: sonium0/pymatgen
 def test_to_from_dict(self):
     d = self.nwi.as_dict()
     nwi = NwInput.from_dict(d)
     self.assertIsInstance(nwi, NwInput)
     #Ensure it is json-serializable.
     json.dumps(d)
     d = self.nwi_symm.as_dict()
     nwi_symm = NwInput.from_dict(d)
     self.assertIsInstance(nwi_symm, NwInput)
     json.dumps(d)
コード例 #4
0
ファイル: test_nwchem.py プロジェクト: dcossey014/pymatgen
    def setUp(self):
        tasks = [
            NwTask.dft_task(mol, operation="optimize", xc="b3lyp", basis_set="6-31++G*"),
            NwTask.dft_task(mol, operation="freq", xc="b3lyp", basis_set="6-31++G*"),
            NwTask.dft_task(mol, operation="energy", xc="b3lyp", basis_set="6-311++G**"),
            NwTask.dft_task(mol, charge=mol.charge + 1, operation="energy", xc="b3lyp", basis_set="6-311++G**"),
            NwTask.dft_task(mol, charge=mol.charge - 1, operation="energy", xc="b3lyp", basis_set="6-311++G**"),
        ]

        self.nwi = NwInput(
            mol, tasks, geometry_options=["units", "angstroms", "noautoz"], memory_options="total 1000 mb"
        )
        self.nwi_symm = NwInput(mol, tasks, geometry_options=["units", "angstroms", "noautoz"], symmetry_options=["c1"])
コード例 #5
0
ファイル: handlers.py プロジェクト: ProjectFrank/custodian
    def correct(self):
        backup("*.nw*")
        actions = []
        nwi = NwInput.from_file(self.input_file)
        for e in self.errors:
            if e == "autoz error":
                action = {"_set": {"geometry_options": ["units",
                                                        "angstroms",
                                                        "noautoz"]}}
                actions.append(action)
            elif e == "Bad convergence":
                t = nwi.tasks[self.ntasks - 1]
                if "cgmin" in t.theory_directives:
                    nwi.tasks.pop(self.ntasks - 1)
                else:
                    t.theory_directives["cgmin"] = ""
                for t in nwi.tasks:
                    if t.operation.startswith("freq"):
                        #You cannot calculate hessian with cgmin.
                        t.theory_directives["nocgmin"] = ""
                action = {"_set": {"tasks": [t.as_dict() for t in nwi.tasks]}}
                actions.append(action)
            else:
                # For unimplemented errors, this should just cause the job to
                # die.
                return {"errors": self.errors, "actions": None}

        m = Modder()
        for action in actions:
            nwi = m.modify_object(action, nwi)
        nwi.write_file(self.input_file)
        return {"errors": self.errors, "actions": actions}
コード例 #6
0
    def correct(self):
        backup("*.nw*")
        actions = []
        nwi = NwInput.from_file(self.input_file)
        for e in self.errors:
            if e == "autoz error":
                action = {
                    "_set": {
                        "geometry_options": ["units", "angstroms", "noautoz"]
                    }
                }
                actions.append(action)
            elif e == "Bad convergence":
                t = nwi.tasks[self.ntasks - 1]
                if "cgmin" in t.theory_directives:
                    nwi.tasks.pop(self.ntasks - 1)
                else:
                    t.theory_directives["cgmin"] = ""
                for t in nwi.tasks:
                    if t.operation.startswith("freq"):
                        # You cannot calculate hessian with cgmin.
                        t.theory_directives["nocgmin"] = ""
                action = {"_set": {"tasks": [t.as_dict() for t in nwi.tasks]}}
                actions.append(action)
            else:
                # For unimplemented errors, this should just cause the job to
                # die.
                return {"errors": self.errors, "actions": None}

        m = Modder()
        for action in actions:
            nwi = m.modify_object(action, nwi)
        nwi.write_file(self.input_file)
        return {"errors": self.errors, "actions": actions}
コード例 #7
0
    def get_nwinput(self, mol):
        functional = "b3lyp"
        geom_opt_bset = {}
        scf_bset = {}
        for el in mol.composition.elements:
            geom_opt_bset[el.symbol] = "6-31+g*"
            scf_bset[el.symbol] = "6-31++g**" if el.Z <= 18 else "6-31+g*"

        if len(mol) > 1:
            # Insert opt and freq job for molecules with more than one atom.
            tasks = [
                NwTask.dft_task(mol, operation="optimize", xc=functional,
                                basis_set=geom_opt_bset),
                NwTask.dft_task(mol, operation="freq", xc=functional,
                                basis_set=geom_opt_bset)
            ]
        else:
            tasks = []

        tasks.extend([
            NwTask.dft_task(mol, operation="energy", xc=functional,
                            basis_set=scf_bset),
            NwTask.dft_task(mol, charge=mol.charge + 1, operation="energy",
                            xc=functional, basis_set=scf_bset),
            NwTask.dft_task(mol, charge=mol.charge - 1, operation="energy",
                            xc=functional, basis_set=scf_bset)
        ])

        return NwInput(mol, tasks)
コード例 #8
0
def _prepare_pymatgen_dict(parameters,struct=None):
    from pymatgen.io.nwchem import NwInput
    import copy

    par = copy.deepcopy(parameters)
    add_cell = par.pop('add_cell',False)
    if struct:
        if add_cell:
            par['geometry_options'].append(
                '\n  system crystal\n'
                '    lat_a {}\n    lat_b {}\n    lat_c {}\n'
                '    alpha {}\n    beta  {}\n    gamma {}\n'
                '  end'.format(*(struct.cell_lengths+struct.cell_angles)))

        if 'mol' not in par:
            par['mol'] = {}
        if 'sites' not in par['mol']:
            par['mol']['sites'] = []

        atoms = struct.get_ase()
        for i,atom_type in enumerate(atoms.get_chemical_symbols()):
            xyz = []
            if add_cell:
                xyz = atoms.get_scaled_positions()[i]
            else:
                xyz = atoms.get_positions()[i]
            par['mol']['sites'].append({
                'species': [ { 'element': atom_type, 'occu': 1 } ],
                'xyz': xyz
            })

    return str(NwInput.from_dict(par))
コード例 #9
0
ファイル: test_nwchem.py プロジェクト: CompRhys/pymatgen
    def test_from_string_and_file(self):
        nwi = NwInput.from_file(os.path.join(test_dir, "ch4.nw"))
        self.assertEqual(nwi.tasks[0].theory, "dft")
        self.assertEqual(nwi.memory_options, "total 1000 mb stack 400 mb")
        self.assertEqual(nwi.tasks[0].basis_set["C"], "6-31++G*")
        self.assertEqual(nwi.tasks[-1].basis_set["C"], "6-311++G**")
        # Try a simplified input.
        str_inp = """start H4C1
geometry units angstroms
 C 0.0 0.0 0.0
 H 0.0 0.0 1.089
 H 1.026719 0.0 -0.363
 H -0.51336 -0.889165 -0.363
 H -0.51336 0.889165 -0.363
end

title "H4C1 dft optimize"
charge 0
basis cartesian
 H library "6-31++G*"
 C library "6-31++G*"
end
dft
 xc b3lyp
 mult 1
end
task scf optimize

title "H4C1 dft freq"
charge 0
task scf freq

title "H4C1 dft energy"
charge 0
basis cartesian
 H library "6-311++G**"
 C library "6-311++G**"
end
task dft energy

title "H4C1 dft energy"
charge 1
dft
 xc b3lyp
 mult 2
end
task dft energy

title "H4C1 dft energy"
charge -1
task dft energy
"""
        nwi = NwInput.from_string(str_inp)
        self.assertEqual(nwi.geometry_options, ["units", "angstroms"])
        self.assertEqual(nwi.tasks[0].theory, "scf")
        self.assertEqual(nwi.tasks[0].basis_set["C"], "6-31++G*")
        self.assertEqual(nwi.tasks[-1].theory, "dft")
        self.assertEqual(nwi.tasks[-1].basis_set["C"], "6-311++G**")

        str_inp_symm = str_inp.replace(
            "geometry units angstroms",
            "geometry units angstroms\n symmetry c1")

        nwi_symm = NwInput.from_string(str_inp_symm)
        self.assertEqual(nwi_symm.geometry_options, ["units", "angstroms"])
        self.assertEqual(nwi_symm.symmetry_options, ["c1"])
        self.assertEqual(nwi_symm.tasks[0].theory, "scf")
        self.assertEqual(nwi_symm.tasks[0].basis_set["C"], "6-31++G*")
        self.assertEqual(nwi_symm.tasks[-1].theory, "dft")
        self.assertEqual(nwi_symm.tasks[-1].basis_set["C"], "6-311++G**")
コード例 #10
0
ファイル: test_nwchem.py プロジェクト: CompRhys/pymatgen
class NwInputTest(unittest.TestCase):
    def setUp(self):
        tasks = [
            NwTask.dft_task(mol,
                            operation="optimize",
                            xc="b3lyp",
                            basis_set="6-31++G*"),
            NwTask.dft_task(mol,
                            operation="freq",
                            xc="b3lyp",
                            basis_set="6-31++G*"),
            NwTask.dft_task(mol,
                            operation="energy",
                            xc="b3lyp",
                            basis_set="6-311++G**"),
            NwTask.dft_task(
                mol,
                charge=mol.charge + 1,
                operation="energy",
                xc="b3lyp",
                basis_set="6-311++G**",
            ),
            NwTask.dft_task(
                mol,
                charge=mol.charge - 1,
                operation="energy",
                xc="b3lyp",
                basis_set="6-311++G**",
            ),
        ]

        self.nwi = NwInput(
            mol,
            tasks,
            geometry_options=["units", "angstroms", "noautoz"],
            memory_options="total 1000 mb",
        )
        self.nwi_symm = NwInput(
            mol,
            tasks,
            geometry_options=["units", "angstroms", "noautoz"],
            symmetry_options=["c1"],
        )

    def test_str(self):
        ans = """memory total 1000 mb
geometry units angstroms noautoz
 C 0.0 0.0 0.0
 H 0.0 0.0 1.089
 H 1.026719 0.0 -0.363
 H -0.51336 -0.889165 -0.363
 H -0.51336 0.889165 -0.363
end

title "H4C1 dft optimize"
charge 0
basis cartesian
 C library "6-31++G*"
 H library "6-31++G*"
end
dft
 mult 1
 xc b3lyp
end
task dft optimize

title "H4C1 dft freq"
charge 0
basis cartesian
 C library "6-31++G*"
 H library "6-31++G*"
end
dft
 mult 1
 xc b3lyp
end
task dft freq

title "H4C1 dft energy"
charge 0
basis cartesian
 C library "6-311++G**"
 H library "6-311++G**"
end
dft
 mult 1
 xc b3lyp
end
task dft energy

title "H4C1 dft energy"
charge 1
basis cartesian
 C library "6-311++G**"
 H library "6-311++G**"
end
dft
 mult 2
 xc b3lyp
end
task dft energy

title "H4C1 dft energy"
charge -1
basis cartesian
 C library "6-311++G**"
 H library "6-311++G**"
end
dft
 mult 2
 xc b3lyp
end
task dft energy
"""
        self.assertEqual(str(self.nwi), ans)

        ans_symm = """geometry units angstroms noautoz
 symmetry c1
 C 0.0 0.0 0.0
 H 0.0 0.0 1.089
 H 1.026719 0.0 -0.363
 H -0.51336 -0.889165 -0.363
 H -0.51336 0.889165 -0.363
end

title "H4C1 dft optimize"
charge 0
basis cartesian
 C library "6-31++G*"
 H library "6-31++G*"
end
dft
 mult 1
 xc b3lyp
end
task dft optimize

title "H4C1 dft freq"
charge 0
basis cartesian
 C library "6-31++G*"
 H library "6-31++G*"
end
dft
 mult 1
 xc b3lyp
end
task dft freq

title "H4C1 dft energy"
charge 0
basis cartesian
 C library "6-311++G**"
 H library "6-311++G**"
end
dft
 mult 1
 xc b3lyp
end
task dft energy

title "H4C1 dft energy"
charge 1
basis cartesian
 C library "6-311++G**"
 H library "6-311++G**"
end
dft
 mult 2
 xc b3lyp
end
task dft energy

title "H4C1 dft energy"
charge -1
basis cartesian
 C library "6-311++G**"
 H library "6-311++G**"
end
dft
 mult 2
 xc b3lyp
end
task dft energy
"""

        self.assertEqual(str(self.nwi_symm), ans_symm)

    def test_to_from_dict(self):
        d = self.nwi.as_dict()
        nwi = NwInput.from_dict(d)
        self.assertIsInstance(nwi, NwInput)
        # Ensure it is json-serializable.
        json.dumps(d)
        d = self.nwi_symm.as_dict()
        nwi_symm = NwInput.from_dict(d)
        self.assertIsInstance(nwi_symm, NwInput)
        json.dumps(d)

    def test_from_string_and_file(self):
        nwi = NwInput.from_file(os.path.join(test_dir, "ch4.nw"))
        self.assertEqual(nwi.tasks[0].theory, "dft")
        self.assertEqual(nwi.memory_options, "total 1000 mb stack 400 mb")
        self.assertEqual(nwi.tasks[0].basis_set["C"], "6-31++G*")
        self.assertEqual(nwi.tasks[-1].basis_set["C"], "6-311++G**")
        # Try a simplified input.
        str_inp = """start H4C1
geometry units angstroms
 C 0.0 0.0 0.0
 H 0.0 0.0 1.089
 H 1.026719 0.0 -0.363
 H -0.51336 -0.889165 -0.363
 H -0.51336 0.889165 -0.363
end

title "H4C1 dft optimize"
charge 0
basis cartesian
 H library "6-31++G*"
 C library "6-31++G*"
end
dft
 xc b3lyp
 mult 1
end
task scf optimize

title "H4C1 dft freq"
charge 0
task scf freq

title "H4C1 dft energy"
charge 0
basis cartesian
 H library "6-311++G**"
 C library "6-311++G**"
end
task dft energy

title "H4C1 dft energy"
charge 1
dft
 xc b3lyp
 mult 2
end
task dft energy

title "H4C1 dft energy"
charge -1
task dft energy
"""
        nwi = NwInput.from_string(str_inp)
        self.assertEqual(nwi.geometry_options, ["units", "angstroms"])
        self.assertEqual(nwi.tasks[0].theory, "scf")
        self.assertEqual(nwi.tasks[0].basis_set["C"], "6-31++G*")
        self.assertEqual(nwi.tasks[-1].theory, "dft")
        self.assertEqual(nwi.tasks[-1].basis_set["C"], "6-311++G**")

        str_inp_symm = str_inp.replace(
            "geometry units angstroms",
            "geometry units angstroms\n symmetry c1")

        nwi_symm = NwInput.from_string(str_inp_symm)
        self.assertEqual(nwi_symm.geometry_options, ["units", "angstroms"])
        self.assertEqual(nwi_symm.symmetry_options, ["c1"])
        self.assertEqual(nwi_symm.tasks[0].theory, "scf")
        self.assertEqual(nwi_symm.tasks[0].basis_set["C"], "6-31++G*")
        self.assertEqual(nwi_symm.tasks[-1].theory, "dft")
        self.assertEqual(nwi_symm.tasks[-1].basis_set["C"], "6-311++G**")
コード例 #11
0
ファイル: test_nwchem.py プロジェクト: sonium0/pymatgen
    def test_from_string_and_file(self):
        nwi = NwInput.from_file(os.path.join(test_dir, "ch4.nw"))
        self.assertEqual(nwi.tasks[0].theory, "dft")
        self.assertEqual(nwi.memory_options, "total 1000 mb stack 400 mb")
        self.assertEqual(nwi.tasks[0].basis_set["C"], "6-31++G*")
        self.assertEqual(nwi.tasks[-1].basis_set["C"], "6-311++G**")
        #Try a simplified input.
        str_inp = """start H4C1
geometry units angstroms
 C 0.0 0.0 0.0
 H 0.0 0.0 1.089
 H 1.026719 0.0 -0.363
 H -0.51336 -0.889165 -0.363
 H -0.51336 0.889165 -0.363
end

title "H4C1 dft optimize"
charge 0
basis
 H library "6-31++G*"
 C library "6-31++G*"
end
dft
 xc b3lyp
 mult 1
end
task scf optimize

title "H4C1 dft freq"
charge 0
task scf freq

title "H4C1 dft energy"
charge 0
basis
 H library "6-311++G**"
 C library "6-311++G**"
end
task dft energy

title "H4C1 dft energy"
charge 1
dft
 xc b3lyp
 mult 2
end
task dft energy

title "H4C1 dft energy"
charge -1
task dft energy
"""
        nwi = NwInput.from_string(str_inp)
        self.assertEqual(nwi.geometry_options, ['units', 'angstroms'])
        self.assertEqual(nwi.tasks[0].theory, "scf")
        self.assertEqual(nwi.tasks[0].basis_set["C"], "6-31++G*")
        self.assertEqual(nwi.tasks[-1].theory, "dft")
        self.assertEqual(nwi.tasks[-1].basis_set["C"], "6-311++G**")

        str_inp_symm = str_inp.replace("geometry units angstroms",
                                       "geometry units angstroms\n symmetry "
                                       "c1")

        nwi_symm = NwInput.from_string(str_inp_symm)
        self.assertEqual(nwi_symm.geometry_options, ['units', 'angstroms'])
        self.assertEqual(nwi_symm.symmetry_options, ['c1'])
        self.assertEqual(nwi_symm.tasks[0].theory, "scf")
        self.assertEqual(nwi_symm.tasks[0].basis_set["C"], "6-31++G*")
        self.assertEqual(nwi_symm.tasks[-1].theory, "dft")
        self.assertEqual(nwi_symm.tasks[-1].basis_set["C"], "6-311++G**")
コード例 #12
0
ファイル: test_nwchem.py プロジェクト: sonium0/pymatgen
class NwInputTest(unittest.TestCase):
    def setUp(self):
        tasks = [
            NwTask.dft_task(mol, operation="optimize", xc="b3lyp",
                            basis_set="6-31++G*"),
            NwTask.dft_task(mol, operation="freq", xc="b3lyp",
                            basis_set="6-31++G*"),
            NwTask.dft_task(mol, operation="energy", xc="b3lyp",
                            basis_set="6-311++G**"),
            NwTask.dft_task(mol, charge=mol.charge + 1, operation="energy",
                            xc="b3lyp", basis_set="6-311++G**"),
            NwTask.dft_task(mol, charge=mol.charge - 1, operation="energy",
                            xc="b3lyp", basis_set="6-311++G**")
        ]

        self.nwi = NwInput(mol, tasks,
                           geometry_options=["units", "angstroms", "noautoz"],
                           memory_options="total 1000 mb")
        self.nwi_symm = NwInput(mol, tasks,
                                geometry_options=["units", "angstroms",
                                                  "noautoz"],
                                symmetry_options=["c1"])

    def test_str(self):
        ans = """memory total 1000 mb
geometry units angstroms noautoz
 C 0.0 0.0 0.0
 H 0.0 0.0 1.089
 H 1.026719 0.0 -0.363
 H -0.51336 -0.889165 -0.363
 H -0.51336 0.889165 -0.363
end

title "H4C1 dft optimize"
charge 0
basis
 C library "6-31++G*"
 H library "6-31++G*"
end
dft
 mult 1
 xc b3lyp
end
task dft optimize

title "H4C1 dft freq"
charge 0
basis
 C library "6-31++G*"
 H library "6-31++G*"
end
dft
 mult 1
 xc b3lyp
end
task dft freq

title "H4C1 dft energy"
charge 0
basis
 C library "6-311++G**"
 H library "6-311++G**"
end
dft
 mult 1
 xc b3lyp
end
task dft energy

title "H4C1 dft energy"
charge 1
basis
 C library "6-311++G**"
 H library "6-311++G**"
end
dft
 mult 2
 xc b3lyp
end
task dft energy

title "H4C1 dft energy"
charge -1
basis
 C library "6-311++G**"
 H library "6-311++G**"
end
dft
 mult 2
 xc b3lyp
end
task dft energy
"""
        self.assertEqual(str(self.nwi), ans)

        ans_symm = """geometry units angstroms noautoz
 symmetry c1
 C 0.0 0.0 0.0
 H 0.0 0.0 1.089
 H 1.026719 0.0 -0.363
 H -0.51336 -0.889165 -0.363
 H -0.51336 0.889165 -0.363
end

title "H4C1 dft optimize"
charge 0
basis
 C library "6-31++G*"
 H library "6-31++G*"
end
dft
 mult 1
 xc b3lyp
end
task dft optimize

title "H4C1 dft freq"
charge 0
basis
 C library "6-31++G*"
 H library "6-31++G*"
end
dft
 mult 1
 xc b3lyp
end
task dft freq

title "H4C1 dft energy"
charge 0
basis
 C library "6-311++G**"
 H library "6-311++G**"
end
dft
 mult 1
 xc b3lyp
end
task dft energy

title "H4C1 dft energy"
charge 1
basis
 C library "6-311++G**"
 H library "6-311++G**"
end
dft
 mult 2
 xc b3lyp
end
task dft energy

title "H4C1 dft energy"
charge -1
basis
 C library "6-311++G**"
 H library "6-311++G**"
end
dft
 mult 2
 xc b3lyp
end
task dft energy
"""

        self.assertEqual(str(self.nwi_symm), ans_symm)

    def test_to_from_dict(self):
        d = self.nwi.as_dict()
        nwi = NwInput.from_dict(d)
        self.assertIsInstance(nwi, NwInput)
        #Ensure it is json-serializable.
        json.dumps(d)
        d = self.nwi_symm.as_dict()
        nwi_symm = NwInput.from_dict(d)
        self.assertIsInstance(nwi_symm, NwInput)
        json.dumps(d)

    def test_from_string_and_file(self):
        nwi = NwInput.from_file(os.path.join(test_dir, "ch4.nw"))
        self.assertEqual(nwi.tasks[0].theory, "dft")
        self.assertEqual(nwi.memory_options, "total 1000 mb stack 400 mb")
        self.assertEqual(nwi.tasks[0].basis_set["C"], "6-31++G*")
        self.assertEqual(nwi.tasks[-1].basis_set["C"], "6-311++G**")
        #Try a simplified input.
        str_inp = """start H4C1
geometry units angstroms
 C 0.0 0.0 0.0
 H 0.0 0.0 1.089
 H 1.026719 0.0 -0.363
 H -0.51336 -0.889165 -0.363
 H -0.51336 0.889165 -0.363
end

title "H4C1 dft optimize"
charge 0
basis
 H library "6-31++G*"
 C library "6-31++G*"
end
dft
 xc b3lyp
 mult 1
end
task scf optimize

title "H4C1 dft freq"
charge 0
task scf freq

title "H4C1 dft energy"
charge 0
basis
 H library "6-311++G**"
 C library "6-311++G**"
end
task dft energy

title "H4C1 dft energy"
charge 1
dft
 xc b3lyp
 mult 2
end
task dft energy

title "H4C1 dft energy"
charge -1
task dft energy
"""
        nwi = NwInput.from_string(str_inp)
        self.assertEqual(nwi.geometry_options, ['units', 'angstroms'])
        self.assertEqual(nwi.tasks[0].theory, "scf")
        self.assertEqual(nwi.tasks[0].basis_set["C"], "6-31++G*")
        self.assertEqual(nwi.tasks[-1].theory, "dft")
        self.assertEqual(nwi.tasks[-1].basis_set["C"], "6-311++G**")

        str_inp_symm = str_inp.replace("geometry units angstroms",
                                       "geometry units angstroms\n symmetry "
                                       "c1")

        nwi_symm = NwInput.from_string(str_inp_symm)
        self.assertEqual(nwi_symm.geometry_options, ['units', 'angstroms'])
        self.assertEqual(nwi_symm.symmetry_options, ['c1'])
        self.assertEqual(nwi_symm.tasks[0].theory, "scf")
        self.assertEqual(nwi_symm.tasks[0].basis_set["C"], "6-31++G*")
        self.assertEqual(nwi_symm.tasks[-1].theory, "dft")
        self.assertEqual(nwi_symm.tasks[-1].basis_set["C"], "6-311++G**")
コード例 #13
0
#!/usr/bin/env python
# coding: utf-8

from __future__ import division, print_function, unicode_literals, \
    absolute_import

from pymatgen import Molecule
from pymatgen.io.nwchem import NwInput, NwTask

coords = [[0.000000, 0.000000, 0.000000], [0.000000, 0.000000, 1.089000],
          [1.026719, 0.000000, -0.363000], [-0.513360, -0.889165, -0.363000],
          [-0.513360, 0.889165, -0.363000]]
mol = Molecule(["C", "H", "H", "H", "H"], coords)

tasks = [
    NwTask.dft_task(mol,
                    operation="optimize",
                    xc="b3lyp",
                    basis_set="6-31++G*"),
    NwTask.dft_task(mol, operation="freq", xc="b3lyp", basis_set="6-31++G*")
]
nwi = NwInput(mol, tasks)

print(nwi)