def test_condense_linear_from_file_fmr_h_ch4_fchk(): # expected populations of CH4 computed with HORTON with path('chemtools.data', 'ch4_uhf_ccpvdz.fchk') as fname: model1 = CondensedConceptualDFT.from_file(fname, "linear", "FMR", "h") model2 = CondensedConceptualDFT.from_file([fname], "linear", "FMR", "h") mol = Molecule.from_file(fname) grid = MolecularGrid.from_molecule(mol, specs='insane', rotate=False) model3 = CondensedConceptualDFT.from_file(fname, "linear", "FMR", "h", grid=grid) model4 = CondensedConceptualDFT.from_file([fname], "linear", "FMR", "h", grid=grid) expected = np.array( [6.11301651, 0.97175462, 0.97175263, 0.9717521, 0.97174353]) # check using fname given as a string check_condensed_reactivity(model1, "linear", expected, None, None, 10, 0.736396) # check using fname given as a list check_condensed_reactivity(model2, "linear", expected, None, None, 10, 0.736396) # check using fname as a string & passing grid check_condensed_reactivity(model3, "linear", expected, None, None, 10, 0.736396) # check using fname as a list & passing grid check_condensed_reactivity(model4, "linear", expected, None, None, 10, 0.736396)
def test_condense_quadratic_from_molecule_fmr_mbis_ch4(): # expected populations of CH4 computed with HORTON with path('chemtools.data', 'ch4_uhf_ccpvdz.wfn') as fname: molecule = Molecule.from_file(fname) grid = MolecularGrid.from_molecule(molecule, 'fine') part = DensPart.from_molecule(molecule, scheme='mbis', grid=grid) expected = np.array( [6.46038055, 0.88489494, 0.88492901, 0.88493897, 0.88492396]) computed = part.numbers - part.charges assert np.all(abs(expected - computed) < 1.e-2) assert np.all(abs(part.condense_to_atoms(part.density) - computed) < 1.e-2)
def _get_eos(filename, scheme): # build proatom database atoms = glob.glob('chemtools/data/atom_0*') proatomdb = ProAtomDB.from_files(atoms, "power:5e-8:20:40:146") # load molecule & make grid, denspart, and eos instances with path('chemtools.data', filename) as file_path: mol = Molecule.from_file(file_path) grid = MolecularGrid.from_molecule(mol, specs='power:5e-8:20:40:146', k=4, rotate=False) part = DensPart.from_molecule(mol, scheme=scheme, grid=grid, local=False, proatomdb=proatomdb) return EOS(mol, part)