Пример #1
0
    def metarun(self):

        results = adfaccurateembeddingresults()

        # run supermolecular calculation
        self.settings.set_lmo(True)
        self.settings.set_save_tapes([21, 10])
        self.settings.set_exactdensity(True)

        results.super = adfsinglepointjob(self.supermol, self.basis, settings=self.settings).run()

        # orbital localization is turned off for the other calculations
        self.settings.set_lmo(False)

        # fragment density is obtained from frag1 and frag2
        results.frag1 = adfsinglepointjob(self.frag1, self.basis, settings=self.settings).run()
        results.frag2 = adfsinglepointjob(self.frag2, self.basis, settings=self.settings).run()

        # get localized orbital densities for subsystems 1 and 2

        self.assign_locorbs_to_fragments(results)

        adfGrid = adfgrid(results.super)

        sys1_dens = results.super.get_locorb_density(grid=adfGrid, orbs=results.locorb_set1)
        sys1_dens.prop = 'density scf'

        # results.sys2_dens = results.super.get_locorb_density(grid=adfGrid, orbs=results.locorb_set2)
        # results.sys2_dens.prop = 'density scf'

        print 'reference calculations finished'

        #  Now comes the potential reconstruction:

        self.settings.set_ncycles(self.cyc)

        job = adffragmentsjob([fragment(results.frag1, [self.frag1])], self.basis, settings=self.settings)
        potjob = adfpotentialjob(job, sys1_dens, potoptions=self.potoptions)

        print 'Running potential reconstruction job ... '
        results.pot = potjob.run()

        # Calculate the error in the density

        # the reconstructed density
        rec_dens = results.pot.get_density(grid=adfGrid)

        # the difference density
        diff_dens = sys1_dens - rec_dens

        # calculate integral over the difference density
        results.dens_error = diff_dens.integral(func=lambda x: abs(x))

        return results
Пример #2
0
    def metarun(self):
        import copy
        frags = copy.deepcopy(self._frags)

        frags.calculate_all(
            lambda mol: adfsinglepointjob(mol,
                                          basis=self._basis,
                                          settings=self._settings,
                                          core=self._core,
                                          pointcharges=self._pc,
                                          fitbas=self._fitbas,
                                          options=self._options).run())
        r = self.create_results_instance()
        r.set_fragmentlist(frags)
        return r
Пример #3
0
    def create_job(self, mol, s_scf):
        """
        """
        from ADFSinglePoint import adfsinglepointjob

        if s_scf.create_job is None:
            job = adfsinglepointjob(mol=mol,
                                    basis=s_scf.basis,
                                    core=s_scf.core,
                                    settings=s_scf.settings,
                                    pointcharges=s_scf.pointcharges,
                                    options=s_scf.options)
        else:
            job = s_scf.create_job(s_scf, mol)

        return job
Пример #4
0
    def prepare_frags(self):
        """
        Prepare fragments (make single point runs for molecules).

        @note:
            we cannot use symmetry in the fragments if we are interested in the
            difference density -> otherwise they will be rotated

        @returns: The results of single point runs for a list of molecules
        @rtype: tuple of list of adfsinglepointresults and fragments
        """

        r_frags = []
        frags = []
        self.adfsettings.set_occupations(None)
        for mol in self.molecules:
            mol.set_symmetry('NOSYM')
            r = adfsinglepointjob(mol=mol,
                                  basis=self.basis,
                                  core=self.core,
                                  settings=self.adfsettings,
                                  options=['NOSYMFIT']).run()
            r_frags.append(r)
            if self.settings.usebasis == 'True':
                frags.append(
                    fragment(r,
                             mol,
                             fdeoptions={
                                 "USEBASIS": "",
                                 "RELAX": "",
                                 "XC": " GGA PBE"
                             }))
            else:
                frags.append(fragment(r, mol, fdeoptions={"XC": "GGA PBE"}))

        return frags, r_frags