Basic matalb assignment is attached
Project C - description Gateway Computing: MATLAB Project C: Build Your Own Carbon Nanotube Planning Due Friday, March 15 by 7pm; Project Due Sunday, March 31 at 5pm The Problem The last three decades have seen the advent of engineering on the atomic scale: nanotechnology. One ignition point for this explosion of activity was the first imaging of a carbon nanotube by a research group at NEC in Japan in 1991. Their microscopic images generated a great deal of excitement because they revealed that carbon, in addition to forming the backbone of life, was also able to form a large number of other interesting geometric structures that could comprise the building blocks for new materials and structures. By 1996 researchers at Rice University in the US had been able to produce these materials in a controlled manner, opening up the possibility to test the properties of these new carbon structures. The results have been wonderfully surprising. Depending on the structure of these objects they can act as metals or as semiconductors. So, they could potentially play a wide variety of roles in a new generation of electronics built on the molecular scale. They are also extremely stiff and strong per unit weight, leading to the conjecture that they could serve to make new super strong composite materials. While most of these applications remain unrealized, a good deal of active work is going on to bring these materials to market. Nanotubes have a very interesting structure. Essentially you can think of a nanotube as a rolled-up graphite sheet. Consider the diagram below: The hexagonal pattern represents the graphite sheet. Each carbon atom sits at a vertex and is bonded to 3 other carbon atoms. To make your nanotube you must cut out a rectangle (the shaded area in the diagram) from the carbon sheet, and then roll it up to create a tube aligned along one of the cuts (T in the diagram). The trick is that you cannot choose just any rectangle; the side that will comprise the mouth of the tube must start at a carbon atom and end at a carbon atom. The result is that there exist an infinite, but countable, number of nanotube structures that can be made. To denote what kind of tube they are considering, scientists draw two vectors denoted a1 and a2 in the diagram. Each vector represents a hop from one carbon atom to another. The side that will become the mouth of the tube is determined by two integers n and m. The mouth of the tube (Ch in the diagram) then extends from the carbon atom at the origin to the one that is reached by making n hops in the a1 direction and m hops in the a2 direction. It turns out that all the possible tubes can be represented by combinations of positive integers n and m such that m is less than or equal to n. The Project Assignment Your assignment is to write • a function to create a graphene sheet of any (n,m) orientation, and • a function that will construct a carbon nanotube by calling the function you made to create the graphene sheet Each function will output the data as a Nx3 matrix where N is the number of atoms. The columns of the output matrix will contain the following data about the atoms: x-position y-position z-position You are being provided with a third function called atomplot that will graphically represent the atoms as spheres connected by lines representing the bonds. For the graphite sheets, the orientation should be determined as illustrated and described on the previous page with the origin at the atom that sits at the leftmost corner of the sheet. In the graphene sheet all z values will be zero. For the nanotube the z axis should be through the center of the tube and the x axis should pass through the atom that was originally at the origin. All lengths will be measured in units of the carbon-carbon bond length; so, bonded atoms are a distance 1.0 apart. When the function is called the user must pass input that specifies 1. The values of n and m that describe the orientation of the graphite sheet or the chirality of the tube structure 2. The length of the sheet or tube as measured in carbon-carbon bond lengths. The resulting matrix should be examined by running atomplot. Use the Orbit Camera tool on the Camera Toolbar to look at your tube from various directions to check the structure. To turn on the Camera Toolbar look in the View menu. Helpful Hints 1. Start by assuming that m=0. Then alter your code to deal with cases where m is non-zero. 2. To define the rectangle you will have to find a vector perpendicular to the vector that describes the tube structure. I suggest you use the following method: a. Find the normal vector that corresponds to the Ch vector by dividing the x and y coordinates by the length of the Ch vector. Let’s refer to this normal vector as (nx, ny) b. The normal vector for the perpendicular edge is then (-ny, nx) c. To find the perpendicular vector multiply this by the length. 3. Note that the hexagonal sheet for graphite can be thought of as a rectangular array on which some atoms have been moved a little bit in the y-direction: In the above diagram the numbers on the left are not meant to be locations in space, but rather a numbering system in which each atom is assigned two integers that uniquely identify that atom. To get regular hexagons on the right the boxes on the left would have to be 1.5 carbon-carbon bonds high and √3 carbon-carbon bonds wide. 4. Note that once you have defined vectors that describe the graphite sheet, you can determine the distance of any atom along the mouth direction and along the length direction by taking the dot product of the atom position with the appropriate normal vector describing the mouth and length directions respectively. So, using the normal vectors you calculated in (1) above you can find the distance along the tube axis as –ny*x+nx*y. The distance along the mouth direction is nx*x+ny*y. 5. One strategy that you can use to generate atoms in your graphite sheet is to create atoms in a rectangle that spans beyond the edges of your desired region. Then for each atom test whether each generated atom is inside or outside the region by evaluating the distance of the atom along the mouth or length direction. 6. To roll up your tube you will map the distance along the mouth direction to a cylinder. To do that, if d is the distance in the mouth direction and R is the radius of the tube then X = R*cos(d/R) and Y= R*sin(d/R). (0,0) (2,0) (4,0) (6,0) (8,0) (0,1) (2,1) (4,1) (6,1) (8,1) (1,1) (3,1) (5,1) (7,1) (9,1) (1,0) (3,0) (5,0) (7,0) (9,0) (0,2) (2,2) (4,2) (6,2) (8,2) (1,2) (3,2) (5,2) (7,2) (9,2) (0,-1) (2,-1) (4,-1) (6,-1) (8,-1) (1,-1) (3,-1) (5,-1) (7,-1) (9,-1) Part I: Planning You are required to plan your approach to this project and submit this plan by Friday at 7pm. An example plan for a generic coding problem is provided on the Blackboard website to give you an idea of what we are looking for. The idea of submitting your plan is to take the time to think through the different parts of the project, so that you have a roadmap for your work. Note that there are four parts of the work that should be addressed in your plan: • Designing: What is the design for the solution? What are the critical parts of the problem? What are the inputs and outputs? If there is graphical output, what will this output look like? How will parts of your solution utilize or connect to other parts? • Coding: What control-structures, iteration techniques, built-in functions or other programming techniques will you need to use? Diagram flow charts of some of your subroutines. • Testing: What are some example cases you would want to test to make sure the subroutines work along the way? What are some example cases you could think of to test the final program? • Debugging: How will you check for bugs, particularly those that do not result in syntax errors? Are their parts that you anticipate will create problems due to their complexity? Could these be broken down into simpler pieces that could be debugged separately? Make sure your plan references the project description and identifies the most relevant aspects of the project. Your plan will be judged according to how well thought-out it is. We will try to provide feedback on this plan by Sunday. To communicate your plan feel free to use regular paper, a whiteboard, sticky-notes or any medium of choice. Submit these by scanning them into PDF format using a scanner or an app like iScanner, Turbo Scan or Tiny Scan for iPhone or similar to produce a good quality and reasonably sized single PDF file that you can submit via Blackboard. You may work in a team on this plan as long as you include all team members’ names on the submission. All other parts of the assignment must be done on your own. Part II: Coding and Testing Your functions must have the following forms function pos=Graphene (n, m, len) % Graphene determines the x, y and z coordinates % for a graphene sheet. This set of coordinates % represents a rectangular slice of a carbon sheet where