How to use the pyscf.lib.logger.info function in pyscf

To help you get started, we’ve selected a few pyscf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pyscf / pyscf / pyscf / grad / lagrange.py View on Github external
bvec = self.get_wfn_response (**kwargs)
        Aop, Adiag = self.get_Aop_Adiag (**kwargs)
        def my_geff (x):
            return bvec + Aop (x)
        Lvec_last = np.zeros_like (bvec)
        def my_Lvec_last ():
            return Lvec_last
        precond = self.get_lagrange_precond (Adiag, level_shift=level_shift, **kwargs)
        it = np.asarray ([0])
        lib.logger.debug (self, 'Lagrange multiplier determination intial gradient norm: {}'.format (linalg.norm (bvec)))
        my_call = self.get_lagrange_callback (Lvec_last, it, my_geff)
        Aop_obj = sparse_linalg.LinearOperator ((self.nlag,self.nlag), matvec=Aop, dtype=bvec.dtype)
        prec_obj = sparse_linalg.LinearOperator ((self.nlag,self.nlag), matvec=precond, dtype=bvec.dtype)
        x0_guess = self.get_init_guess (bvec, Adiag, Aop, precond)
        Lvec, info_int = sparse_linalg.cg (Aop_obj, -bvec, x0=x0_guess, atol=self.conv_tol, maxiter=self.max_cycle, callback=my_call, M=prec_obj)
        lib.logger.info (self, 'Lagrange multiplier determination {} after {} iterations\n   |geff| = {}, |Lvec| = {}'.format (
            ('converged','not converged')[bool (info_int)], it[0], linalg.norm (my_geff (Lvec)), linalg.norm (Lvec))) 
        if info_int < 0: lib.logger.info (self, 'Lagrange multiplier determination error code {}'.format (info_int))
        return (info_int==0), Lvec, bvec, Aop, Adiag
github pyscf / pyscf / gto / mole.py View on Github external
self.stdout.write(' '*32+'%-15.12g  ' % x[0])
                    for c in x[1:]:
                        self.stdout.write(' %4.12g' % c)
                    self.stdout.write('\n')

        logger.info(self, 'nuclear repulsion = %.15g', self.energy_nuc())
        if self.symmetry:
            if self.topgroup == self.groupname:
                logger.info(self, 'point group symmetry = %s', self.topgroup)
            else:
                logger.info(self, 'point group symmetry = %s, use subgroup %s',
                            self.topgroup, self.groupname)
            for ir in range(self.symm_orb.__len__()):
                logger.info(self, 'num. orbitals of irrep %s = %d',
                            self.irrep_name[ir], self.symm_orb[ir].shape[1])
        logger.info(self, 'number of shells = %d', self.nbas)
        logger.info(self, 'number of NR pGTOs = %d', self.npgto_nr())
        logger.info(self, 'number of NR cGTOs = %d', self.nao_nr())
        if self.verbose >= logger.DEBUG1:
            for i in range(len(self._bas)):
                exps = self.bas_exp(i)
                logger.debug1(self, 'bas %d, expnt(s) = %s', i, str(exps))

        logger.info(self, 'CPU time: %12.2f', time.clock())
        return self
github pyscf / pyscf / pyscf / scf / hf.py View on Github external
def init_guess_by_huckel(self, mol=None):
        if mol is None: mol = self.mol
        logger.info(self, 'Initial guess from on-the-fly Huckel, doi:10.1021/acs.jctc.8b01089.')
        mo_energy, mo_coeff = _init_guess_huckel_orbitals(mol)
        mo_occ = self.get_occ(mo_energy, mo_coeff)
        return self.make_rdm1(mo_coeff, mo_occ)
github pyscf / pyscf / pyscf / qmmm / itrf.py View on Github external
def dump_flags(self, verbose=None):
            grad_class.dump_flags(self, verbose)
            logger.info(self, '** Add background charges for %s **', grad_class)
            if self.verbose >= logger.DEBUG1:
                logger.debug1(self, 'Charge      Location')
                for i, z in enumerate(charges):
                    logger.debug1(self, '%.9g    %s', z, coords[i])
            return self
github pyscf / pyscf / pyscf / pbc / cc / kccsd.py View on Github external
eia = LARGE_DENOM * numpy.ones((nocc, nvir), dtype=eris.mo_energy[0].dtype)
            n0_ovp_ia = numpy.ix_(nonzero_opadding[ki], nonzero_vpadding[ka])
            eia[n0_ovp_ia] = (mo_e_o[ki][:,None] - mo_e_v[ka])[n0_ovp_ia]

            ejb = LARGE_DENOM * numpy.ones((nocc, nvir), dtype=eris.mo_energy[0].dtype)
            n0_ovp_jb = numpy.ix_(nonzero_opadding[kj], nonzero_vpadding[kb])
            ejb[n0_ovp_jb] = (mo_e_o[kj][:,None] - mo_e_v[kb])[n0_ovp_jb]
            eijab = eia[:, None, :, None] + ejb[:, None, :]

            t2[ki, kj, ka] = eris_oovv[ki, kj, ka] / eijab

        t2 = numpy.conj(t2)
        self.emp2 = 0.25 * numpy.einsum('pqrijab,pqrijab', t2, eris_oovv).real
        self.emp2 /= nkpts

        logger.info(self, 'Init t2, MP2 energy = %.15g', self.emp2.real)
        logger.timer(self, 'init mp2', *time0)
        return self.emp2, t1, t2
github pyscf / pyscf / pyscf / mcscf / df.py View on Github external
def dump_flags(self, verbose=None):
            casscf_class.dump_flags(self, verbose)
            logger.info(self, 'CASSCF: density fitting for orbital hessian')
github pyscf / pyscf / pbc / cc / kccsd_rhf.py View on Github external
def dump_flags(self):
        pyscf.cc.ccsd.CCSD.dump_flags(self)
        logger.info(self, '\n')
        logger.info(self, '******** EOM CC flags ********')
github pyscf / pyscf / pyscf / dft / gks.py View on Github external
def dump_flags(self, verbose=None):
        ghf.GHF.dump_flags(self, verbose)
        logger.info(self, 'XC functionals = %s', self.xc)
        if self.nlc!='':
            logger.info(self, 'NLC functional = %s', self.nlc)
        logger.info(self, 'small_rho_cutoff = %g', self.small_rho_cutoff)
        self.grids.dump_flags(verbose)
github pyscf / pyscf / pyscf / gto / mole.py View on Github external
unit = 1./param.BOHR
            else:
                unit = 1./unit
            ptr = mol._atm[:,PTR_COORD]
            mol._env[ptr+0] = unit * atoms_or_coords[:,0]
            mol._env[ptr+1] = unit * atoms_or_coords[:,1]
            mol._env[ptr+2] = unit * atoms_or_coords[:,2]
        else:
            mol.symmetry = symmetry
            mol.build(False, False)

        if mol.verbose >= logger.INFO:
            logger.info(mol, 'New geometry (unit %s)', unit)
            coords = mol.atom_coords()
            for ia in range(mol.natm):
                logger.info(mol, ' %3d %-4s %16.12f %16.12f %16.12f',
                            ia+1, mol.atom_symbol(ia), *coords[ia])
        return mol
github pyscf / pyscf / pyscf / dft / rks_grad.py View on Github external
def dump_flags(self):
        rhf_grad.Gradients.dump_flags(self)
        logger.info(self, 'grid_response = %s', self.grid_response)
        #if callable(self._scf.grids.prune):
        #    logger.info(self, 'Grid pruning %s may affect DFT gradients accuracy.'
        #                'Call mf.grids.run(prune=False) to mute grid pruning',
        #                self._scf.grids.prune)
        return self