Commit cb6d8a38 by Francois Gygi

modified to first fold atoms into the WS cell


git-svn-id: http://qboxcode.org/svn/qb/trunk@1416 cba15fb0-1239-40c8-b417-11db7ca47a34
parent 82b152b6
...@@ -12,6 +12,26 @@ hlist = [] ...@@ -12,6 +12,26 @@ hlist = []
def distance(a,b,sx,sy,sz): def distance(a,b,sx,sy,sz):
return math.sqrt((a[3]-b[3]-sx)**2+(a[4]-b[4]-sy)**2+(a[5]-b[5]-sz)**2) return math.sqrt((a[3]-b[3]-sx)**2+(a[4]-b[4]-sy)**2+(a[5]-b[5]-sz)**2)
def fold_in_ws(atom):
x = atom[3]
y = atom[4]
z = atom[5]
while x > 0.5*a_cell + 1.e-5:
x -= a_cell
while x < -0.5*a_cell - 1.e-5:
x += a_cell
while y > 0.5*b_cell + 1.e-5:
y -= b_cell
while y < -0.5*b_cell - 1.e-5:
y += b_cell
while z > 0.5*c_cell + 1.e-5:
z -= c_cell
while z < -0.5*c_cell - 1.e-5:
z += c_cell
atom[3] = x
atom[4] = y
atom[5] = z
f = open(sys.argv[1]) f = open(sys.argv[1])
for line in f: for line in f:
l = line.split() l = line.split()
...@@ -27,6 +47,11 @@ for line in f: ...@@ -27,6 +47,11 @@ for line in f:
elif ( l[0] == "atom" ) & ( l[2] == "hydrogen" ): elif ( l[0] == "atom" ) & ( l[2] == "hydrogen" ):
hlist.append([l[0],l[1],l[2],float(l[3]),float(l[4]),float(l[5])]) hlist.append([l[0],l[1],l[2],float(l[3]),float(l[4]),float(l[5])])
for o in olist:
fold_in_ws(o)
for h in hlist:
fold_in_ws(h)
for h in hlist: for h in hlist:
# find nearest oxygen atom in olist # find nearest oxygen atom in olist
mindist = 1.e10 mindist = 1.e10
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment