def test_psi4_qmefp_6d(): subject = subject6 fullans = copy.deepcopy(fullans6) fullans['efp']['geom'] = np.array([-2.22978429, 1.19270015, -0.99721732, -1.85344873, 1.5734809 , 0.69660583, -0.71881655, 1.40649303, -1.90657336, 0.98792 , 1.87681 , 2.85174 , 2.31084386, 0.57620385, 3.31175679, 1.87761143, 3.16604791, 1.75667803, 0.55253064, 2.78087794, 4.47837555]) fullans['efp']['elea'] = np.array([16, 1, 1, 14, 1, 1, 1]) fullans['efp']['elez'] = np.array([8, 1, 1, 7, 1, 1, 1]) fullans['efp']['elem'] = np.array(['O', 'H', 'H', 'N', 'H', 'H', 'H']) fullans['efp']['mass'] = np.array([15.99491462, 1.00782503, 1.00782503, 14.00307400478, 1.00782503, 1.00782503, 1.00782503]) fullans['efp']['real'] = np.array([True, True, True, True, True, True, True]) fullans['efp']['elbl'] = np.array(['_a01o1', '_a02h2', '_a03h3', '_a01n1', '_a02h2', '_a03h3', '_a04h4']) fullans['efp']['fragment_separators'] = [3] fullans['efp']['fragment_charges'] = [0., 0.] fullans['efp']['fragment_multiplicities'] = [1, 1] fullans['efp']['molecular_charge'] = 0. fullans['efp']['molecular_multiplicity'] = 1 fullans['efp']['hint_types'] = ['xyzabc', 'xyzabc'] fullans['efp']['geom_hints'][1] = [1.093116487139866, 1.9296501432128303, 2.9104336205167156, -1.1053108079381473, 2.0333070957565544, -1.488586877218809] final, intermed = qcdb.molparse.from_string(subject, return_processed=True) import pylibefp efpobj = pylibefp.from_dict(final['efp']) efpfinal = efpobj.to_dict() efpfinal = qcdb.molparse.from_arrays(speclabel=False, domain='efp', **efpfinal) assert compare_molrecs(fullans['qm'], final['qm'], 4, sys._getframe().f_code.co_name + ': full qm') assert compare_molrecs(fullans['efp'], efpfinal, 4, sys._getframe().f_code.co_name + ': full efp')
def test_psi4_qmefp_6d(): subject = subject6 fullans = copy.deepcopy(fullans6) fullans['efp']['geom'] = np.array([-2.22978429, 1.19270015, -0.99721732, -1.85344873, 1.5734809 , 0.69660583, -0.71881655, 1.40649303, -1.90657336, 0.98792 , 1.87681 , 2.85174 , 2.31084386, 0.57620385, 3.31175679, 1.87761143, 3.16604791, 1.75667803, 0.55253064, 2.78087794, 4.47837555]) fullans['efp']['elea'] = np.array([16, 1, 1, 14, 1, 1, 1]) fullans['efp']['elez'] = np.array([8, 1, 1, 7, 1, 1, 1]) fullans['efp']['elem'] = np.array(['O', 'H', 'H', 'N', 'H', 'H', 'H']) fullans['efp']['mass'] = np.array([15.99491462, 1.00782503, 1.00782503, 14.00307400478, 1.00782503, 1.00782503, 1.00782503]) fullans['efp']['real'] = np.array([True, True, True, True, True, True, True]) fullans['efp']['elbl'] = np.array(['_a01o1', '_a02h2', '_a03h3', '_a01n1', '_a02h2', '_a03h3', '_a04h4']) fullans['efp']['fragment_separators'] = [3] fullans['efp']['fragment_charges'] = [0., 0.] fullans['efp']['fragment_multiplicities'] = [1, 1] fullans['efp']['molecular_charge'] = 0. fullans['efp']['molecular_multiplicity'] = 1 fullans['efp']['hint_types'] = ['xyzabc', 'xyzabc'] fullans['efp']['geom_hints'][1] = [1.093116487139866, 1.9296501432128303, 2.9104336205167156, -1.1053108079381473, 2.0333070957565544, -1.488586877218809] final, intermed = qcel.molparse.from_string(subject, return_processed=True) import pylibefp efpobj = pylibefp.from_dict(final['efp']) efpfinal = efpobj.to_dict() efpfinal = qcel.molparse.from_arrays(speclabel=False, domain='efp', **efpfinal) assert compare_molrecs(fullans['qm'], final['qm'], 4, sys._getframe().f_code.co_name + ': full qm') assert compare_molrecs(fullans['efp'], efpfinal, 4, sys._getframe().f_code.co_name + ': full efp')
def geometry(geom, name="default"): """Function to create a molecule object of name *name* from the geometry in string *geom*. Permitted for user use but deprecated in driver in favor of explicit molecule-passing. Comments within the string are filtered. """ molrec = qcel.molparse.from_string( geom, enable_qm=True, missing_enabled_return_qm='minimal', enable_efp=True, missing_enabled_return_efp='none') molecule = core.Molecule.from_dict(molrec['qm']) molecule.set_name(name) if 'efp' in molrec: try: import pylibefp except ImportError as e: # py36 ModuleNotFoundError raise ImportError("""Install pylibefp to use EFP functionality. `conda install pylibefp -c psi4` Or build with `-DENABLE_libefp=ON`""") from e #print('Using pylibefp: {} (version {})'.format(pylibefp.__file__, pylibefp.__version__)) efpobj = pylibefp.from_dict(molrec['efp']) # pylibefp.core.efp rides along on molecule molecule.EFP = efpobj # Attempt to go ahead and construct the molecule try: molecule.update_geometry() except: core.print_out("Molecule: geometry: Molecule is not complete, please use 'update_geometry'\n" " once all variables are set.\n") activate(molecule) return molecule