本文整理汇总了Python中pyscf.lib.logger.note函数的典型用法代码示例。如果您正苦于以下问题:Python note函数的具体用法?Python note怎么用?Python note使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了note函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: ccsd
def ccsd(self, t1=None, t2=None, eris=None, mbpt2=False):
'''Ground-state unrestricted (U)CCSD.
Kwargs:
mbpt2 : bool
Use one-shot MBPT2 approximation to CCSD.
'''
if eris is None: eris = self.ao2mo(self.mo_coeff)
self.eris = eris
self.dump_flags()
if mbpt2:
cctyp = 'MBPT2'
self.e_corr, self.t1, self.t2 = self.init_amps(eris)
else:
cctyp = 'CCSD'
self.converged, self.e_corr, self.t1, self.t2 = \
kernel(self, eris, t1, t2, max_cycle=self.max_cycle,
tol=self.conv_tol, tolnormt=self.conv_tol_normt,
verbose=self.verbose)
if self.converged:
logger.info(self, 'CCSD converged')
else:
logger.info(self, 'CCSD not converged')
if self._scf.e_tot == 0:
logger.note(self, 'E_corr = %.16g', self.e_corr)
else:
logger.note(self, 'E(%s) = %.16g E_corr = %.16g',
cctyp, self.e_tot, self.e_corr)
return self.e_corr, self.t1, self.t2
开发者ID:eronca,项目名称:pyscf,代码行数:29,代码来源:uccsd.py
示例2: makov_payne_correction
def makov_payne_correction(mf):
'''Makov-Payne correction (Phys. Rev. B, 51, 4014)
'''
cell = mf.cell
logger.note(mf, 'Makov-Payne correction for charged 3D PBC systems')
# PRB 51 (1995), 4014
# PRB 77 (2008), 115139
if cell.dimension != 3:
logger.warn(mf, 'Correction for low-dimension PBC systems'
'is not available.')
return 0
de_mono, de_dip, de_quad, de = _dip_correction(mf)
if mf.verbose >= logger.NOTE:
write = mf.stdout.write
write('Corrections (AU)\n')
write(' Monopole Dipole Quadrupole total\n')
write('SC %12.8f %12.8f %12.8f %12.8f\n' %
(de_mono[0], de_dip , de_quad , de[0]))
write('BCC %12.8f %12.8f %12.8f %12.8f\n' %
(de_mono[1], de_dip , de_quad , de[1]))
write('FCC %12.8f %12.8f %12.8f %12.8f\n' %
(de_mono[2], de_dip , de_quad , de[2]))
return de
开发者ID:sunqm,项目名称:pyscf,代码行数:25,代码来源:hf.py
示例3: kernel
def kernel(self, mo_coeff=None, ci0=None, macro=None, micro=None,
callback=None, _kern=None):
if mo_coeff is None:
mo_coeff = self.mo_coeff
else:
self.mo_coeff = mo_coeff
if macro is None: macro = self.max_cycle_macro
if micro is None: micro = self.max_cycle_micro
if callback is None: callback = self.callback
if _kern is None: _kern = mc1step.kernel
if self.verbose > logger.QUIET:
pyscf.gto.mole.check_sanity(self, self._keys, self.stdout)
self.mol.check_sanity(self)
self.dump_flags()
casci_symm.label_symmetry_(self, self.mo_coeff)
self.converged, self.e_tot, self.e_cas, self.ci, \
self.mo_coeff, self.mo_energy = \
_kern(self, mo_coeff,
tol=self.conv_tol, conv_tol_grad=self.conv_tol_grad,
macro=macro, micro=micro,
ci0=ci0, callback=callback, verbose=self.verbose)
logger.note(self, 'CASSCF energy = %.15g', self.e_tot)
self._finalize_()
return self.e_tot, self.e_cas, self.ci, self.mo_coeff, self.mo_energy
开发者ID:raybrad,项目名称:pyscf,代码行数:27,代码来源:mc1step_symm.py
示例4: kernel
def kernel(self, mo_coeff=None, ci0=None, macro=None, micro=None,
callback=None, _kern=kernel):
if mo_coeff is None:
mo_coeff = self.mo_coeff
else: # overwrite self.mo_coeff because it is needed in many methods of this class
self.mo_coeff = mo_coeff
if macro is None: macro = self.max_cycle_macro
if micro is None: micro = self.max_cycle_micro
if callback is None: callback = self.callback
if self.verbose > logger.QUIET:
pyscf.gto.mole.check_sanity(self, self._keys, self.stdout)
self.mol.check_sanity(self)
self.dump_flags()
self.converged, self.e_tot, self.e_cas, self.ci, \
self.mo_coeff, self.mo_energy = \
_kern(self, mo_coeff,
tol=self.conv_tol, conv_tol_grad=self.conv_tol_grad,
macro=macro, micro=micro,
ci0=ci0, callback=callback, verbose=self.verbose)
logger.note(self, 'CASSCF energy = %.15g', self.e_tot)
#if self.verbose >= logger.INFO:
# self.analyze(mo_coeff, self.ci, verbose=self.verbose)
return self.e_tot, self.e_cas, self.ci, self.mo_coeff, self.mo_energy
开发者ID:pckiller2008,项目名称:pyscf,代码行数:26,代码来源:mc1step.py
示例5: kernel
def kernel(self, mo_coeff=None, ci0=None, macro=None, micro=None, callback=None, _kern=kernel):
if mo_coeff is None:
mo_coeff = self.mo_coeff
else:
self.mo_coeff = mo_coeff
if macro is None:
macro = self.max_cycle_macro
if micro is None:
micro = self.max_cycle_micro
if callback is None:
callback = self.callback
if self.verbose > logger.QUIET:
pyscf.gto.mole.check_sanity(self, self._keys, self.stdout)
self.mol.check_sanity(self)
self.dump_flags()
self.converged, self.e_tot, e_cas, self.ci, self.mo_coeff = _kern(
self,
mo_coeff,
tol=self.conv_tol,
conv_tol_grad=self.conv_tol_grad,
macro=macro,
micro=micro,
ci0=ci0,
callback=callback,
verbose=self.verbose,
)
logger.note(self, "CASSCF energy = %.15g", self.e_tot)
# if self.verbose >= logger.INFO:
# self.analyze(mo_coeff, self.ci, verbose=self.verbose)
self._finalize_()
return self.e_tot, e_cas, self.ci, self.mo_coeff
开发者ID:matk86,项目名称:pyscf,代码行数:34,代码来源:mc1step_uhf.py
示例6: optimize
def optimize( self ):
r'''Augmented Hessian Newton-Raphson optimization of the localization cost function, using an exact gradient and hessian
Returns:
The orbital coefficients of the orthonormal localized orbitals, expressed in terms of the AO
'''
# To break up symmetrical orbitals
flatx = 0.0123 * np.ones( [ self.numVars ], dtype=float )
self.__update_unitary( flatx )
#self.__debug_gradient()
#self.__debug_hessian()
gradient_norm = 1.0
threshold = 1e-6
iteration = 0
logger.debug(self, "Localizer :: At iteration %d the cost function = %g", iteration, -self.__costfunction())
logger.debug(self, "Localizer :: Linear size of the augmented Hessian = %d", self.numVars+1)
while ( gradient_norm > threshold ):
iteration += 1
augmented = np.zeros( [ self.numVars+1, self.numVars+1 ], dtype=float )
gradient = self.__gradient()
augmented[:-1,:-1] = self.__hessian()
augmented[:-1,self.numVars] = gradient
augmented[self.numVars,:-1] = gradient
if ( self.numVars+1 > 1024 ):
ini_guess = np.zeros( [self.numVars+1], dtype=float )
ini_guess[ self.numVars ] = 1.0
for elem in range( self.numVars ):
ini_guess[ elem ] = - gradient[ elem ] / max( augmented[ elem, elem ], 1e-6 )
eigenval, eigenvec = scipy.sparse.linalg.eigsh( augmented, k=1, which='SA', v0=ini_guess, ncv=1024, maxiter=(self.numVars+1) )
flatx = eigenvec[:-1] / eigenvec[ self.numVars ]
else:
eigenvals, eigenvecs = np.linalg.eigh( augmented )
idx = eigenvals.argsort()
eigenvals = eigenvals[idx]
eigenvecs = eigenvecs[:,idx]
flatx = eigenvecs[:-1,0] / eigenvecs[self.numVars,0]
gradient_norm = np.linalg.norm( gradient )
update_norm = np.linalg.norm( flatx )
self.__update_unitary( flatx )
logger.debug(self, "Localizer :: gradient norm = %g", gradient_norm)
logger.debug(self, "Localizer :: update norm = %g", update_norm)
logger.debug(self, "Localizer :: At iteration %d the cost function = %g", iteration, -self.__costfunction())
logger.note(self, "Localization procedure converged in %d iterations.", iteration)
self.__reorder_orbitals()
converged_coeff = np.dot( self.coeff, self.u )
return converged_coeff
开发者ID:diradical,项目名称:pyscf,代码行数:56,代码来源:localizer.py
示例7: kernel
def kernel(self, mo1=None):
if len(self.nuc_pair) == 0:
return
cput0 = (time.clock(), time.time())
self.check_sanity()
self.dump_flags()
mol = self.mol
dm0 = self._scf.make_rdm1()
mo_coeff = self._scf.mo_coeff
mo_occ = self._scf.mo_occ
ssc_dia = self.make_dso(mol, dm0)
if mo1 is None:
mo1 = self.mo10 = self.solve_mo1()[0]
ssc_pso = self.make_pso(mol, mo1, mo_coeff, mo_occ)
e11 = ssc_dia + ssc_pso
if self.with_fcsd:
ssc_fcsd = self.make_fcsd(self.nuc_pair)
e11 += ssc_fcsd
elif self.with_fc:
ssc_fc = self.make_fc(self.nuc_pair)
e11 += ssc_fc
logger.timer(self, 'spin-spin coupling', *cput0)
if self.verbose > logger.QUIET:
nuc_mag = .5 * (nist.E_MASS/nist.PROTON_MASS) # e*hbar/2m
au2Hz = nist.HARTREE2J / nist.PLANCK
#logger.debug('Unit AU -> Hz %s', au2Hz*nuc_mag**2)
iso_ssc = au2Hz * nuc_mag ** 2 * numpy.einsum('kii->k', e11) / 3
natm = mol.natm
ktensor = numpy.zeros((natm,natm))
for k, (i, j) in enumerate(self.nuc_pair):
ktensor[i,j] = ktensor[j,i] = iso_ssc[k]
if self.verbose >= logger.DEBUG:
_write(self.stdout, ssc_dia[k]+ssc_para[k],
'\nSSC E11 between %d %s and %d %s' \
% (i, self.mol.atom_symbol(i),
j, self.mol.atom_symbol(j)))
# _write(self.stdout, ssc_dia [k], 'dia-magnetism')
# _write(self.stdout, ssc_para[k], 'para-magnetism')
gyro = rhf_ssc._atom_gyro_list(mol)
jtensor = numpy.einsum('ij,i,j->ij', ktensor, gyro, gyro)
label = ['%2d %-2s'%(ia, mol.atom_symbol(ia)) for ia in range(natm)]
logger.note(self, 'Reduced spin-spin coupling constant K (Hz)')
tools.dump_mat.dump_tri(self.stdout, ktensor, label)
logger.info(self, '\nNuclear g factor %s', gyro)
logger.note(self, 'Spin-spin coupling constant J (Hz)')
tools.dump_mat.dump_tri(self.stdout, jtensor, label)
return e11
开发者ID:chrinide,项目名称:pyscf,代码行数:53,代码来源:uhf.py
示例8: cisd
def cisd(self, ci0=None, mo_coeff=None, eris=None):
if eris is None:
eris = self.ao2mo(mo_coeff)
self.converged, self.e_corr, self.ci = \
kernel(self, eris, ci0, max_cycle=self.max_cycle,
tol=self.conv_tol, verbose=self.verbose)
if self._scf.e_tot == 0:
logger.note(self, 'E_corr = %.16g', self.e_corr)
else:
logger.note(self, 'E(CISD) = %.16g E_corr = %.16g',
self.e_tot, self.e_corr)
return self.e_corr, self.ci
开发者ID:eronca,项目名称:pyscf,代码行数:12,代码来源:cisd_slow.py
示例9: grad
def grad(self, mo_energy=None, mo_coeff=None, mo_occ=None):
cput0 = (time.clock(), time.time())
if mo_energy is None: mo_energy = self._scf.mo_energy
if mo_coeff is None: mo_coeff = self._scf.mo_coeff
if mo_occ is None: mo_occ = self._scf.mo_occ
if self.verbose >= param.VERBOSE_INFO:
self.dump_flags()
grads = self.grad_elec(mo_energy, mo_coeff, mo_occ) + self.grad_nuc()
for ia in range(self.mol.natm):
log.note(self, 'atom %d %s, force = (%.14g, %.14g, %.14g)',
ia, self.mol.atom_symbol(ia), *grads[ia])
log.timer(self, 'HF gradients', *cput0)
return grads
开发者ID:diradical,项目名称:pyscf,代码行数:13,代码来源:hf.py
示例10: kernel
def kernel(self, mo_coeff=None, ci0=None, macro=None, micro=None, callback=None, _kern=None):
if mo_coeff is None:
mo_coeff = self.mo_coeff
else:
self.mo_coeff = mo_coeff
if macro is None:
macro = self.max_cycle_macro
if micro is None:
micro = self.max_cycle_micro
if callback is None:
callback = self.callback
if _kern is None:
_kern = mc1step.kernel
if self.verbose > logger.QUIET:
pyscf.gto.mole.check_sanity(self, self._keys, self.stdout)
self.mol.check_sanity(self)
self.dump_flags()
# irrep_name = self.mol.irrep_name
irrep_name = self.mol.irrep_id
try:
self.orbsym = symm.label_orb_symm(self.mol, irrep_name, self.mol.symm_orb, mo_coeff, s=self._scf.get_ovlp())
except ValueError:
logger.warn(self, "mc1step_symm symmetrizes input orbitals")
s = self._scf.get_ovlp()
mo_coeff = symm.symmetrize_orb(self.mol, mo_coeff, s=s)
diag = numpy.einsum("ki,ki->i", mo_coeff, numpy.dot(s, mo_coeff))
mo_coeff = numpy.einsum("ki,i->ki", mo_coeff, 1 / numpy.sqrt(diag))
self.orbsym = symm.label_orb_symm(self.mol, irrep_name, self.mol.symm_orb, mo_coeff, s=s)
if not hasattr(self.fcisolver, "orbsym") or not self.fcisolver.orbsym:
ncore = self.ncore
nocc = self.ncore + self.ncas
self.fcisolver.orbsym = self.orbsym[ncore:nocc]
logger.debug(self, "Active space irreps %s", str(self.fcisolver.orbsym))
self.converged, self.e_tot, e_cas, self.ci, self.mo_coeff = _kern(
self,
mo_coeff,
tol=self.conv_tol,
conv_tol_grad=self.conv_tol_grad,
macro=macro,
micro=micro,
ci0=ci0,
callback=callback,
verbose=self.verbose,
)
logger.note(self, "CASSCF energy = %.15g", self.e_tot)
return self.e_tot, e_cas, self.ci, self.mo_coeff
开发者ID:BB-Goldstein,项目名称:pyscf,代码行数:51,代码来源:mc1step_symm.py
示例11: kernel
def kernel(self, mo_coeff=None, ci0=None):
if mo_coeff is None:
mo_coeff = self.mo_coeff
if ci0 is None:
ci0 = self.ci
self.check_sanity()
self.dump_flags()
self.e_tot, e_cas, self.ci = \
kernel(self, mo_coeff, ci0=ci0, verbose=self.verbose)
#if self.verbose >= logger.INFO:
# self.analyze(mo_coeff, self.ci, verbose=self.verbose)
logger.note(self, 'CASCI E = %.15g', self.e_tot)
self._finalize_()
return self.e_tot, e_cas, self.ci
开发者ID:cheaps10,项目名称:pyscf,代码行数:16,代码来源:casci_uhf.py
示例12: kernel
def kernel(self, mo_coeff=None, ci0=None):
if mo_coeff is None:
mo_coeff = self.mo_coeff
if ci0 is None:
ci0 = self.ci
if self.verbose > logger.QUIET:
pyscf.gto.mole.check_sanity(self, self._keys, self.stdout)
self.dump_flags()
self.e_tot, e_cas, self.ci = \
kernel(self, mo_coeff, ci0=ci0, verbose=self.verbose)
#if self.verbose >= logger.INFO:
# self.analyze(mo_coeff, self.ci, verbose=self.verbose)
logger.note(self, 'CASCI E = %.15g', self.e_tot)
return self.e_tot, e_cas, self.ci
开发者ID:BB-Goldstein,项目名称:pyscf,代码行数:17,代码来源:casci_uhf.py
示例13: kernel
def kernel(self, dm=None, atmlst=None):
if dm is None:
dm = grad_method.base.make_rdm1(ao_repr=True)
# de_solvent needs to be called first because _finalize method
# is called in the grad_method.kernel function. de_solvent is
# required by the _finalize method.
self.de_solvent = kernel(self.with_solvent, dm)
self.de_solute = grad_method_class.kernel(self, atmlst=atmlst)
self.de = self.de_solute + self.de_solvent
if self.verbose >= logger.NOTE:
logger.note(self, '--------------- %s (%s) gradients ---------------',
grad_method.base.__class__.__name__,
self.with_solvent.__class__.__name__)
rhf_grad._write(self, self.mol, self.de, self.atmlst)
logger.note(self, '----------------------------------------------')
return self.de
开发者ID:chrinide,项目名称:pyscf,代码行数:18,代码来源:ddcosmo_grad.py
示例14: kernel
def kernel(self, mo_coeff=None, ci0=None, callback=None, _kern=kernel):
if mo_coeff is None:
mo_coeff = self.mo_coeff
else:
self.mo_coeff = mo_coeff
if callback is None: callback = self.callback
if self.verbose >= logger.WARN:
self.check_sanity()
self.dump_flags()
self.converged, self.e_tot, e_cas, self.ci, self.mo_coeff = \
_kern(self, mo_coeff,
tol=self.conv_tol, conv_tol_grad=self.conv_tol_grad,
ci0=ci0, callback=callback, verbose=self.verbose)
logger.note(self, 'CASSCF energy = %.15g', self.e_tot)
#if self.verbose >= logger.INFO:
# self.analyze(mo_coeff, self.ci, verbose=self.verbose)
self._finalize()
return self.e_tot, e_cas, self.ci, self.mo_coeff
开发者ID:berquist,项目名称:pyscf,代码行数:20,代码来源:mc1step_uhf.py
示例15: _finalize_
def _finalize_(self):
if self.converged:
logger.note(self, 'converged SCF energy = %.15g', self.e_tot)
else:
logger.note(self, 'SCF not converge.')
logger.note(self, 'SCF energy = %.15g after %d cycles',
self.e_tot, self.max_cycle)
开发者ID:molguin-qc,项目名称:pyscf,代码行数:7,代码来源:hf.py
示例16: ccsd
def ccsd(self, t1=None, t2=None, eris=None, mbpt2=False, cc2=False):
'''Ground-state CCSD.
Kwargs:
mbpt2 : bool
Use one-shot MBPT2 approximation to CCSD.
cc2 : bool
Use CC2 approximation to CCSD.
'''
if mbpt2 and cc2:
raise RuntimeError('MBPT2 and CC2 are mutually exclusive approximations to the CCSD ground state.')
if eris is None: eris = self.ao2mo(self.mo_coeff)
self.eris = eris
self.dump_flags()
if mbpt2:
cctyp = 'MBPT2'
self.e_corr, self.t1, self.t2 = self.init_amps(eris)
else:
if cc2:
cctyp = 'CC2'
self.cc2 = True
else:
cctyp = 'CCSD'
self.cc2 = False
self.converged, self.e_corr, self.t1, self.t2 = \
ccsd.kernel(self, eris, t1, t2, max_cycle=self.max_cycle,
tol=self.conv_tol, tolnormt=self.conv_tol_normt,
verbose=self.verbose)
if self.converged:
logger.info(self, '%s converged', cctyp)
else:
logger.info(self, '%s not converged', cctyp)
if self._scf.e_tot == 0:
logger.note(self, 'E_corr = %.16g', self.e_corr)
else:
logger.note(self, 'E(%s) = %.16g E_corr = %.16g',
cctyp, self.e_tot, self.e_corr)
return self.e_corr, self.t1, self.t2
开发者ID:chrinide,项目名称:pyscf,代码行数:38,代码来源:rccsd_slow.py
示例17: kernel
def kernel(self, xy=None, state=0, singlet=None, atmlst=None):
cput0 = (time.clock(), time.time())
if xy is None: xy = self._td.xy[state]
if singlet is None: singlet = self._td.singlet
if atmlst is None: atmlst = range(self.mol.natm)
self.check_sanity()
de = self.grad_elec(xy, singlet, atmlst)
self.de = de = de + self.grad_nuc(atmlst=atmlst)
logger.note(self, '--------------')
logger.note(self, ' x y z')
for k, ia in enumerate(atmlst):
logger.note(self, '%d %s %15.9f %15.9f %15.9f', ia,
self.mol.atom_symbol(ia), de[k,0], de[k,1], de[k,2])
logger.note(self, '--------------')
logger.timer(self, 'TD gradients', *cput0)
return self.de
开发者ID:cheaps10,项目名称:pyscf,代码行数:17,代码来源:rhf_grad.py
示例18: dump_energy
def dump_energy(self, hf_energy=None, converged=None):
if hf_energy is None: hf_energy = self.hf_energy
if converged is None: converged = self.converged
if converged:
logger.note(self, 'converged SCF energy = %.15g',
hf_energy)
else:
logger.note(self, 'SCF not converge.')
logger.note(self, 'SCF energy = %.15g after %d cycles',
hf_energy, self.max_cycle)
开发者ID:diradical,项目名称:pyscf,代码行数:10,代码来源:hf.py
示例19: grad
def grad(self, mo_energy=None, mo_coeff=None, mo_occ=None, atmlst=None):
cput0 = (time.clock(), time.time())
if mo_energy is None: mo_energy = self._scf.mo_energy
if mo_coeff is None: mo_coeff = self._scf.mo_coeff
if mo_occ is None: mo_occ = self._scf.mo_occ
if self.verbose >= logger.INFO:
self.dump_flags()
de =(self.grad_elec(mo_energy, mo_coeff, mo_occ, atmlst)
+ self.grad_nuc(atmlst))
logger.note(self, '--------------')
logger.note(self, ' x y z')
if atmlst is None:
atmlst = range(self.mol.natm)
for k, ia in enumerate(atmlst):
logger.note(self, '%d %s %15.9f %15.9f %15.9f', ia,
self.mol.atom_symbol(ia), de[k,0], de[k,1], de[k,2])
logger.note(self, '--------------')
logger.timer(self, 'SCF gradients', *cput0)
return de
开发者ID:matk86,项目名称:pyscf,代码行数:19,代码来源:rhf_grad.py
示例20: _finalize
def _finalize(self):
ss, s = self.spin_square()
if self.converged:
logger.note(self, 'converged SCF energy = %.15g '
'<S^2> = %.8g 2S+1 = %.8g', self.e_tot, ss, s)
else:
logger.note(self, 'SCF not converged.')
logger.note(self, 'SCF energy = %.15g after %d cycles '
'<S^2> = %.8g 2S+1 = %.8g',
self.e_tot, self.max_cycle, ss, s)
return self
开发者ID:sunqm,项目名称:pyscf,代码行数:12,代码来源:uhf.py
注:本文中的pyscf.lib.logger.note函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论