#! /usr/bin/env python """ helium.py is a program which generates a 3D animation of a clasical Helium atom Run the program and rotate the image in 3D. Paul Eugenio PHZ4151C Jan 27, 2019 """ import numpy as np import vpython as vp import sys # constructing the Helium nucleous # # using red spheres for protons and blue # spheres for neutrons # proton1 = vp.sphere( pos=vp.vector(0.1,0,0), radius=0.1, color=vp.color.red ) proton2 = vp.sphere( pos=vp.vector(-0.1,0,0), radius=0.1, color=vp.color.red ) neutron1 = vp.sphere( pos=vp.vector(0,0,0.1), radius=0.1, color=vp.color.blue ) neutron2 = vp.sphere( pos=vp.vector(0,0,-0.1), radius=0.1, color=vp.color.blue ) makeTrail = False electron1 = vp.sphere( pos=vp.vector(1,0,0), radius=0.03, color=vp.color.yellow, make_trail=makeTrail ) electron2 = vp.sphere( pos=vp.vector(0,1,0), radius=0.03, color=vp.color.yellow, make_trail=makeTrail ) rateOfTime = 50 if len(sys.argv) > 1: rateOfTime = int(sys.argv[1]) theta, z = 0.0, 0.0 while True: # Do the loop forever theta += 0.1 vp.rate(rateOfTime) x = np.cos(theta) y = np.sin(theta) electron1.pos = vp.vector(x,y,z) electron2.pos = vp.vector(z,x,y) # #