提交 26487447 编辑于 作者: hebrewsnabla's avatar hebrewsnabla
浏览文件

update frag

上级 2f43babd
import frag_sol
xyz = '''H 0.0 0.0 0.0
xyz = '''
H 0.0 0.0 0.0
O 0.0 0.0 1.0
O 0.0 0.0 2.0
H 0.0 0.0 3.0
......@@ -34,7 +35,8 @@ wfnpath = 'D:\\xxx\\yyy\\frag'
## the optput wfn will be frag0.wfn, frag1.wfn, ...
# frags charges spins
frag_sol.from_frag(xyz, [[1,2],[3,4]], [0,0],[1,-1], gjfhead, scrfhead, 'frag', basis, wfnpath)
#frag_sol.from_frag(xyz, [[1,2],[3,4]], [0,0],[1,-1], gjfhead, scrfhead, 'frag', basis, wfnpath)
frag_sol.from_frag(xyz, ['1-2,4','3'], [0,0],[0,0], gjfhead, scrfhead, 'frag', basis, wfnpath)
# spin = 0 for singlet, 1 for doublet, ...
# please ensure sum of spins equals spin of the total system
......@@ -4,9 +4,10 @@
title
0 2
0 0
H 0.00000 0.00000 0.00000
O 0.00000 0.00000 1.00000
H 0.00000 0.00000 3.00000
-O -H
TZVP
......@@ -20,10 +21,9 @@ SDD
eps=1.0
epsinf=1.0
ExtraSph=2
ExtraSph=1
0.00000 0.00000 2.00000 1.75000
0.00000 0.00000 3.00000 1.44300
D:\xxx\yyy\frag0.wfn
......@@ -4,9 +4,8 @@
title
0 -2
0 0
O 0.00000 0.00000 2.00000
H 0.00000 0.00000 3.00000
-O -H
TZVP
......@@ -20,10 +19,11 @@ SDD
eps=1.0
epsinf=1.0
ExtraSph=2
ExtraSph=3
0.00000 0.00000 0.00000 1.44300
0.00000 0.00000 1.00000 1.75000
0.00000 0.00000 3.00000 1.44300
D:\xxx\yyy\frag1.wfn
......@@ -8,6 +8,8 @@ def from_frag(xyz, frags, chgs, spins, gjfhead='', scrfhead='', gjfname='', basi
# mol.verbose = 1
# mol.build()
#
if isinstance(frags[0], str):
frags = str2list(frags)
guess_frag(xyz, frags, chgs, spins, gjfhead.lstrip('\n'), scrfhead, gjfname, basis, wfnpath)
def spin_p2g(spin):
......@@ -17,6 +19,20 @@ def spin_p2g(spin):
spin = spin - 1
return spin
def str2list(frags):
flist = []
for frag in frags:
alist = []
for s in frag.split(','):
if '-' in s:
start = int(s.split('-')[0])
end = int(s.split('-')[1])
else:
start = int(s)
end = int(s)
alist += range(start, end+1)
flist.append(alist)
return flist
def guess_frag(xyz, frags, chgs, spins, gjfhead, scrfhead, gjfname, basis, wfnpath):
......
支持 Markdown
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册