I am trying to calculate voronoi volume of a water surronded by nearest oxygen. This is my code.
from numpy import *
import glob
box = 3.73014
list_of_files = glob.glob('./npt11.txt')
for file_name in list_of_files:
f = loadtxt(file_name, float)
g = zeros(3)
# Specify a Donor water molecule's coordinate
for i in range(0,5181,3):
# Donor Oxygen vector
x_DO = f[i, 0]
y_DO = f[i, 1]
z_DO = f[i, 2]
r_DO = [x_DO, y_DO, z_DO]
# Specify an around water molecules
# DOAO vector list included in cut-off
list_of_DOAO = []
for j in range(i+3,5184,3):
x_AO = f[j,0]
y_AO = f[j,1]
z_AO = f[j,2]
# DO-AO vector using periodic boundary condition
x_DOAO = x_AO - x_DO
x_DOAO = x_DOAO - box*round(x_DOAO/box)
y_DOAO = y_AO - y_DO
y_DOAO = y_DOAO - box*round(y_DOAO/box)
z_DOAO = z_AO - z_DO
z_DOAO = z_DOAO - box*round(z_DOAO/box)
r_DOAO = [x_DOAO, y_DOAO, z_DOAO]
r_DOAO_rev = [-x_DOAO, -y_DOAO, -z_DOAO]
# DO-AO vector length
rc = sqrt(dot(r_DOAO, r_DOAO))
# Cut-off calculation
# 1. Spherical searching of DO-AO distance
if rc < 0.35:
# Store the list of AO within the cut-off distance
list_of_DOAO.append(r_DOAO)
points = array(list_of_DOAO)
ConvexHull(points)
At this point, I got an error like
--------------------------------------------------------------------------------
QhullError Traceback (most recent call last)
in ()
98 list_of_DOAO.append(r_DOAO)
99 points = array(list_of_DOAO)
--> 100 ConvexHull(points)
101
qhull.pyx in scipy.spatial.qhull.ConvexHull.__init__()
qhull.pyx in scipy.spatial.qhull._Qhull.__init__()
QhullError: QH6214 qhull input error: not enough points(3) to construct initial simplex (need 4)
While executing: | qhull i Qt
Options selected for Qhull 2015.2.r 2016/01/18:
run-id 1666097638 incidence Qtriangulate _pre-merge _zero-centrum
--------------------------------------------------------------------------------
How could I fix them?