def minimize(*xxx): global args, u ## test mimimization for correction if args.testmin: vo = Voron(*u.rep) ## original Voronoi cell u = u.to_min() u_exp = u * 1 u_exp.to_decart() drawgl.clear() drawgl(vo) ## draw all atoms which are in "vo" for n, ats in u_exp: r, col = UCell.data[n] col = [x / 255.0 for x in col] for v in vo.has(ats): drawgl(v, r=r, color=col, invis=False) ## now draw all cloned Voronoi cells #import reper2dots #for v in vo.cut( u.rep.to_dots( 1, 1, 1 ) ): # drawgl( Voron( *u.rep, pos = v ) ) drawgl(Voron(*u.rep)) ## usual minimization process else: u = u.to_min() print '------------' print 'sort of minimized cell: ', u.rep.to_zell().to_sort().name print 'zell of minimized cell: ', u.rep.to_zell().norm() draw_with(drawgl)
def draw_with(eng): eng.clear() vo = Voron(*u.rep) eng(vo) u.to_decart() for n, vs in u * 1: ## for each atoms in extended unitcell r, col = UCell.data[n] col = [x / 255.0 for x in col] for v in vo.touch(vs): eng(v, r=r, color=col, invis=False) eng(n, pos=v) for v in vo.has(vs): ## only draw atoms which are in Voron cell if not vo.touch(v): eng(v, r=r, color=col, invis=False) eng(n, pos=v)
def draw_with( eng ): eng.clear() vo = Voron( *u.rep ) eng( vo ) u.to_decart() for n, vs in u*1: ## for each atoms in extended unitcell r, col = UCell.data[ n ] col = [ x/255.0 for x in col ] for v in vo.touch( vs ): eng( v, r = r, color = col, invis = False ) eng( n, pos = v ) for v in vo.has( vs ): ## only draw atoms which are in Voron cell if not vo.touch( v ): eng( v, r = r, color = col, invis = False ) eng( n, pos = v )
def draw_with( eng ): eng.clear() vo = Voron( *u.rep ) eng( vo ) u.to_decart() if args.atoms: for n, vs in u*1: ## for each atoms in extended unitcell r, col = UCell.data[ n ] col = [ x/255.0 for x in col ] for v in vo.touch( vs ): eng( v, r = r, color = col, invis = False ) eng( n, pos = v ) for v in vo.has( vs ): ## only draw atoms which are in Voron cell if not vo.touch( v ): eng( v, r = r, color = col, invis = False ) eng( n, pos = v ) if args.wycksub: u.to_fract() Z = u.to_min().rep.minimize().to_zell().norm() for wname, ws in zip( 'abcdefghijklmnopqrstuvwxyz', c.spgrp.wyckpos() ): for n, vs in u_basis: for v in vs: if v in ws: print '--(%s)-->' % wname, n, v, c.spgrp * v, u4min = UCell( u_basis.rep ) u4min.add( 'A', ws ) u4min = u4min.to_min() z = u4min.rep.minimize().to_zell().norm() if Z != z: print 'FOUND %s' % z.to_sort() vo = Voron( *u4min.rep ) eng( vo ) else: print 'not wyck sublattice'
def minimize( *xxx ): global args, u ## test mimimization for correction if args.testmin: vo = Voron( *u.rep ) ## original Voronoi cell u = u.to_min() u_exp = u * 1 u_exp.to_decart() drawgl.clear() drawgl( vo ) ## draw all atoms which are in "vo" for n, ats in u_exp: r, col = UCell.data[ n ] col = [ x/255.0 for x in col ] for v in vo.has( ats ): drawgl( v, r = r, color = col, invis = False ) ## now draw all cloned Voronoi cells #import reper2dots #for v in vo.cut( u.rep.to_dots( 1, 1, 1 ) ): # drawgl( Voron( *u.rep, pos = v ) ) drawgl( Voron( *u.rep ) ) ## usual minimization process else: u = u.to_min() print '------------' print 'sort of minimized cell: ', u.rep.to_zell().to_sort().name print 'zell of minimized cell: ', u.rep.to_zell().norm() draw_with( drawgl )
def draw_with(eng): eng.clear() vo = Voron(*u.rep) eng(vo) u.to_decart() if args.atoms: for n, vs in u * 1: ## for each atoms in extended unitcell r, col = UCell.data[n] col = [x / 255.0 for x in col] for v in vo.touch(vs): eng(v, r=r, color=col, invis=False) eng(n, pos=v) for v in vo.has( vs): ## only draw atoms which are in Voron cell if not vo.touch(v): eng(v, r=r, color=col, invis=False) eng(n, pos=v) if args.wycksub: u.to_fract() Z = u.to_min().rep.minimize().to_zell().norm() for wname, ws in zip('abcdefghijklmnopqrstuvwxyz', c.spgrp.wyckpos()): for n, vs in u_basis: for v in vs: if v in ws: print '--(%s)-->' % wname, n, v, c.spgrp * v, u4min = UCell(u_basis.rep) u4min.add('A', ws) u4min = u4min.to_min() z = u4min.rep.minimize().to_zell().norm() if Z != z: print 'FOUND %s' % z.to_sort() vo = Voron(*u4min.rep) eng(vo) else: print 'not wyck sublattice'