计算化学公社

 找回密码 Forget password
 注册 Register
Views: 8835|回复 Reply: 1
打印 Print 上一主题 Last thread 下一主题 Next thread

[其它量化程序] pyscf 读取molpro分子轨道

[复制链接 Copy URL]

149

帖子

0

威望

560

eV
积分
709

Level 4 (黑子)

跳转到指定楼层 Go to specific reply
楼主
本帖最后由 lqhenwunai 于 2019-11-26 18:10 编辑

我想用pyscf读取molpro的分子轨道,我的pyscf输入文件如下:

import os
import numpy as np
from pyscf import gto, scf,symm,cc,tools
from pyscf.cc import ccsd_t
from pyscf.gto.basis import parse_molpro
from pyscf.x2c import x2c


mol=gto.Mole()
#unit in angstrom
mol.atom='''La 0 0 0
         '''
mol.symmetry='d2h'

dirnow = os.path.realpath(os.path.join(__file__, '..'))
basis_file_from_user = os.path.join(dirnow, 'cc-pvtz-x2c.dat')
mol.basis={'La':basis_file_from_user}

#-------------------------------------
#下面这部分是从examples/gto/30-read_molpro_orb.py 里粘过来的。

#mol = gto.M(atom='N 0 0 1; N 0 0 -1',
#            basis={'N':parse_molpro.load('path/to/molpor/basis_name.libmol', 'N')},
#            symmetry='d2h')
dat = open('orb.matrop').read().split('\n')
dat = ''.join(dat[2:-2])  # [2:-2] to skip comments
dat = np.array([float(x) for x in dat.split(',')[:-1]])  # [:-1] to remove last comma

#all orbitals in molpro symmetry order
#分子轨道维度做了相应调整,其它部分不变
dims = [22,16,16,11,16,11,11,6]  # orbitals in each irrep

off = 0
molpro_mo = []
for i, nd in enumerate(dims):
    molpro_mo.append(dat[off:off+nd**2].reshape(nd,nd))
    off += nd**2
mo = []
for i, ir in enumerate(mol.irrep_id):
    molpro_id = symm.param.IRREP_ID_MOLPRO['D2h'][ir]-1
    mo.append(np.dot(mol.symm_orb, molpro_mo[molpro_id]))
mo = np.hstack(mo)
# Check normalization to ensure no bug
#print np.einsum('ji,jk,ki->i', mo, mol.intor('cint1e_ovlp_sph'), mo)
#粘贴完毕
#------------------------------------------------------------------------------------


mol.max_memory=8000
mol.charge=0
mol.spin=1  #molpro convention
mol.output='Lavtz.out'
mol.build()
hf=scf.RHF(mol).x2c()
hf.kernel()


但是却告诉我说高亮部分有问题:
    for i, ir in enumerate(mol.irrep_id):
TypeError: 'NoneType' object is not iterable


我尝试重复原例中的结果,报错说维度不同。
    mo.append(np.dot(mol.symm_orb, molpro_mo[molpro_id]))
ValueError: shapes (10,3) and (7,7) not aligned: 3 (dim 1) != 7 (dim 0)
但至少它是进入enumerate(mol.irrep_id)那个循环了。


请问哪里出错了?

谢谢大家的帮助。


评分 Rate

参与人数
Participants 1
eV +1 收起 理由
Reason
沽宁 + 1 赞!

查看全部评分 View all ratings

4114

帖子

4

威望

8875

eV
积分
13069

Level 6 (一方通行)

MOKIT开发者

2#
发表于 Post on 2019-11-26 19:04:26 | 只看该作者 Only view this author
去github上PySCF处提问,或者直接发邮件问作者Qiming Sun。
自动做多参考态计算的程序MOKIT

本版积分规则 Credits rule

手机版 Mobile version|北京科音自然科学研究中心 Beijing Kein Research Center for Natural Sciences|京公网安备 11010502035419号|计算化学公社 — 北京科音旗下高水平计算化学交流论坛 ( 京ICP备14038949号-1 )|网站地图

GMT+8, 2025-8-18 05:09 , Processed in 0.145260 second(s), 21 queries , Gzip On.

快速回复 返回顶部 返回列表 Return to list