Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
-0.0153816024 -0.0172298679 0.0000000000
0.1484742948 0.3028992171 0.0000000000
0.0000000000 0.0000000000 0.0073781116
0.0000000000 0.0000000000 -0.0450044998
0.0000000000 0.0000000000 0.0146744312
0.0000000000 0.0000000000 -0.0099324434
0.0000000000 0.0000000000 0.0041387542
0.0000000000 0.0000000000 0.0287456462
"""
ref_eth_vibonly = {
# freq from cfour after proj
'omega': qcel.Datum('', '', np.asarray([885.4386, 1073.4306, 1080.4104, 1135.9390, 1328.7166, 1467.8428, 1565.5328, 1831.6445, 3287.3173, 3312.1889, 3371.7974, 3399.4232])),
'gamma': qcel.Datum('', '', ['B2u', 'B1u', 'B2g', 'Au', 'B1g', 'Ag', 'B3u', 'Ag', 'B3u', 'Ag', 'B1g', 'B2u'], numeric=False),
'IR_intensity': qcel.Datum('', '', np.array([0.2122, 94.4517, 0.0000, 0.0000, 0.0000, 0.0000, 10.3819, 0.0000, 19.2423, 0.0000, 0.0000, 28.0922])), # [km/mol]
# from vibsuite after cfour
'mu': qcel.Datum('', '', np.asarray([1.0423, 1.1607, 1.5200, 1.0078, 1.5276, 1.2029, 1.1122, 3.2209, 1.0475, 1.0799, 1.1150, 1.1182])),
'k': qcel.Datum('', '', np.asarray([0.4814, 0.7880, 1.0454, 0.7662, 1.5890, 1.5270, 1.6060, 6.3666, 6.6695, 6.9800, 7.4688, 7.6133])),
'Qtp0': qcel.Datum('', '', np.asarray([0.3687, 0.3349, 0.3338, 0.3256, 0.3010, 0.2864, 0.2773, 0.2564, 0.1914, 0.1907, 0.1890, 0.1882])),
'DQ0': qcel.Datum('', '', np.asarray([0.2607, 0.2368, 0.2360, 0.2302, 0.2128, 0.2025, 0.1961, 0.1813, 0.1353, 0.1348, 0.1336, 0.1331])),
# q from vibsuite after cfour
'q': qcel.Datum('', '', np.asarray(
[[ 0.00000000E+00, -1.34306554E-01, 0.00000000E+00, 0.00000000E+00, -1.34306554E-01, 0.00000000E+00, -4.32765855E-01, 2.31720930E-01, 0.00000000E+00, 4.32765855E-01, 2.31720930E-01, 0.00000000E+00, 4.32765855E-01, 2.31720930E-01, 0.00000000E+00, -4.32765855E-01, 2.31720930E-01, 0.00000000E+00],
[ 0.00000000E+00, 0.00000000E+00, -2.68155030E-01, 0.00000000E+00, 0.00000000E+00, -2.68155030E-01, 0.00000000E+00, 0.00000000E+00, 4.62651532E-01, 0.00000000E+00, 0.00000000E+00, 4.62651532E-01, 0.00000000E+00, 0.00000000E+00, 4.62651532E-01, 0.00000000E+00, 0.00000000E+00, 4.62651532E-01],
[ 0.00000000E+00, 0.00000000E+00, -4.28876240E-01, 0.00000000E+00, 0.00000000E+00, 4.28876240E-01, 0.00000000E+00, 0.00000000E+00, 3.97533125E-01, 0.00000000E+00, 0.00000000E+00, 3.97533125E-01, 0.00000000E+00, 0.00000000E+00, -3.97533125E-01, 0.00000000E+00, 0.00000000E+00, -3.97533125E-01],
[ 0.00000000E+00, 0.00000000E+00, 0.00000000E+00, 0.00000000E+00, 0.00000000E+00, 0.00000000E+00, 0.00000000E+00, 0.00000000E+00, -5.00000000E-01, 0.00000000E+00, 0.00000000E+00, 5.00000000E-01, 0.00000000E+00, 0.00000000E+00, 5.00000000E-01, 0.00000000E+00, 0.00000000E+00, -5.00000000E-01],
[ 0.00000000E+00, 4.30954858E-01, 0.00000000E+00, 0.00000000E+00, -4.30954858E-01, 0.00000000E+00, 3.79464410E-01, -1.14654771E-01, 0.00000000E+00, -3.79464410E-01, -1.14654771E-01, 0.00000000E+00, 3.79464410E-01, 1.14654771E-01, 0.00000000E+00, -3.79464410E-01, 1.14654771E-01, 0.00000000E+00],
[ -2.97546697E-01, 0.00000000E+00, 0.00000000E+00, 2.97546697E-01, 0.00000000E+00, 0.00000000E+00, -4.15835441E-01, 1.81145984E-01, 0.00000000E+00, -4.15835441E-01, -1.81145984E-01, 0.00000000E+00, 4.15835441E-01, 1.81145984E-01, 0.00000000E+00, 4.15835441E-01, -1.81145984E-01, 0.00000000E+00],
[ 2.26323959E-01, 0.00000000E+00, 0.00000000E+00, 2.26323959E-01, 0.00000000E+00, 0.00000000E+00, -3.90479813E-01, 2.68168321E-01, 0.00000000E+00, -3.90479813E-01, -2.68168321E-01, 0.00000000E+00, -3.90479813E-01, -2.68168321E-01, 0.00000000E+00, -3.90479813E-01, 2.68168321E-01, 0.00000000E+00],
'E_elec' : qcel.Datum('', '', 0.00000000),
'E_trans' : qcel.Datum('', '', 0.00141628),
'E_rot' : qcel.Datum('', '', 0.00141628),
'E_vib' : qcel.Datum('', '', 0.04801283),
'E_corr' : qcel.Datum('', '', 0.05084539),
'E_tot' : qcel.Datum('', '', -39.92603216),
'H_elec' : qcel.Datum('', '', 0.00000000),
'H_trans' : qcel.Datum('', '', 0.00236046),
'H_rot' : qcel.Datum('', '', 0.00141628),
'H_vib' : qcel.Datum('', '', 0.04801283),
'H_corr' : qcel.Datum('', '', 0.05178958),
'H_tot' : qcel.Datum('', '', -39.92508798),
'G_elec' : qcel.Datum('', '', -0.00000000),
'G_trans' : qcel.Datum('', '', -0.01391819),
'G_rot' : qcel.Datum('', '', -0.00337341),
'G_vib' : qcel.Datum('', '', 0.04799343),
'G_corr' : qcel.Datum('', '', 0.03070183),
'G_tot' : qcel.Datum('', '', -39.94617572),
} # yapf: disable
assert qcdb.compare_vibinfos(ch4_hf_321g_thermoinfo, therminfo, 4, 'asdf', forgive=['omega', 'IR_intensity'])
outfiles = [input_fn]
output_fn = input_fn
as_binary = []
if input_enc == "msgpack-ext":
as_binary.append(input_fn)
if output_enc == "msgpack-ext":
as_binary.append(output_fn)
success, ret = run_psi4_cli(inputs, outfiles, cmds, as_binary=as_binary)
assert compare_integers(True, success, "Computation Status")
assert compare_integers(True, ret['stdout'] == '', "Empty stdout")
try:
parsed = True
ret = qcel.models.Result.parse_raw(ret["outfiles"][output_fn], encoding=output_enc)
except Exception as e:
parsed = False
print(e)
assert compare_integers(True, parsed, "Result Model Parsed")
assert compare_values(-76.22831410207938, ret.return_result, "Return")
'molecule': mol,
'driver': 'gradient',
'model': {
'method': inp['name']
},
'keywords': {},
}
jrec = qcng.compute(resinp, 'dftd3', raise_error=True)
jrec = jrec.dict()
assert len(jrec['extras']['qcvars']) == 8
assert compare_values(expected, jrec['extras']['qcvars']['CURRENT ENERGY'], atol=1.e-7)
assert compare_values(expected, jrec['extras']['qcvars']['DISPERSION CORRECTION ENERGY'], atol=1.e-7)
assert compare_values(expected, jrec['extras']['qcvars']['2-BODY DISPERSION CORRECTION ENERGY'], atol=1.e-7)
assert compare_values(expected, jrec['extras']['qcvars'][inp['lbl'] + ' DISPERSION CORRECTION ENERGY'], atol=1.e-7)
assert compare_values(gexpected, jrec['extras']['qcvars']['CURRENT GRADIENT'], atol=1.e-7)
assert compare_values(gexpected, jrec['extras']['qcvars']['DISPERSION CORRECTION GRADIENT'], atol=1.e-7)
assert compare_values(gexpected, jrec['extras']['qcvars']['2-BODY DISPERSION CORRECTION GRADIENT'], atol=1.e-7)
assert compare_values(
gexpected, jrec['extras']['qcvars'][inp['lbl'] + ' DISPERSION CORRECTION GRADIENT'], atol=1.e-7)
'driver': 'gradient',
'model': {
'method': inp['name']
},
'keywords': {},
}
jrec = qcng.compute(resinp, 'mp2d', raise_error=True)
jrec = jrec.dict()
#assert len(jrec['extras']['qcvars']) == 8
assert compare_values(expected, jrec['extras']['qcvars']['CURRENT ENERGY'], atol=1.e-7)
assert compare_values(expected, jrec['extras']['qcvars']['DISPERSION CORRECTION ENERGY'], atol=1.e-7)
assert compare_values(expected, jrec['extras']['qcvars'][inp['lbl'] + ' DISPERSION CORRECTION ENERGY'], atol=1.e-7)
assert compare_values(gexpected, jrec['extras']['qcvars']['CURRENT GRADIENT'], atol=1.e-7)
assert compare_values(gexpected, jrec['extras']['qcvars']['DISPERSION CORRECTION GRADIENT'], atol=1.e-7)
assert compare_values(
gexpected, jrec['extras']['qcvars'][inp['lbl'] + ' DISPERSION CORRECTION GRADIENT'], atol=1.e-7)
eneyne.update_geometry()
E, jrec = qcdb.energy('d3-b3lyp-d2', return_wfn=True)
assert compare_values(ref['eneyne']['B3LYP-D2']['dimer'], E, 7, 'P: Ethene-Ethyne -D2')
assert compare_values(ref['eneyne']['B3LYP-D2']['dimer'], jrec['qcvars']['DISPERSION CORRECTION ENERGY'].data, 7,
tnm())
assert compare_values(ref['eneyne']['B3LYP-D2']['dimer'],
jrec['qcvars']['B3LYP-D2 DISPERSION CORRECTION ENERGY'].data, 7, tnm())
mA = eneyne.extract_subsets(1)
E, jrec = qcdb.energy('d3-b3lyp-d3bj', return_wfn=True, molecule=mA)
assert compare_values(ref['eneyne']['B3LYP-D3(BJ)']['mA'], E, 7, tnm())
assert compare_values(ref['eneyne']['B3LYP-D3(BJ)']['mA'], jrec['qcvars']['DISPERSION CORRECTION ENERGY'].data, 7,
tnm())
assert compare_values(ref['eneyne']['B3LYP-D3(BJ)']['mA'],
jrec['qcvars']['B3LYP-D3(BJ) DISPERSION CORRECTION ENERGY'].data, 7, tnm())
def test_qcdb__energy_d3():
eneyne = qcdb.set_molecule(seneyne)
eneyne.update_geometry()
E, jrec = qcdb.energy('d3-b3lyp-d2', return_wfn=True)
assert compare_values(ref['eneyne']['B3LYP-D2']['dimer'], E, 7, 'P: Ethene-Ethyne -D2')
assert compare_values(ref['eneyne']['B3LYP-D2']['dimer'], jrec['qcvars']['DISPERSION CORRECTION ENERGY'].data, 7,
tnm())
assert compare_values(ref['eneyne']['B3LYP-D2']['dimer'],
jrec['qcvars']['B3LYP-D2 DISPERSION CORRECTION ENERGY'].data, 7, tnm())
mA = eneyne.extract_subsets(1)
E, jrec = qcdb.energy('d3-b3lyp-d3bj', return_wfn=True, molecule=mA)
assert compare_values(ref['eneyne']['B3LYP-D3(BJ)']['mA'], E, 7, tnm())
assert compare_values(ref['eneyne']['B3LYP-D3(BJ)']['mA'], jrec['qcvars']['DISPERSION CORRECTION ENERGY'].data, 7,
tnm())
assert compare_values(ref['eneyne']['B3LYP-D3(BJ)']['mA'],
jrec['qcvars']['B3LYP-D3(BJ) DISPERSION CORRECTION ENERGY'].data, 7, tnm())
p4mol = qcel.models.Molecule.from_data(p4_hooh_xyz)
c4mol = qcel.models.Molecule.from_data(c4_hooh_xyz)
aqmol, data = p4mol.align(c4mol, atoms_map=False, mols_align=True, verbose=4)
mill = data["mill"]
assert compare([0, 3, 1, 2], mill.atommap)
p2cgeom = mill.align_coordinates(p4mol.geometry)
assert compare_values(c4mol.geometry, p2cgeom, atol=1.0e-6)
p2c_dipder_x, p2c_dipder_y, p2c_dipder_z = mill.align_vector_gradient(p4_hooh_dipder)
assert compare_values(c4_hooh_dipder_x, p2c_dipder_x, atol=1.0e-5)
assert compare_values(c4_hooh_dipder_y, p2c_dipder_y, atol=1.0e-5)
assert compare_values(c4_hooh_dipder_z, p2c_dipder_z, atol=1.0e-5)
resinp = {
'schema_name': 'qcschema_input',
'schema_version': 1,
'molecule': mol,
'driver': 'gradient',
'model': {
'method': inp['name']
},
'keywords': {},
}
jrec = qcng.compute(resinp, 'dftd3', raise_error=True)
jrec = jrec.dict()
assert len(jrec['extras']['qcvars']) == 8
assert compare_values(expected, jrec['extras']['qcvars']['CURRENT ENERGY'], atol=1.e-7)
assert compare_values(expected, jrec['extras']['qcvars']['DISPERSION CORRECTION ENERGY'], atol=1.e-7)
assert compare_values(expected, jrec['extras']['qcvars']['3-BODY DISPERSION CORRECTION ENERGY'], atol=1.e-7)
assert compare_values(
expected, jrec['extras']['qcvars']['AXILROD-TELLER-MUTO 3-BODY DISPERSION CORRECTION ENERGY'], atol=1.e-7)
assert compare_values(gexpected, jrec['extras']['qcvars']['CURRENT GRADIENT'], atol=1.e-7)
assert compare_values(gexpected, jrec['extras']['qcvars']['DISPERSION CORRECTION GRADIENT'], atol=1.e-7)
assert compare_values(gexpected, jrec['extras']['qcvars']['3-BODY DISPERSION CORRECTION GRADIENT'], atol=1.e-7)
assert compare_values(
gexpected, jrec['extras']['qcvars']['AXILROD-TELLER-MUTO 3-BODY DISPERSION CORRECTION GRADIENT'], atol=1.e-7)
def test_kabsch_identity():
oco10 = qcel.molparse.from_string(soco10)
oco12 = qcel.molparse.from_string(soco10)
oco10_geom_au = oco10["qm"]["geom"].reshape((-1, 3)) / qcel.constants.bohr2angstroms
oco12_geom_au = oco12["qm"]["geom"].reshape((-1, 3)) / qcel.constants.bohr2angstroms
rmsd, rot, shift = qcel.molutil.kabsch_align(oco10_geom_au, oco12_geom_au)
assert compare_values(0.0, rmsd, "identical")
assert compare_values(np.identity(3), rot, "identity rotation matrix")
assert compare_values(np.zeros(3), shift, "identical COM")