当前位置: 首页>>代码示例>>Python>>正文


Python inputs.QCInput类代码示例

本文整理汇总了Python中pymatgen.io.qchem.inputs.QCInput的典型用法代码示例。如果您正苦于以下问题:Python QCInput类的具体用法?Python QCInput怎么用?Python QCInput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QCInput类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _verify_inputs

    def _verify_inputs(self):
        user_qin = QCInput.from_file(os.path.join(os.getcwd(), "mol.qin"))

        # Check mol.qin
        ref_qin = QCInput.from_file(os.path.join(self["ref_dir"], "mol.qin"))
        np.testing.assert_equal(ref_qin.molecule.species,
                                user_qin.molecule.species)
        np.testing.assert_allclose(
            ref_qin.molecule.cart_coords,
            user_qin.molecule.cart_coords,
            atol=0.0001)
        for key in ref_qin.rem:
            if user_qin.rem.get(key) != ref_qin.rem.get(key):
                raise ValueError("Rem key {} is inconsistent!".format(key))
        if ref_qin.opt is not None:
            for key in ref_qin.opt:
                if user_qin.opt.get(key) != ref_qin.opt.get(key):
                    raise ValueError("Opt key {} is inconsistent!".format(key))
        if ref_qin.pcm is not None:
            for key in ref_qin.pcm:
                if user_qin.pcm.get(key) != ref_qin.pcm.get(key):
                    raise ValueError("PCM key {} is inconsistent!".format(key))
        if ref_qin.solvent is not None:
            for key in ref_qin.solvent:
                if user_qin.solvent.get(key) != ref_qin.solvent.get(key):
                    raise ValueError(
                        "Solvent key {} is inconsistent!".format(key))

        logger.info("RunQChemFake: verified input successfully")
开发者ID:montoyjh,项目名称:MatMethods,代码行数:29,代码来源:run_calc.py

示例2: test_write_file_from_OptSet

 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"))
开发者ID:albalu,项目名称:pymatgen,代码行数:11,代码来源:test_inputs.py

示例3: test_pcm_init

 def test_pcm_init(self):
     test_molecule = QCInput.from_file(
         os.path.join(test_dir, "new_qchem_files/pcm.qin")).molecule
     test_SPSet = SinglePointSet(
         molecule=test_molecule, pcm_dielectric=10.0)
     self.assertEqual(
         test_SPSet.rem, {
             'job_type': 'sp',
             'gen_scfman': 'true',
             'basis': '6-311++g*',
             'max_scf_cycles': 200,
             'method': 'wb97xd',
             'scf_algorithm': 'gdm',
             'solvent_method': 'pcm'
         })
     self.assertEqual(
         test_SPSet.pcm, {
             'heavypoints': '194',
             'hpoints': '194',
             'radii': 'uff',
             'theory': 'cpcm',
             'vdwscale': '1.1'
         })
     self.assertEqual(test_SPSet.solvent, {'dielectric': 10.0})
     self.assertEqual(test_SPSet.molecule, test_molecule)
开发者ID:albalu,项目名称:pymatgen,代码行数:25,代码来源:test_sets.py

示例4: test_full_init

 def test_full_init(self):
     test_molecule = QCInput.from_file(
         os.path.join(test_dir, "new_qchem_files/pcm.qin")).molecule
     test_DictSet = QChemDictSet(
         molecule=test_molecule,
         job_type='opt',
         basis_set='6-31g*',
         scf_algorithm='diis',
         dft_rung=1,
         pcm_dielectric=10.0,
         max_scf_cycles=35)
     self.assertEqual(
         test_DictSet.rem, {
             'job_type': 'opt',
             'gen_scfman': 'true',
             'basis': '6-31g*',
             'max_scf_cycles': 35,
             'exchange': 'b3lyp',
             'geom_opt_max_cycles': 200,
             'scf_algorithm': 'diis',
             'solvent_method': 'pcm'
         })
     self.assertEqual(
         test_DictSet.pcm, {
             'heavypoints': '194',
             'hpoints': '194',
             'radii': 'uff',
             'theory': 'cpcm',
             'vdwscale': '1.1'
         })
     self.assertEqual(test_DictSet.solvent, {'dielectric': 10.0})
     self.assertEqual(test_DictSet.molecule, test_molecule)
开发者ID:albalu,项目名称:pymatgen,代码行数:32,代码来源:test_sets.py

示例5: test_smx_template

    def test_smx_template(self):
        smx_params = {"solvent": "water"}
        smx_test = QCInput.smx_template(smx_params)
        smx_actual = """$smx
   solvent water
$end"""
        self.assertEqual(smx_actual, smx_test)
开发者ID:ExpHP,项目名称:pymatgen,代码行数:7,代码来源:test_inputs.py

示例6: test_solvent_template

    def test_solvent_template(self):
        solvent_params = {"dielectric": "5.0"}
        solvent_test = QCInput.solvent_template(solvent_params)
        solvent_actual = """$solvent
   dielectric 5.0
$end"""
        self.assertEqual(solvent_actual, solvent_test)
开发者ID:albalu,项目名称:pymatgen,代码行数:7,代码来源:test_inputs.py

示例7: test_pcm_template

    def test_pcm_template(self):
        pcm_params = {"theory": "cpcm"}
        pcm_test = QCInput.pcm_template(pcm_params)
        pcm_actual = """$pcm
   theory cpcm
$end"""
        self.assertEqual(pcm_actual, pcm_test)
开发者ID:albalu,项目名称:pymatgen,代码行数:7,代码来源:test_inputs.py

示例8: test_read_negative

    def test_read_negative(self):
        str_molecule = """$molecule
 -1 1
 S     -1.1516880000      0.8568110000     -0.0787470000
 S      1.1527500000     -0.8580450000     -0.0786430000
 O     -1.6523520000      1.8607750000     -1.0252100000
 O     -0.9052880000      1.2448490000      1.3156410000
 O      0.9072410000     -1.2461780000      1.3158760000
 O      1.6543670000     -1.8616640000     -1.0249090000
 C     -2.5841130000     -0.3746500000      0.0297340000
 C      2.5833220000      0.3755850000      0.0296900000
 F     -3.6480730000      0.2204040000      0.6112110000
 F     -2.2609850000     -1.4531020000      0.7616580000
 F     -2.9656640000     -0.7966010000     -1.1900330000
 F      3.6467050000     -0.2152590000      0.6163310000
 F      2.2560700000      1.4560310000      0.7568190000
 F      2.9672080000      0.7933560000     -1.1908790000
 N     -0.0001900000     -0.0016540000     -0.8250640000
$end

$rem
   job_type = opt
   basis = 6-311++g*
   max_scf_cycles = 200
   gen_scfman = true
   scf_algorithm = diis
   method = wb97xd
   geom_opt_max_cycles = 200
$end
"""
        qcinp = QCInput.from_string(str_molecule)
        self.assertEqual(str_molecule,str(qcinp))
开发者ID:albalu,项目名称:pymatgen,代码行数:32,代码来源:test_inputs.py

示例9: test_double_FF_opt

    def test_double_FF_opt(self):
        # location of test files
        test_double_FF_files = os.path.join(module_dir, "..", "..",
                                            "test_files", "double_FF_wf")
        # define starting molecule and workflow object
        initial_qcin = QCInput.from_file(
            os.path.join(test_double_FF_files, "block", "launcher_first",
                         "mol.qin.opt_0"))
        initial_mol = initial_qcin.molecule

        real_wf = get_wf_double_FF_opt(
            molecule=initial_mol,
            pcm_dielectric=10.0,
            qchem_input_params={
                "basis_set": "6-311++g**",
                "scf_algorithm": "diis",
                "overwrite_inputs": {
                    "rem": {
                        "sym_ignore": "true"
                    }
                }
            })
        # use powerup to replace run with fake run
        ref_dirs = {
            "first_FF_no_pcm":
            os.path.join(test_double_FF_files, "block", "launcher_first"),
            "second_FF_with_pcm":
            os.path.join(test_double_FF_files, "block", "launcher_second")
        }
        fake_wf = use_fake_qchem(real_wf, ref_dirs)
        self.lp.add_wf(fake_wf)
        rapidfire(
            self.lp,
            fworker=FWorker(env={"max_cores": 32, "db_file": os.path.join(db_dir, "db.json")}))

        wf_test = self.lp.get_wf_by_fw_id(1)
        self.assertTrue(
            all([s == "COMPLETED" for s in wf_test.fw_states.values()]))

        first_FF = self.get_task_collection().find_one({
            "task_label":
            "first_FF_no_pcm"
        })
        self.assertEqual(first_FF["calcs_reversed"][0]["input"]["solvent"],
                         None)
        self.assertEqual(first_FF["num_frequencies_flattened"], 1)
        first_FF_final_mol = Molecule.from_dict(
            first_FF["output"]["optimized_molecule"])

        second_FF = self.get_task_collection().find_one({
            "task_label":
            "second_FF_with_pcm"
        })
        self.assertEqual(second_FF["calcs_reversed"][0]["input"]["solvent"],
                         {"dielectric": "10.0"})
        self.assertEqual(second_FF["num_frequencies_flattened"], 1)
        second_FF_initial_mol = Molecule.from_dict(
            second_FF["input"]["initial_molecule"])

        self.assertEqual(first_FF_final_mol, second_FF_initial_mol)
开发者ID:montoyjh,项目名称:MatMethods,代码行数:60,代码来源:test_double_FF_opt.py

示例10: test_read_opt

    def test_read_opt(self):
        str_opt = """$opt
CONSTRAINT
  tors 2 3 4 5 25.0
   bend 2 1 4 110.0
ENDCONSTRAINT

FIXED
x y 2 4 5
ENDFIXED

DUMMY
   M 2 3 4 5
ENDDUMMY

CONNECT
4 3 2 3 5 6
ENDCONNECT
$end"""
        opt_test = QCInput.read_opt(str_opt)
        opt_actual = {
            "CONSTRAINT": ["tors 2 3 4 5 25.0", "bend 2 1 4 110.0"],
            "FIXED": ["x y 2 4 5"],
            "DUMMY": ["M 2 3 4 5"],
            "CONNECT": ["4 3 2 3 5 6"]
        }
        self.assertDictEqual(opt_actual, opt_test)
开发者ID:albalu,项目名称:pymatgen,代码行数:27,代码来源:test_inputs.py

示例11: test_read_only_rem

    def test_read_only_rem(self):
        str_rem = """Trying to break you!

$rem
   job_type  opt
  method  wb97m-v
   basis  def2-qzvppd
   max_scf_cycles  300
  gen_scfman = true
$end

$pcm
heavypoints   194
hpoints   194
radii   uff
theory   cpcm
vdwscale   1.1
$end


$solvent
dielectric   10.0
$end


"""
        rem_test = QCInput.read_rem(str_rem)
        rem_actual = {
            "job_type": "opt",
            "method": "wb97m-v",
            "basis": "def2-qzvppd",
            "max_scf_cycles": "300",
            "gen_scfman": "true"
        }
        self.assertDictEqual(rem_actual, rem_test)
开发者ID:albalu,项目名称:pymatgen,代码行数:35,代码来源:test_inputs.py

示例12: test_read_bad_solvent

    def test_read_bad_solvent(self):
        str_solvent = """Once again, I'm trying to break you!

$solvent
   dielectric = 5.0
$end"""
        solvent_test = QCInput.read_solvent(str_solvent)
        solvent_actual = {}
        self.assertDictEqual(solvent_actual, solvent_test)
开发者ID:albalu,项目名称:pymatgen,代码行数:9,代码来源:test_inputs.py

示例13: test_read_bad_smx

    def test_read_bad_smx(self):
        str_smx = """Once again, I'm trying to break you!

$solvent
   solvent = water
$end"""
        smx_test = QCInput.read_smx(str_smx)
        smx_actual = {}
        self.assertDictEqual(smx_actual, smx_test)
开发者ID:ExpHP,项目名称:pymatgen,代码行数:9,代码来源:test_inputs.py

示例14: test_from_multi_jobs_file

    def test_from_multi_jobs_file(self):
        job_list_test = QCInput.from_multi_jobs_file(
            os.path.join(test_dir, "pt_n2_wb97mv_0.0.in"))
        species = ["S", "C", "H", "C", "H", "C", "H",
                   "C", "C", "C", "H", "C", "H", "C", "H", "S"]
        coords = [[-0.00250959, -0.05817469, -0.02921636],
                  [1.70755408, -0.03033788, -0.01382912],
                  [2.24317221, -0.05215019, 0.92026728],
                  [2.21976393, 0.01718014, -1.27293235],
                  [3.27786220, 0.04082146, -1.48539646],
                  [1.20867399, 0.04478540, -2.27007793],
                  [1.40292257, 0.10591684, -3.33110912],
                  [-0.05341046, 0.01577217, -1.74839343],
                  [-1.32843436, 0.03545064, -2.45531187],
                  [-1.55195156, 0.08743920, -3.80184635],
                  [-0.75245172, 0.10267657, -4.52817967],
                  [-2.93293778, 0.08408786, -4.13352169],
                  [-3.31125108, 0.11340328, -5.14405819],
                  [-3.73173288, 0.02741365, -3.03412864],
                  [-4.80776535, 0.00535688, -2.99564645],
                  [-2.81590978, -0.00516172, -1.58990580]]
        molecule_1_actual = Molecule(species, coords)
        rem_1_actual = {
            "job_type": "opt",
            "method": "wb97m-v",
            "basis": "def2-tzvppd",
            "gen_scfman": "true",
            "geom_opt_max_cycles": "75",
            "max_scf_cycles": "300",
            "scf_algorithm": "diis",
            "scf_guess": "sad",
            "sym_ignore": "true",
            "symmetry": "false",
            "thresh": "14"
        }
        opt_1_actual = {"CONSTRAINT": ["tors 6 8 9 10 0.0"]}
        self.assertEqual(molecule_1_actual, job_list_test[0].molecule)
        self.assertEqual(rem_1_actual, job_list_test[0].rem)
        self.assertEqual(opt_1_actual, job_list_test[0].opt)

        molecule_2_actual = "read"
        rem_2_actual = {
            "job_type": "sp",
            "method": "wb97m-v",
            "basis": "def2-tzvppd",
            "gen_scfman": "true",
            "geom_opt_max_cycles": "75",
            "max_scf_cycles": "300",
            "scf_algorithm": "diis",
            "scf_guess": "read",
            "sym_ignore": "true",
            "symmetry": "false",
            "thresh": "14"
        }
        self.assertEqual(molecule_2_actual, job_list_test[1].molecule)
        self.assertEqual(rem_2_actual, job_list_test[1].rem)
开发者ID:albalu,项目名称:pymatgen,代码行数:56,代码来源:test_inputs.py

示例15: test_OptFF

 def test_OptFF(self):
     myjob = QCJob.opt_with_frequency_flattener(qchem_command="qchem", max_cores=32, input_file="test.qin", output_file="test.qout")
     expected_next = QCJob(
                     qchem_command="qchem",
                     max_cores=32,
                     multimode="openmp",
                     input_file="test.qin",
                     output_file="test.qout",
                     suffix=".opt_0",
                     backup=True).as_dict()
     self.assertEqual(next(myjob).as_dict(),expected_next)
     expected_next = QCJob(
                     qchem_command="qchem",
                     max_cores=32,
                     multimode="openmp",
                     input_file="test.qin",
                     output_file="test.qout",
                     suffix=".freq_0",
                     backup=False).as_dict()
     self.assertEqual(next(myjob).as_dict(),expected_next)
     self.assertEqual(QCInput.from_file(os.path.join(test_dir,"FF_working/test.qin.freq_0")).as_dict(),QCInput.from_file(os.path.join(scr_dir,"test.qin")).as_dict())
     expected_next = QCJob(
                     qchem_command="qchem",
                     max_cores=32,
                     multimode="openmp",
                     input_file="test.qin",
                     output_file="test.qout",
                     suffix=".opt_1",
                     backup=False).as_dict()
     self.assertEqual(next(myjob).as_dict(),expected_next)
     self.assertEqual(QCInput.from_file(os.path.join(test_dir,"FF_working/test.qin.opt_1")).as_dict(),QCInput.from_file(os.path.join(scr_dir,"test.qin")).as_dict())
     expected_next = QCJob(
                     qchem_command="qchem",
                     max_cores=32,
                     multimode="openmp",
                     input_file="test.qin",
                     output_file="test.qout",
                     suffix=".freq_1",
                     backup=False).as_dict()
     self.assertEqual(next(myjob).as_dict(),expected_next)
     self.assertEqual(QCInput.from_file(os.path.join(test_dir,"FF_working/test.qin.freq_1")).as_dict(),QCInput.from_file(os.path.join(scr_dir,"test.qin")).as_dict())
     self.assertRaises(StopIteration,myjob.__next__)
开发者ID:materialsproject,项目名称:custodian,代码行数:42,代码来源:test_jobs.py


注:本文中的pymatgen.io.qchem.inputs.QCInput类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。