Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_3():
sys = qcel.molparse.from_string(eneyne)['qm']
res = intf_dftd3.run_dftd3_from_arrays(molrec=sys, name_hint='b3lyp', level_hint='d3bj')
assert compare_strings('B3LYP-D3(BJ)', compute_key(res['options']), 'key')
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")
C 0.0 0.0 0.0
O -1.0 0.0 0.0
units ang
"""
sooc12 = """
O 1.2 4.0 0.0
O -1.2 4.0 0.0
C 0.0 4.0 0.0
units ang
"""
ref_rmsd = math.sqrt(2. * 0.2 * 0.2 / 3.) # RMSD always in Angstroms
oco10 = qcel.molparse.from_string(soco10)
oco12 = qcel.molparse.from_string(sooc12)
oco10_geom_au = oco10['qm']['geom'].reshape((-1, 3)) / qcel.constants.bohr2angstroms
oco12_geom_au = oco12['qm']['geom'].reshape((-1, 3)) / qcel.constants.bohr2angstroms
with pytest.warns(FutureWarning) as err:
rmsd, mill = qcdb.align.B787(
oco10_geom_au, oco12_geom_au, np.array(['O', 'C', 'O']), np.array(['O', 'O', 'C']), verbose=4, do_plot=False)
assert compare_values(ref_rmsd, rmsd, 6, 'known rmsd B787')
def eneyne_ne_qcschemamols():
eneyne = qcel.molparse.to_schema(qcel.molparse.from_string(seneyne)['qm'], dtype=2)
mA = qcel.molparse.to_schema(qcel.molparse.from_string('\n'.join(seneyne.splitlines()[:7]))['qm'], dtype=2)
mB = qcel.molparse.to_schema(qcel.molparse.from_string('\n'.join(seneyne.splitlines()[-4:]))['qm'], dtype=2)
ne = qcel.molparse.to_schema(qcel.molparse.from_string(sne)['qm'], dtype=2)
mAgB = qcel.molparse.from_string(seneyne)['qm']
mAgB['real'] = [(iat < mAgB['fragment_separators'][0])
for iat in range(len(mAgB['elem']))] # works b/c chgmult doesn't need refiguring
mAgB = qcel.molparse.to_schema(mAgB, dtype=2)
gAmB = qcel.molparse.from_string(seneyne)['qm']
gAmB['real'] = [(iat >= gAmB['fragment_separators'][0]) for iat in range(len(gAmB['elem']))]
gAmB = qcel.molparse.to_schema(gAmB, dtype=2)
mols = {
'eneyne': {
'dimer': eneyne,
'mA': mA,
'mB': mB,
'mAgB': mAgB,
'gAmB': gAmB,
},
'ne': {
'atom': ne,
}
}
return mols
def test_b787():
oco10 = qcel.molparse.from_string(soco10)
oco12 = qcel.molparse.from_string(sooc12)
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, mill = qcel.molutil.B787(
oco10_geom_au,
oco12_geom_au,
np.array(["O", "C", "O"]),
np.array(["O", "O", "C"]),
algorithm="permutative",
verbose=4,
do_plot=False,
)
assert compare_values(ref_rmsd, rmsd, "known rmsd B787", atol=1.0e-6)
def molecule_from_string(cls,
molstr,
dtype=None,
name=None,
fix_com=None,
fix_orientation=None,
fix_symmetry=None,
return_dict=False,
enable_qm=True,
enable_efp=True,
missing_enabled_return_qm='none',
missing_enabled_return_efp='none',
verbose=1):
molrec = qcel.molparse.from_string(
molstr=molstr,
dtype=dtype,
name=name,
fix_com=fix_com,
fix_orientation=fix_orientation,
fix_symmetry=fix_symmetry,
return_processed=False,
enable_qm=enable_qm,
enable_efp=enable_efp,
missing_enabled_return_qm=missing_enabled_return_qm,
missing_enabled_return_efp=missing_enabled_return_efp,
verbose=verbose)
if return_dict:
return core.Molecule.from_dict(molrec['qm']), molrec
else:
return core.Molecule.from_dict(molrec['qm'])