コード例 #1
0
ファイル: test_inputs.py プロジェクト: albalu/pymatgen
 def test_write_file_from_OptSet(self):
     from pymatgen.io.qchem.sets import OptSet
     odd_dict = loadfn(os.path.join(os.path.dirname(__file__), "odd.json"))
     odd_mol = odd_dict["spec"]["_tasks"][0]["molecule"]
     qcinp = OptSet(odd_mol)
     qcinp.write_file(os.path.join(os.path.dirname(__file__), "test.qin"))
     test_dict = QCInput.from_file(os.path.join(os.path.dirname(__file__), "test.qin")).as_dict()
     test_ref_dict = QCInput.from_file(os.path.join(os.path.dirname(__file__), "test_ref.qin")).as_dict()
     for key in test_dict:
         self.assertEqual(test_dict[key], test_ref_dict[key])
     os.remove(os.path.join(os.path.dirname(__file__), "test.qin"))
コード例 #2
0
ファイル: test_inputs.py プロジェクト: zooks97/pymatgen
    def test_write_file_from_OptSet(self):
        from pymatgen.io.qchem.sets import OptSet

        odd_dict = loadfn(os.path.join(os.path.dirname(__file__), "odd.json"))
        odd_mol = odd_dict["spec"]["_tasks"][0]["molecule"]
        qcinp = OptSet(odd_mol)
        qcinp.write_file(os.path.join(os.path.dirname(__file__), "test.qin"))
        test_dict = QCInput.from_file(os.path.join(os.path.dirname(__file__), "test.qin")).as_dict()
        test_ref_dict = QCInput.from_file(os.path.join(os.path.dirname(__file__), "test_ref.qin")).as_dict()
        for key in test_dict:
            self.assertEqual(test_dict[key], test_ref_dict[key])
        os.remove(os.path.join(os.path.dirname(__file__), "test.qin"))
コード例 #3
0
ファイル: test_sets.py プロジェクト: CompRhys/pymatgen
 def test_pcm_init(self):
     test_molecule = QCInput.from_file(os.path.join(test_dir, "new_qchem_files/pcm.qin")).molecule
     test_OptSet = OptSet(molecule=test_molecule, pcm_dielectric=10.0)
     self.assertEqual(
         test_OptSet.rem,
         {
             "job_type": "opt",
             "gen_scfman": "true",
             "basis": "def2-tzvppd",
             "max_scf_cycles": "200",
             "method": "wb97xd",
             "geom_opt_max_cycles": "200",
             "scf_algorithm": "diis",
             "xc_grid": "3",
             "solvent_method": "pcm",
             "symmetry": "false",
             "sym_ignore": "true",
             "resp_charges": "true",
         },
     )
     self.assertEqual(
         test_OptSet.pcm,
         {
             "heavypoints": "194",
             "hpoints": "194",
             "radii": "uff",
             "theory": "cpcm",
             "vdwscale": "1.1",
         },
     )
     self.assertEqual(test_OptSet.solvent, {"dielectric": 10.0})
     self.assertEqual(test_OptSet.molecule, test_molecule)
コード例 #4
0
ファイル: test_sets.py プロジェクト: CompRhys/pymatgen
 def test_overwrite_input(self):
     test_molecule = QCInput.from_file(os.path.join(test_dir, "new_qchem_files/pcm.qin")).molecule
     overwrite_inputs = {
         "rem": {
             "method": "b3lyp",
             "basis": "6-31g*",
             "thresh": 10,
             "xc_grid": "000150000302",
         }
     }
     test_OptSet = OptSet(molecule=test_molecule, overwrite_inputs=overwrite_inputs)
     act_rem = {
         "job_type": "opt",
         "gen_scfman": "true",
         "basis": "6-31g*",
         "max_scf_cycles": "200",
         "method": "b3lyp",
         "scf_algorithm": "diis",
         "xc_grid": "000150000302",
         "geom_opt_max_cycles": "200",
         "thresh": 10,
         "symmetry": "false",
         "sym_ignore": "true",
         "resp_charges": "true",
     }
     self.assertDictEqual(act_rem, test_OptSet.rem)
コード例 #5
0
ファイル: test_sets.py プロジェクト: janosh/pymatgen
 def test_nbo_init(self):
     test_molecule = QCInput.from_file(
         os.path.join(test_dir, "new_qchem_files/pcm.qin")).molecule
     test_OptSet = OptSet(molecule=test_molecule, nbo_params={})
     self.assertEqual(
         test_OptSet.rem,
         {
             "job_type": "opt",
             "gen_scfman": "true",
             "geom_opt_max_cycles": "200",
             "basis": "def2-tzvppd",
             "max_scf_cycles": "100",
             "method": "wb97xd",
             "scf_algorithm": "diis",
             "xc_grid": "3",
             "thresh": "14",
             "s2thresh": "16",
             "symmetry": "false",
             "sym_ignore": "true",
             "resp_charges": "true",
             "nbo": "true",
         },
     )
     self.assertEqual(test_OptSet.nbo, {})
     self.assertEqual(test_OptSet.molecule, test_molecule)
コード例 #6
0
    def test_write_file_from_OptSet_with_vdw(self):
        from pymatgen.io.qchem.sets import OptSet

        odd_dict = loadfn(os.path.join(os.path.dirname(__file__), "odd.json"))
        odd_mol = odd_dict["spec"]["_tasks"][0]["molecule"]
        qcinp = OptSet(odd_mol, overwrite_inputs={"van_der_waals": {"16": 3.14159}})
        qcinp.write_file(os.path.join(os.path.dirname(__file__), "test_vdw.qin"))
        test_file = open(os.path.join(os.path.dirname(__file__), "test_vdw.qin"))
        ref_file = open(os.path.join(os.path.dirname(__file__), "test_ref_vdw.qin"))

        for l_test, l_ref in zip(test_file, ref_file):
            # By default, if this statement fails the offending line will be printed
            assert l_test == l_ref

        test_file.close()
        ref_file.close()
        os.remove(os.path.join(os.path.dirname(__file__), "test_vdw.qin"))
コード例 #7
0
ファイル: test_sets.py プロジェクト: janosh/pymatgen
 def test_overwrite_opt_input(self):
     test_molecule = QCInput.from_file(
         os.path.join(test_dir, "new_qchem_files/pcm.qin")).molecule
     overwrite_inputs = {"opt": {"FIXED": ["1 XYZ", "2 XY"]}}
     test_OptSet = OptSet(molecule=test_molecule,
                          overwrite_inputs=overwrite_inputs)
     act_opt = {"fixed": ["1 XYZ", "2 XY"]}
     self.assertDictEqual(act_opt, test_OptSet.opt)
コード例 #8
0
ファイル: utils.py プロジェクト: Qi-max/Moltherm
def generate_opt_input(molfile,
                       qinfile,
                       basis_set="6-311++G*",
                       pcm_dielectric=None,
                       overwrite_inputs=None):
    """
    Generates a QChem input file from Molecule after conformer search.

    :param molfile: Absolute path to the input file (.mol, .sdf, etc.)
    :param qinfile: Absolute path to the output file (.in)
    :param basis_set: To overwrite default basis.
    :param pcm_dielectric: To use solvent
    :param overwrite_inputs: To overwrite any set defaults
    :return:

    """
    mol = get_molecule(molfile)

    qcinput = OptSet(mol,
                     basis_set=basis_set,
                     pcm_dielectric=pcm_dielectric,
                     overwrite_inputs=overwrite_inputs)

    qcinput.write_file(qinfile)
コード例 #9
0
ファイル: test_sets.py プロジェクト: CompRhys/pymatgen
 def test_smd_init(self):
     test_molecule = QCInput.from_file(os.path.join(test_dir, "new_qchem_files/pcm.qin")).molecule
     test_OptSet = OptSet(molecule=test_molecule, smd_solvent="water")
     self.assertEqual(
         test_OptSet.rem,
         {
             "job_type": "opt",
             "gen_scfman": "true",
             "basis": "def2-tzvppd",
             "max_scf_cycles": "200",
             "method": "wb97xd",
             "geom_opt_max_cycles": "200",
             "scf_algorithm": "diis",
             "xc_grid": "3",
             "solvent_method": "smd",
             "ideriv": "1",
             "symmetry": "false",
             "sym_ignore": "true",
             "resp_charges": "true",
         },
     )
     self.assertEqual(test_OptSet.smx, {"solvent": "water"})
     self.assertEqual(test_OptSet.molecule, test_molecule)