def voropp(a, q='%v', voropp_path=VOROPP_PATH, fast=False, dump=None):
    """
    Run voro++ on current configuration and return selected quantities.
    Parameter *q* can be a list of voro++ output quantities.
    Run 'voro++ -hc' to see options.
    """
    cx, cy, cz = a.get_cell()
    lx, ly, lz = np.linalg.norm(cx), np.linalg.norm(cy), np.linalg.norm(cz)
    if abs(lx*ly*lz - a.get_volume()) > 1e-6 or 'shear_dx' in a.info:
        return voropp_for_non_orthorhombic_cells(a, q, voropp_path, fast, dump)

    x, y, z = a.get_positions().T
    f = open('tmp.voronoi', 'w')
    for jn, ( jx, jy, jz ) in enumerate(zip(x, y, z)):
        print >> f, jn, jx, jy, jz
    f.close()
    if isinstance(q, str) or isinstance(q, unicode):
        c = '%s' % format(q)
    else:
        c = reduce(lambda x,y: '{0} {1}'.format(x,y), map(lambda x: '%'+x, q))
    os.system('{0} -o -p -c "%i {1}" 0 {2} 0 {3} 0 {4} tmp.voronoi' \
              .format(voropp_path, c, lx, ly, lz))
    r = np.loadtxt('tmp.voronoi.vol', unpack=True)
    os.remove('tmp.voronoi')
    os.remove('tmp.voronoi.vol')
    
    # Sort particles according to their ids
    r = r[:,np.array(r[0,:], dtype=int)]
    if r.shape[0] == 2:
        return r[1,:]
    else:
        return r[1:,:]
def voropp ( a , q = '%v' , voropp_path = VOROPP_PATH , fast = False , dump = None ) : cx , cy , cz = a . get_cell ( ) lx , ly , lz = np . linalg . norm ( cx ) , np . linalg . norm ( cy ) , np . linalg . norm ( cz ) if abs ( lx * ly * lz - a . get_volume ( ) ) > 1e-6 or 'shear_dx' in a . info : return voropp_for_non_orthorhombic_cells ( a , q , voropp_path , fast , dump ) x , y , z = a . get_positions ( ) . T f = open ( 'tmp.voronoi' , 'w' ) for jn , ( jx , jy , jz ) in enumerate ( zip ( x , y , z ) ) : print >> f , jn , jx , jy , jz f . close ( ) if isinstance ( q , str ) or isinstance ( q , unicode ) : c = '%s' % format ( q ) else : c = reduce ( lambda x , y : '{0} {1}' . format ( x , y ) , map ( lambda x : '%' + x , q ) ) os . system ( '{0} -o -p -c "%i {1}" 0 {2} 0 {3} 0 {4} tmp.voronoi' . format ( voropp_path , c , lx , ly , lz ) ) r = np . loadtxt ( 'tmp.voronoi.vol' , unpack = True ) os . remove ( 'tmp.voronoi' ) os . remove ( 'tmp.voronoi.vol' ) r = r [ : , np . array ( r [ 0 , : ] , dtype = int ) ] if r . shape [ 0 ] == 2 : return r [ 1 , : ] else : return r [ 1 : , : ]
Run voro++ on current configuration and return selected quantities.
    Parameter *q* can be a list of voro++ output quantities.
    Run 'voro++ -hc' to see options.