本文整理匯總了Python中pymatgen.io.qchem.inputs.QCInput.from_string方法的典型用法代碼示例。如果您正苦於以下問題:Python QCInput.from_string方法的具體用法?Python QCInput.from_string怎麽用?Python QCInput.from_string使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pymatgen.io.qchem.inputs.QCInput
的用法示例。
在下文中一共展示了QCInput.from_string方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_read_negative
# 需要導入模塊: from pymatgen.io.qchem.inputs import QCInput [as 別名]
# 或者: from pymatgen.io.qchem.inputs.QCInput import from_string [as 別名]
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))
示例2: test_from_string
# 需要導入模塊: from pymatgen.io.qchem.inputs import QCInput [as 別名]
# 或者: from pymatgen.io.qchem.inputs.QCInput import from_string [as 別名]
def test_from_string(self):
string = """$molecule
0 1
S -0.00250959 -0.05817469 -0.02921636
C 1.70755408 -0.03033788 -0.01382912
H 2.24317221 -0.05215019 0.92026728
C 2.21976393 0.01718014 -1.27293235
H 3.27786220 0.04082146 -1.48539646
C 1.20867399 0.04478540 -2.27007793
H 1.40292257 0.10591684 -3.33110912
C -0.05341046 0.01577217 -1.74839343
C -1.32843436 0.03545064 -2.45531187
C -1.55195156 0.08743920 -3.80184635
H -0.75245172 0.10267657 -4.52817967
C -2.93293778 0.08408786 -4.13352169
H -3.31125108 0.11340328 -5.14405819
C -3.73173288 0.02741365 -3.03412864
H -4.80776535 0.00535688 -2.99564645
S -2.81590978 -0.00516172 -1.58990580
$end
$rem
jobtype = 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
$end
$opt
CONSTRAINT
tors 6 8 9 10 0.0
ENDCONSTRAINT
$end
"""
qcinput_test = QCInput.from_string(string)
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_actual = Molecule(species, coords)
self.assertEqual(molecule_actual, qcinput_test.molecule)
rem_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"
}
self.assertDictEqual(rem_actual, qcinput_test.rem)
opt_actual = {"CONSTRAINT": ["tors 6 8 9 10 0.0"]}
self.assertDictEqual(opt_actual, qcinput_test.opt)