Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Using John Palmieri's suggestion I will create a default dictionary of single bonds and an empty dictionary for pi bonds:

sigma_bonds = { A1 : [A2, A6], A2 : [A1, A3], A3 : [A2, A4], A4: [A3, A5], A5: [A4, A6], A6: [A5, A1] }

pi_bonds = { }

When a user adds a pi bond pair ie, A1-A2, I can delete the pairing from the default dictionary and add them to a second dictionary for pi bonds or something to that effect:

sigma_bonds = { A1 : [A6], A2 : [A3], A3 : [A2, A4], A4: [A3, A5], A5: [A4, A6], A6: [A5, A1] }

pi_bonds = {A1: A2}

I was not aware that lists could be entered into dictionaries and this will make my work much easier.

Using John Palmieri's suggestion I will create a default dictionary of single bonds and an empty dictionary for pi bonds:

sigma_bonds = { A1 : [A2, A6], A2 : [A1, A3], A3 : [A2, A4], A4: [A3, A5], A5: [A4, A6], A6: [A5, A1] }

pi_bonds = { }

When a user adds a pi bond pair ie, A1-A2, I can delete the pairing from the default dictionary and add them to a second the pi bond dictionary for pi bonds or something to that effect:

sigma_bonds = { A1 : [A6], A2 : [A3], A3 : [A2, A4], A4: [A3, A5], A5: [A4, A6], A6: [A5, A1] }

pi_bonds = {A1: A2}

I was not aware that lists could be entered into dictionaries and this will make my work much easier.

Using John Palmieri's suggestion I will create created a default dictionary of single bonds and an empty dictionary for pi bonds:

sigma_bonds = { A1 : [A2, A6], A2 : [A1, A3], A3 : [A2, A4], A4: [A3, A5], A5: [A4, A6], A6: [A5, A1] }

pi_bonds = { }

When a user adds a pi bond pair ie, A1-A2, I can delete is added to Pi_Dict, the pairing from the default dictionary and add them to the pi bond dictionary something to that effect:Sigma_Dict is deleted

sigma_bonds = { A1 : [A6], A2 : [A3], A3 : [A2, A4], A4: [A3, A5], A5: [A4, A6], A6: [A5, A1] }

pi_bonds = {A1: A2}

I was not aware that lists could be entered into dictionaries and this will make my work much easier.

Updated code:

import sys
from sage.plot.plot3d.shapes import LineSegment, Sphere
from sage.plot.colors import rainbow
from sage.plot.plot3d.implicit_plot3d import implicit_plot3d
from sage.plot.plot3d.shapes2 import text3d
from sage.repl.rich_output.pretty_print import show

Radii = {'O': 0.73, 'N': 0.75, 'C': 0.77, 'He': 0.32, 'H': 0.37, 'S': 1.02, 'Cl': 0.99, 
    'F': 0.71, 'Xe': 1.30, 'Si': 1.11, 'B': 0.82, 'P': 1.06, 'Br': 1.14}

Valency = {'O': 6, 'N': 5, 'C': 4, 'He': 0, 'H': 1, 'S': 6, 'Cl': 7, 
    'F': 7, 'Xe': 8, 'Si': 4, 'B': 3, 'P': 5, 'Br': 7}

Colors = {'O': 'red', 'N': 'green', 'C': 'black', 'He': 'cyan', 'H': 'white', 'S': 'yellow',
    'Si': 'purple', 'Xe': 'pink', 'F': 'blue', 'Cl': 'green', 'B': 'pink', 'P': 'orange',
    'Br': 'red'}

Axis = str(input('Enter x axis shift or press enter for default: '))

def X_Shift(x):
    return x
def Radius(x):
    y = Normalize(Radii[str(x)])
    return float(y)
def Color(x):
    y = Colors[x]
    return y
def distance(A,B):
    D = float(((B[0]-A[0])**2 + (B[1]-A[1])**2 + (B[2]-A[2])**2)**(1/2))
    return D
def Normalize(x):
    x = (float(x)/0.77)*0.20
    return x

X = int((X_Shift(Axis)))

O = (X,0,0)

A2 = (X, 1, 0.559)
A3 = (X, 1, -0.559)

A5 = (X, -1, -0.559)
A6 = (X, -1, 0.559)

A1 = (X, 0, distance(A2,A3))
A4 = (X, 0,-1*distance(A2,A3))

Sigma_Dict = { 'A1-A2' : [A1,A2], 'A2-A3' : [A2,A3], 'A3-A4' : [A3,A4], 'A4-A5' : [A4,A5], 'A5-A6' : [A5,A6], 'A1-A6' : [A1, A6] }

Pi_Dict = { 'A1-A2' : [A1,A2], 'A5-A6' : [A5,A6], 'A3-A4': [A3,A4] }

Atomic_Position = { A1: 'Br', A2: 'C', A3: 'Cl', A4: 'C', A5: 'B', A6: 'C' }

def bond_split(AxAy):
    x = AxAy[0]
    y = AxAy[1]
    return(x,y)

def single_bond(x,y):
    Bond = LineSegment(x, y, 2, color='white', axes=False, frame=False)
    return Bond

def pi_bond(Cx,Cy):
    X = 0.05
    if Cx[1] == Cy[1]:
        Ca = Cx[1]-X
        Cb = Cx[1]+X
        Cc = Cy[1]-X
        Cd = Cy[1]+X
        Cx1 = (Cx[0], Ca, Cx[2])
        Cx2 = (Cx[0], Cb, Cx[2])
        Cy1 = (Cy[0], Cc, Cy[2])
        Cy2 = (Cy[0], Cd, Cy[2])
        D1 = LineSegment(Cx1, Cy1, 1, color='white', axes=False, frame=False)
        D2 = LineSegment(Cx2, Cy2, 1, color='white', axes=False, frame=False)
        return (D1,D2)
    else:
        Ca = Cx[2]-X
        Cb = Cx[2]+X
        Cc = Cy[2]-X
        Cd = Cy[2]+X
        Cx1 = (Cx[0], Cx[1], Ca)
        Cx2 = (Cx[0], Cx[1], Cb)
        Cy1 = (Cy[0], Cy[1], Cc)
        Cy2 = (Cy[0], Cy[1], Cd)
        D1 = LineSegment(Cx1, Cy1, 1, color='white', axes=False, frame=False)
        D2 = LineSegment(Cx2, Cy2, 1, color='white', axes=False, frame=False)
        return (D1,D2)

Benzene = Sphere(.000001, color='white').translate(O)

for atom in Atomic_Position:
    Benzene += Sphere(Normalize(Radii[Atomic_Position[atom]]), color=Colors[Atomic_Position[atom]]).translate(atom)

for pi in Pi_Dict:
    if pi in Sigma_Dict:
        del Sigma_Dict[pi]

for pi in Pi_Dict:
    Benzene += pi_bond(bond_split(Pi_Dict[pi])[0],bond_split(Pi_Dict[pi])[1])[0]
    Benzene += pi_bond(bond_split(Pi_Dict[pi])[0],bond_split(Pi_Dict[pi])[1])[1]

for bond in Sigma_Dict:
    Benzene += LineSegment(bond_split(Sigma_Dict[bond])[0],bond_split(Sigma_Dict[bond])[1], 1, color= 'white' )

show(Benzene)

Using John Palmieri's suggestion I created a default dictionary of single bonds and an empty dictionary for pi bonds:

When a pi bond pair is added to Pi_Dict, the pairing from Sigma_Dict is deleted

I was not aware that lists could be entered into dictionaries and this will make my work much easier.

Updated code:

import sys
from sage.plot.plot3d.shapes import LineSegment, Sphere
from sage.plot.colors import rainbow
from sage.plot.plot3d.implicit_plot3d import implicit_plot3d
from sage.plot.plot3d.shapes2 import text3d
from sage.repl.rich_output.pretty_print import show

Radii = {'O': 0.73, 'N': 0.75, 'C': 0.77, 'He': 0.32, 'H': 0.37, 'S': 1.02, 'Cl': 0.99, 
    'F': 0.71, 'Xe': 1.30, 'Si': 1.11, 'B': 0.82, 'P': 1.06, 'Br': 1.14}

Valency = {'O': 6, 'N': 5, 'C': 4, 'He': 0, 'H': 1, 'S': 6, 'Cl': 7, 
    'F': 7, 'Xe': 8, 'Si': 4, 'B': 3, 'P': 5, 'Br': 7}

Colors = {'O': 'red', 'N': 'green', 'C': 'black', 'He': 'cyan', 'H': 'white', 'S': 'yellow',
    'Si': 'purple', 'Xe': 'pink', 'F': 'blue', 'Cl': 'green', 'B': 'pink', 'P': 'orange',
    'Br': 'red'}

Axis = str(input('Enter X = int(input('Enter x axis shift or press enter for default: '))

def X_Shift(x):
    return x
def Radius(x):
    y = Normalize(Radii[str(x)])
    return float(y)
def Color(x):
    y = Colors[x]
    return y
def distance(A,B):
    D = float(((B[0]-A[0])**2 + (B[1]-A[1])**2 + (B[2]-A[2])**2)**(1/2))
    return D
def Normalize(x):
    x = (float(x)/0.77)*0.20
    return x

X = int((X_Shift(Axis)))

O = (X,0,0)

A2 = (X, 1, 0.559)
A3 = (X, 1, -0.559)

A5 = (X, -1, -0.559)
A6 = (X, -1, 0.559)

A1 = (X, 0, distance(A2,A3))
A4 = (X, 0,-1*distance(A2,A3))

Sigma_Dict = { 'A1-A2' : [A1,A2], 'A2-A3' : [A2,A3], 'A3-A4' : [A3,A4], 'A4-A5' : [A4,A5], 'A5-A6' : [A5,A6], 'A1-A6' : [A1, A6] }

Pi_Dict = { 'A1-A2' : [A1,A2], 'A5-A6' : [A5,A6], 'A3-A4': [A3,A4] }

Atomic_Position = { A1: 'Br', A2: 'C', A3: 'Cl', A4: 'C', A5: 'B', A6: 'C' }

def bond_split(AxAy):
    x = AxAy[0]
    y = AxAy[1]
    return(x,y)

def single_bond(x,y):
    Bond = LineSegment(x, y, 2, color='white', axes=False, frame=False)
    return Bond

def pi_bond(Cx,Cy):
    X = 0.05
    if Cx[1] == Cy[1]:
        Ca = Cx[1]-X
        Cb = Cx[1]+X
        Cc = Cy[1]-X
        Cd = Cy[1]+X
        Cx1 = (Cx[0], Ca, Cx[2])
        Cx2 = (Cx[0], Cb, Cx[2])
        Cy1 = (Cy[0], Cc, Cy[2])
        Cy2 = (Cy[0], Cd, Cy[2])
        D1 = LineSegment(Cx1, Cy1, 1, color='white', axes=False, frame=False)
        D2 = LineSegment(Cx2, Cy2, 1, color='white', axes=False, frame=False)
        return (D1,D2)
    else:
        Ca = Cx[2]-X
        Cb = Cx[2]+X
        Cc = Cy[2]-X
        Cd = Cy[2]+X
        Cx1 = (Cx[0], Cx[1], Ca)
        Cx2 = (Cx[0], Cx[1], Cb)
        Cy1 = (Cy[0], Cy[1], Cc)
        Cy2 = (Cy[0], Cy[1], Cd)
        D1 = LineSegment(Cx1, Cy1, 1, color='white', axes=False, frame=False)
        D2 = LineSegment(Cx2, Cy2, 1, color='white', axes=False, frame=False)
        return (D1,D2)

Benzene = Sphere(.000001, color='white').translate(O)

for atom in Atomic_Position:
    Benzene += Sphere(Normalize(Radii[Atomic_Position[atom]]), color=Colors[Atomic_Position[atom]]).translate(atom)

for pi in Pi_Dict:
    if pi in Sigma_Dict:
        del Sigma_Dict[pi]

for pi in Pi_Dict:
    Benzene += pi_bond(bond_split(Pi_Dict[pi])[0],bond_split(Pi_Dict[pi])[1])[0]
    Benzene += pi_bond(bond_split(Pi_Dict[pi])[0],bond_split(Pi_Dict[pi])[1])[1]

for bond in Sigma_Dict:
    Benzene += LineSegment(bond_split(Sigma_Dict[bond])[0],bond_split(Sigma_Dict[bond])[1], 1, color= 'white' )

show(Benzene)

Using John Palmieri's suggestion I created a default dictionary of single bonds and an empty dictionary for pi bonds:

When a pi bond pair is added to Pi_Dict, the pairing from Sigma_Dict is deleted

I was not aware that lists could be entered into dictionaries and this will make my work much easier.

Updated code:

import sys
from sage.plot.plot3d.shapes import LineSegment, Sphere
from sage.plot.colors import rainbow
from sage.plot.plot3d.implicit_plot3d import implicit_plot3d
from sage.plot.plot3d.shapes2 import text3d
from sage.repl.rich_output.pretty_print import show

Radii = {'O': 0.73, 'N': 0.75, 'C': 0.77, 'He': 0.32, 'H': 0.37, 'S': 1.02, 'Cl': 0.99, 
    'F': 0.71, 'Xe': 1.30, 'Si': 1.11, 'B': 0.82, 'P': 1.06, 'Br': 1.14}

Valency = {'O': 6, 'N': 5, 'C': 4, 'He': 0, 'H': 1, 'S': 6, 'Cl': 7, 
    'F': 7, 'Xe': 8, 'Si': 4, 'B': 3, 'P': 5, 'Br': 7}

Colors = {'O': 'red', 'N': 'green', 'C': 'black', 'He': 'cyan', 'H': 'white', 'S': 'yellow',
    'Si': 'purple', 'Xe': 'pink', 'F': 'blue', 'Cl': 'green', 'B': 'pink', 'P': 'orange',
    'Br': 'red'}

X = int(input('Enter x axis shift or press enter for default: '))

def X_Shift(x):
    return x
def Radius(x):
    y = Normalize(Radii[str(x)])
    return float(y)
def Color(x):
    y = Colors[x]
    return y
def distance(A,B):
    D = float(((B[0]-A[0])**2 + (B[1]-A[1])**2 + (B[2]-A[2])**2)**(1/2))
    return D
def Normalize(x):
    x = (float(x)/0.77)*0.20
    return x

O = (X,0,0)

A2 = (X, 1, 0.559)
A3 = (X, 1, -0.559)

A5 = (X, -1, -0.559)
A6 = (X, -1, 0.559)

A1 = (X, 0, distance(A2,A3))
A4 = (X, 0,-1*distance(A2,A3))

Sigma_Dict = { 'A1-A2' : [A1,A2], 'A2-A3' : [A2,A3], 'A3-A4' : [A3,A4], 'A4-A5' : [A4,A5], 'A5-A6' : [A5,A6], 'A1-A6' : [A1, A6] }

Pi_Dict = { 'A1-A2' : [A1,A2], 'A5-A6' : [A5,A6], 'A3-A4': [A3,A4] }

Atomic_Position = { A1: 'Br', A2: 'C', A3: 'Cl', A4: 'C', A5: 'B', A6: 'C' }

def bond_split(AxAy):
    x = AxAy[0]
    y = AxAy[1]
    return(x,y)

def single_bond(x,y):
    Bond = LineSegment(x, y, 2, color='white', axes=False, frame=False)
    return Bond

def pi_bond(Cx,Cy):
    X = 0.05
    if Cx[1] == Cy[1]:
        Ca = Cx[1]-X
        Cb = Cx[1]+X
        Cc = Cy[1]-X
        Cd = Cy[1]+X
        Cx1 = (Cx[0], Ca, Cx[2])
        Cx2 = (Cx[0], Cb, Cx[2])
        Cy1 = (Cy[0], Cc, Cy[2])
        Cy2 = (Cy[0], Cd, Cy[2])
        D1 = LineSegment(Cx1, Cy1, 1, color='white', axes=False, frame=False)
        D2 = LineSegment(Cx2, Cy2, 1, color='white', axes=False, frame=False)
        return (D1,D2)
    else:
        Ca = Cx[2]-X
        Cb = Cx[2]+X
        Cc = Cy[2]-X
        Cd = Cy[2]+X
        Cx1 = (Cx[0], Cx[1], Ca)
        Cx2 = (Cx[0], Cx[1], Cb)
        Cy1 = (Cy[0], Cy[1], Cc)
        Cy2 = (Cy[0], Cy[1], Cd)
        D1 = LineSegment(Cx1, Cy1, 1, color='white', axes=False, frame=False)
        D2 = LineSegment(Cx2, Cy2, 1, color='white', axes=False, frame=False)
        return (D1,D2)

Benzene = Sphere(.000001, color='white').translate(O)

for atom in Atomic_Position:
    Benzene += Sphere(Normalize(Radii[Atomic_Position[atom]]), color=Colors[Atomic_Position[atom]]).translate(atom)

for pi in Pi_Dict:
    if pi in Sigma_Dict:
        del Sigma_Dict[pi]

for pi in Pi_Dict:
    Benzene += pi_bond(bond_split(Pi_Dict[pi])[0],bond_split(Pi_Dict[pi])[1])[0]
    Benzene += pi_bond(bond_split(Pi_Dict[pi])[0],bond_split(Pi_Dict[pi])[1])[1]

for bond in Sigma_Dict:
    Benzene += LineSegment(bond_split(Sigma_Dict[bond])[0],bond_split(Sigma_Dict[bond])[1], 1, color= 'white' )

show(Benzene)

Using John Palmieri's suggestion I created a default dictionary of single bonds and an empty dictionary for pi bonds:

When a pi bond pair is added to Pi_Dict, the pairing from Sigma_Dict is deleted

I was not aware that lists could be entered into dictionaries and this will make my work much easier.

Updated code:

import sys
from sage.plot.plot3d.shapes import LineSegment, Sphere
from sage.plot.colors import rainbow
from sage.plot.plot3d.implicit_plot3d import implicit_plot3d
from sage.plot.plot3d.shapes2 import text3d
from sage.repl.rich_output.pretty_print import show

Radii = {'O': 0.73, 'N': 0.75, 'C': 0.77, 'He': 0.32, 'H': 0.37, 'S': 1.02, 'Cl': 0.99, 
    'F': 0.71, 'Xe': 1.30, 'Si': 1.11, 'B': 0.82, 'P': 1.06, 'Br': 1.14}

Valency = {'O': 6, 'N': 5, 'C': 4, 'He': 0, 'H': 1, 'S': 6, 'Cl': 7, 
    'F': 7, 'Xe': 8, 'Si': 4, 'B': 3, 'P': 5, 'Br': 7}

Colors = {'O': 'red', 'N': 'green', 'C': 'black', 'He': 'cyan', 'H': 'white', 'S': 'yellow',
    'Si': 'purple', 'Xe': 'pink', 'F': 'blue', 'Cl': 'green', 'B': 'pink', 'P': 'orange',
    'Br': 'red'}

X = int(input('Enter x axis shift or press enter for default: '))

def Radius(x):
    y = Normalize(Radii[str(x)])
    return float(y)
def Color(x):
    y = Colors[x]
    return y
def distance(A,B):
    D = float(((B[0]-A[0])**2 + (B[1]-A[1])**2 + (B[2]-A[2])**2)**(1/2))
    return D
def Normalize(x):
    x = (float(x)/0.77)*0.20
    return x

O = (X,0,0)

A2 = (X, 1, 0.559)
A3 = (X, 1, -0.559)
 A5 = (X, -1, -0.559)
A6 = (X, -1, 0.559)
 A1 = (X, 0, distance(A2,A3))
A4 = (X, 0,-1*distance(A2,A3))

Sigma_Dict = { 'A1-A2' : [A1,A2], 'A2-A3' : [A2,A3], 'A3-A4' : [A3,A4], 'A4-A5' : [A4,A5], 'A5-A6' : [A5,A6], 'A1-A6' : [A1, A6] }

Pi_Dict = { 'A1-A2' : [A1,A2], 'A5-A6' : [A5,A6], 'A3-A4': [A3,A4] }

Atomic_Position = { A1: 'Br', A2: 'C', A3: 'Cl', A4: 'C', A5: 'B', A6: 'C' }

def bond_split(AxAy):
    x = AxAy[0]
    y = AxAy[1]
    return(x,y)

def single_bond(x,y):
    Bond = LineSegment(x, y, 2, color='white', axes=False, frame=False)
    return Bond

def pi_bond(Cx,Cy):
    X = 0.05
    if Cx[1] == Cy[1]:
        Ca = Cx[1]-X
        Cb = Cx[1]+X
        Cc = Cy[1]-X
        Cd = Cy[1]+X
        Cx1 = (Cx[0], Ca, Cx[2])
        Cx2 = (Cx[0], Cb, Cx[2])
        Cy1 = (Cy[0], Cc, Cy[2])
        Cy2 = (Cy[0], Cd, Cy[2])
        D1 = LineSegment(Cx1, Cy1, 1, color='white', axes=False, frame=False)
        D2 = LineSegment(Cx2, Cy2, 1, color='white', axes=False, frame=False)
        return (D1,D2)
    else:
        Ca = Cx[2]-X
        Cb = Cx[2]+X
        Cc = Cy[2]-X
        Cd = Cy[2]+X
        Cx1 = (Cx[0], Cx[1], Ca)
        Cx2 = (Cx[0], Cx[1], Cb)
        Cy1 = (Cy[0], Cy[1], Cc)
        Cy2 = (Cy[0], Cy[1], Cd)
        D1 = LineSegment(Cx1, Cy1, 1, color='white', axes=False, frame=False)
        D2 = LineSegment(Cx2, Cy2, 1, color='white', axes=False, frame=False)
        return (D1,D2)

Benzene = Sphere(.000001, color='white').translate(O)

for atom in Atomic_Position:
    Benzene += Sphere(Normalize(Radii[Atomic_Position[atom]]), color=Colors[Atomic_Position[atom]]).translate(atom)

for pi in Pi_Dict:
    if pi in Sigma_Dict:
        del Sigma_Dict[pi]

for pi in Pi_Dict:
    Benzene += pi_bond(bond_split(Pi_Dict[pi])[0],bond_split(Pi_Dict[pi])[1])[0]
    Benzene += pi_bond(bond_split(Pi_Dict[pi])[0],bond_split(Pi_Dict[pi])[1])[1]

for bond in Sigma_Dict:
    Benzene += LineSegment(bond_split(Sigma_Dict[bond])[0],bond_split(Sigma_Dict[bond])[1], 1, color= 'white' )

show(Benzene)

Using John Palmieri's suggestion I created a default dictionary of single bonds and an empty dictionary for pi bonds:

When a pi bond pair is added to Pi_Dict, the pairing from Sigma_Dict is deleted

I was not aware that lists could be entered into dictionaries and this will make my work much easier.

Updated code:

import sys
from sage.plot.plot3d.shapes import LineSegment, Sphere
from sage.plot.colors import rainbow
from sage.plot.plot3d.implicit_plot3d import implicit_plot3d
from sage.plot.plot3d.shapes2 import text3d
from sage.repl.rich_output.pretty_print import show

Radii = {'O': 0.73, 'N': 0.75, 'C': 0.77, 'He': 0.32, 'H': 0.37, 'S': 1.02, 'Cl': 0.99, 
    'F': 0.71, 'Xe': 1.30, 'Si': 1.11, 'B': 0.82, 'P': 1.06, 'Br': 1.14}

Valency = {'O': 6, 'N': 5, 'C': 4, 'He': 0, 'H': 1, 'S': 6, 'Cl': 7, 
    'F': 7, 'Xe': 8, 'Si': 4, 'B': 3, 'P': 5, 'Br': 7}

Colors = {'O': 'red', 'N': 'green', 'C': 'black', 'He': 'cyan', 'H': 'white', 'S': 'yellow',
    'Si': 'purple', 'Xe': 'pink', 'F': 'blue', 'Cl': 'green', 'B': 'pink', 'P': 'orange',
    'Br': 'red'}

X = int(input('Enter x axis shift or press enter for default: '))

def distance(A,B):
    D = float(((B[0]-A[0])**2 + (B[1]-A[1])**2 + (B[2]-A[2])**2)**(1/2))
    return D
def Normalize(x):
    x = (float(x)/0.77)*0.20
    return x

O = (X,0,0)

A2 = (X, 1, 0.559)
A3 = (X, 1, -0.559)
A5 = (X, -1, -0.559)
A6 = (X, -1, 0.559)
A1 = (X, 0, distance(A2,A3))
A4 = (X, 0,-1*distance(A2,A3))

Sigma_Dict = { 'A1-A2' : [A1,A2], 'A2-A3' : [A2,A3], 'A3-A4' : [A3,A4], 'A4-A5' : [A4,A5], 'A5-A6' : [A5,A6], 'A1-A6' : [A1, A6] }

Pi_Dict = { 'A1-A2' : [A1,A2], 'A5-A6' : [A5,A6], 'A3-A4': [A3,A4] }

Atomic_Position = { A1: 'Br', A2: 'C', A3: 'Cl', A4: 'C', A5: 'B', A6: 'C' }

def bond_split(AxAy):
    x = AxAy[0]
    y = AxAy[1]
    return(x,y)

def pi_bond(Cx,Cy):
    X = 0.05
    if Cx[1] == Cy[1]:
        Ca = Cx[1]-X
        Cb = Cx[1]+X
        Cc = Cy[1]-X
        Cd = Cy[1]+X
        Cx1 = (Cx[0], Ca, Cx[2])
        Cx2 = (Cx[0], Cb, Cx[2])
        Cy1 = (Cy[0], Cc, Cy[2])
        Cy2 = (Cy[0], Cd, Cy[2])
        D1 D = LineSegment(Cx1, Cy1, 1, color='white', axes=False, frame=False)
        D2 = D += LineSegment(Cx2, Cy2, 1, color='white', axes=False, frame=False)
        return (D1,D2)
(D)
    else:
        Ca = Cx[2]-X
        Cb = Cx[2]+X
        Cc = Cy[2]-X
        Cd = Cy[2]+X
        Cx1 = (Cx[0], Cx[1], Ca)
        Cx2 = (Cx[0], Cx[1], Cb)
        Cy1 = (Cy[0], Cy[1], Cc)
        Cy2 = (Cy[0], Cy[1], Cd)
        D1 D = LineSegment(Cx1, Cy1, 1, color='white', axes=False, frame=False)
        D2 = D += LineSegment(Cx2, Cy2, 1, color='white', axes=False, frame=False)
        return (D1,D2)
(D)

Benzene = Sphere(.000001, color='white').translate(O)

for atom in Atomic_Position:
    Benzene += Sphere(Normalize(Radii[Atomic_Position[atom]]), color=Colors[Atomic_Position[atom]]).translate(atom)

for pi in Pi_Dict:
    if pi in Sigma_Dict:
        del Sigma_Dict[pi]

for pi in Pi_Dict:
    Benzene += pi_bond(bond_split(Pi_Dict[pi])[0],bond_split(Pi_Dict[pi])[1])[0]
    Benzene += pi_bond(bond_split(Pi_Dict[pi])[0],bond_split(Pi_Dict[pi])[1])[1]
pi_bond(bond_split(Pi_Dict[pi])[0],bond_split(Pi_Dict[pi])[1])

for bond in Sigma_Dict:
    Benzene += LineSegment(bond_split(Sigma_Dict[bond])[0],bond_split(Sigma_Dict[bond])[1], 1, color= 'white' )

show(Benzene)