 So in the next section, we're going to take a little deeper look at Rapture and we'll see a lot of other kinds of objects that are possible when you're building interfaces. So for one thing, as you start building up tools, you may run into a situation where you have a lot of controls and you want to maybe put things together that are related. There's a thing in Rapture called a group that you can use to group things together and in the builder you just drag a group over. It looks like that little icon up in the right-hand corner there. Just drag that over and drop it into your interface and then you can put other things inside of it. A group sort of acts like a hierarchy level in your program and you can put other things inside of it. In this case I have a group named tau and it's labeled minority carrier lifetimes and inside of it I have two numbers and it actually gets drawn on the screen with like a border around the controls. In the builder, again it would look like this, it's got the name tau, it's got a label minority carrier lifetimes and the description describes what that is. I don't know, you guys probably already know all about minority carrier lifetimes, right? No, if you don't, the description says that that's the average time that it takes for a minority carrier to recombine in semiconductor blah blah blah. Anyway, your advisor will tell you what the science is behind it and you can put in good descriptions. But once you do that, you've got a title for the group and when you mouse over the title it will pop up the tooltip. So if somebody doesn't know what that means, they can use the tooltip to figure it out. Again, the documentation is embedded right there with the tool. All right, now there's one other interesting thing that you can do in Rapture. If you create a group and then you put groups inside of it, you create a group of groups. When you do that, Rapture is thinking, oh boy, it's getting complicated. There's a lot of stuff here and what it does is it renders it to you with tabs. So because it starts to become so many nested groups it figures, all right, well this is better if I just show it to you as tabs. So you'll get two tabs. If you create a group, in this case I called it tabs, you don't have to, but there's a group here called tabs and inside of it there's a group called models and a group called ambient. And geez, inside the group models there's a group tau and all that. Anyway, when you have groups of groups, they become tabs on the interface. So you can see the group models and the group ambient, those are like two separate tabs. You can see one or the other at the time, but not the both. Now, inside the group models, I have a regular controlled boolean value for recombination and then I have a group with two numbers. And as soon as I start to mix things up, I have one control and groups with other stuff, then Rapture doesn't do tabs anymore. As soon as I start mixing controls, it splits them all out. So you can see the boolean value for recombination model and then right below it you can see the group with the two numbers in it. So the tabs only works when you have groups of groups. If you have just groups of groups, then you get tabs. Otherwise, you'll see the groups with headings. And that tends to work pretty well, most of the time when you're building stuff, so that's a good assumption. There's one other thing that's like a group, but even bigger. Sometimes the tools that you build have so many controls. Not only do you have groups of groups, but you need to have groups of groups of groups and kind of split things up. And it's easier for the user if you kind of walk them through the important stuff. So we have something called a phase in Rapture that is kind of like the wizard thing that you see on Windows sometimes. You see a panel and then it says next and you fill out those things. It says next and it kind of walks you through a series of panels. So the way you do that in Rapture is by defining a phase. In this case, I've got a phase with a string in it and I've got another phase with another string in it. So it'll show you the first phase, just that one string. And then there's a button that'll take you to the second page. And then it'll show you the second page with its one string. And then it'll take you on to the next. And at the end, the last button always says simulate, because by the time you've gone through all the phases, all that's left is to actually run the program. So if your tool is so complicated, if it's got like 100 controls in it, then you want to probably take those 100 controls and first of all break them into groups. But you might also even want to break them into phases. You might have two or three phases. One phase is all the geometry that deals with your device. The next phase is all the temperature and pressure and ambient conditions. The next phase is all the voltage that you apply to it or whatever. Things that are logically related and each phase, there should probably be at least a dozen, if not 20 parameters, right? So you want to use phases only when your tool is so complicated. It's got that many parameters to manage. If you can fit everything on one screen, that's actually the best, I mean for the user. Now one screen with maybe a dozen controls, that'd be perfect. But if you get beyond a dozen controls, you use groups. And if you get beyond that, you can use phases for really complicated tools. So anyway, so that's there. You can remember, if you get a really complicated tool, that's one way of managing it. Of course, whenever you do that with groups and phases, the groups tend to hide things from people. If you've got tabs like this, I can look at models, but not ambient. One or the other. So whenever you put things inside the tabs like that, the parameters are a little bit hidden. And when you put them into phases, especially if there's not much there, you're just torturing the user. So again, I'm saying use these things sparingly, but they really help when you have a large program. Now suppose inside my group with the drift diffusion options, I have this recombination model. Suppose I have two other numbers, but when the recombination model is off, I don't want the user to enter those numbers. They don't make sense. But when the recombination model is turned on, well then I have to have those numbers, because I need them. So when I have a recombination model active, I need those two numbers for minority carrier lifetime. And if I don't, then forget it. There's a way in rapture of enabling and disabling stuff like that, based on the value of a control. And let me show you how to do that. So inside the builder, I have this Boolean value for recombination. And in the builder, if I highlight that Boolean control, and then I go down to where the name is, I can click on it and say copy. If I click on that, instead of renaming it, up to now we've been renaming the thing, right? But if I click on that name and copy, that's like a copy-paste thing. It lets me grab that thing, grab the name of it. Remember, this is the same name that I would have used in my rapture program. I'm going to grab that name and I'm going to use it elsewhere in the builder right now. So I'm going to click there and copy the name. And then I'm going to paste it in to an enable condition over here. So I'm going to go to the thing that I want to have turned on and off. In this case, the number tau n, and there's also a number tau p. Each one of those, I want to have this enable condition. What this says is when this control is turned on, this number is active. When this control is turned off, this number should be off. So that's the simplest thing that I can do. When the Boolean value is on, this number is enabled. When the Boolean value is off, the number is disabled. And I do that for this number and I do it for the other number too, tau n and tau p. I have two numbers, each one of them has to be enabled properly, right? All right, just to build on that a little bit. Suppose I have a tight binding energy, 2.99 ev. And when I'm 2.99 or below, I don't need the next number. But if I'm at 3.0 or above, then I do need the number. Slightly different, right? It's not quite a Boolean thing that turns it on and off. It's more of a numeric value. When I'm at a small value, I don't get the number. But when I have a higher value, reached a certain threshold, then I have something called a high energy lifetime or something I have to include. So how do I do that? Again, there's an enable condition. But this time, the enable condition is not just a Boolean value. It's not just true or false. It's a little more complicated. I write it this way. Basically, I go to the thing that I'm looking at the tight binding energy. And so I grab the name of that tight binding energy. Input.negf.tbe, that's the name of the tight binding energy. If I add colon EV under the end of it, it'll take the value of that thing and convert it to electron volts and drop the units. That lets me take a string like 200 milli-electron volts and convert it to a number like 0.2 in electron volts. So this will give me a number value and then I just look at greater than or equal to three. So if I've got that number greater than or equal to three, then it's enabled, otherwise it's disabled. See these enable conditions that I showed you a second ago. They can be just a simple Boolean thing or they could be an expression. Like this is an expression, get me a number and when it's greater than or equal to three, then this thing's enabled. And when it's not, it's not. So you can write any arbitrary expression there using the value of one rapture component to control another one. You always take the one that has the controlling value and you put it on the enable condition of the other one that you want to control. All right, let me show you another example of that. Again, suppose that I have something called like a choice thing with a drop down list. And when I choose drift diffusion, I want to have those parameters. And when I choose Boltzmann transport equation, I want to have these parameters. And when I choose neg f, I want these parameters. I actually have three different sets of parameters, depending on the model that you choose. And I want to make sure that when you choose one model, you get one set of parameters. But if you choose a different model, you actually get a different set of parameters. The way I do that in the program is I make three groups for the parameters. And when this model is enabled, when the model drift diffusion is on, I enable its group and I disable the other two groups. If you enable a group, it'll show its controls. If you disable a group, the controls will completely disappear. They actually don't just gray out, they disappear off the screen. So this idea of enable and disable is a way of showing controls and hiding controls too. You can enable a whole group and the whole group pops up. And you can disable the group and the whole group will disappear. So the way I do that is for the first group, I look at the value of the choice, input.choice parentheses model. That's the model thing that you're seeing at the top of each one of the three of these, so this is the rapture name for it. And if I look at that model and I say input.choice model equals DD, then go ahead and enable that panel. The next one says, look at the choice and if it's BTE, then enable that panel. And the next one says if the model is neg F, then enable that panel. And sort of, there's some mathematical corollary, I'm sure, that says, when the model is DD, the top one will be true but the other two will be false, right? So it'll be enabled and disabled and disabled. But on the other hand, if I had the choice model was neg F, then it would be disabled, disabled and enabled, right? Because it would be false, false, true. So that way, there's only one that's active at a time. Whatever model I choose using the drop down drift diffusion BTE or neg F, whichever one I choose, it'll pop up that panel of controls and the others will disappear. So the enable thing is really good. It helps you, on the one hand, do simple things like enable and disable certain controls. And I can do that with a simple Boolean value. I can do that with a numeric value. Or you can actually show or hide whole groups of controls by enabling and disabling groups. So it's a very powerful thing. On a different note, literally, different note. There's one more thing you can put into your tool for documentation. There's a Rapture object that's called a note. It's not really an input, it's not really an output. But it's an element that's there to help you with documentation. What I found was people would start building Rapture interfaces and they'd put in strings and images that weren't inputs, but they just described stuff. So people would put in a string with a bunch of documentation. And then your program would actually receive that as an input, but it would ignore it, right? So I thought, well heck with that, we can do better than that. You can actually have a note object that actually has HTML text that describes what's going on in your interface. So for example, you can see in the builder here I've got a note and then a number and an integer. And over on the right hand side you can see some HTML documentation and then a number and an integer, right? So the note is a little HTML area where you can show images and links and text and everything you need to describe your tool. That area right there is the note. And when you're setting it inside the builder, there's a little button where you can choose an HTML file. So just pretend it's the 1990s and you can create a little HTML file by hand. Any sort of ordinary HTML file with an HTML tag and a body, sort of like the way people used to do it back in the 1990s. But you can also include images and it actually does understand such style sheets. It doesn't understand flash, it doesn't understand Java, all the fancy stuff on the web. It doesn't do JavaScript either. So you gotta keep your HTML pages kind of plain. But if you have HTML pages, you can plug them in right there. And you can test them with your browser to make sure they look right. So this is what typically you do. Inside, if this is where my tool is, I've got my tool.xml and I've got my script for my tool. It's a good idea to make a directory called docs, d-o-c-s. Rapture will look for a directory called docs in the same area where your tool.xml is. And it will assume that all your note information is in the docs directory. So in this docs directory, I can have an HTML file and I can also have images and all that stuff. And then your HTML file can reference the by size.jif image and it's all together. So when you're building a tool, make a docs directory, same place you have your tool.xml and put all your HTML and your images there. And then just choose it in the loader, the HTML file. And you're off and running, there's your docs. That might be useful. It's like a real useful thing for a lab assignment, just saying. Everybody's like, wait a minute, what? Back up, what? The note, I give you the note. This is what it would look like, by the way, if you're not used to writing HTML, if you need a little HTML primer. Back in the 90s, this is how people made webpages. So it starts out with an HTML tag and then a body tag and then some stuff and then slash body and slash HTML. And inside the P's or paragraph tags, UL is an unordered list, A is a link in the web. You notice you can actually embed links in this and you can embed links to other websites in your tool. So for example, in this documentation, I say, hey, here's a bunch of cool sites that you should check out. This is the theory for this tool or something. We can actually reference like nano hub.org resources or we can reference google.com or whatever web URL you want to stick in here. You can do that and when the user clicks on the link, it'll actually pop a web page for them. So feel free to use web links outside even, nano hub. You can also see the image, right at the top, I've got the IMG tag. The IMG tag with SRC equals bysize.gif. That's how you include an image in your HTML. And that was that image I showed you just a second ago sitting in my docs directory. So that's how you write HTML, that's a good example. And that's my bysize.html file that looks like the thing at the top. And the links are active. So when a user is clicking the link, it'll pop up the tool page just like that, which is really great. All right, now the last thing I wanted to, we started already kind of getting to the documentation on the website. And the more you do with Rapture, the more you'll find you need that documentation. There are things that you can do in Rapture that aren't in the builder yet. We've been working on the builder, there's a lot of stuff in Rapture. It's not feature complete yet, it's close but not quite there. So for example, in the builder, if I look at a number object, you can see lots of things. You can see the enable condition, the default value, the units of measurement, and all that. But if you look in the documentation for number, there's even more that you can do, that's not in the builder. For example, numbers have something that you can put in called a preset. If you write this in XML, if you use the builder, generate a tool.xml file and then edit it by hand, you can actually add something like this to the XML. You can add a preset, value 300k, preset value 77k. And what that does is gives you a little drop down menu. The number, not only is an entry widget but it'll have a little arrow next to it with a drop down. And it'll drop down these two choices. That's a really useful thing because sometimes people don't know what good temperatures are and it turns out that experimentalists like to work at 4.2 kelvin, that's like liquid helium temperature, at 77 kelvin, that's liquid nitrogen temperature, and also at 300 kelvin because that's room temperature. And if you weren't an experimentalist, you might not know that. But it's really good as a tool builder to build those things into your tool and that way it makes it easy for people. They just think, yeah, I want to work at liquid nitrogen. What's that temperature? I forget. Yeah, it's 77, right there. So if you build something in the builder, you'll get close to it and with the tool.xml, you can then go into your tool.xml and edit it. And you can add stuff in. Just like we were doing with the driver file when we added in the current values, you can edit the tool.xml and add presets, for example. And that'll add new behaviors. There's other Easter eggs like that that you'll find, lots of other things in Rapture. If you read the documentation, there's extra stuff that you can do in the XML. Okay, so the builder builds your tool.xml and then you can go in and add stuff like that and save it. Now, the only bad thing is that if you reload this file into the builder, the builder will scrape out all the stuff it doesn't understand and throw it away. So once you've started editing your tool.xml by hand, you're sort of on your own. Sorry about that, I don't know what else to do about it. The builder sort of throws away stuff that it doesn't like. And when it goes to write it back out, all that stuff that you added by hand will be gone. So once you can use the builder to get so far, if you start adding stuff by hand, then you might as well just keep adding stuff by hand in the tool.xml. So just be forewarned, I guess. This is what it looks like, by the way. If I add those two presets, when I get this temperature control, I'll have a little drop down and the drop down will have my preset values on it, which is kind of nice. On the other hand, you might say, that's not worth it for me, because I don't care that much about that feature compared to losing the builder when I start using it. So there are a few other things that you'll find if you poke around in Rapture. There's also an input called the periodic element. And I think it's in the builder now. So we can drag it over, right? That's good, because it didn't used to be. So now you can drag over this periodic element in the builder. And again, this is what it looks like in the XML. It shows you a periodic table, and it's really good for chemistry applications. If you're asking somebody to select an element like oxygen, or helium, or something like that, you can give them a periodic table and they can click and choose the elements out of the periodic table. You may, in some cases, with chemistry applications like this, you don't want to let people select anything. You only want to select three, five compounds or something like that. Certain columns of the periodic table. And so there's all these different kinds over on the right-hand side, noble gas and transition metals and all of that. So you can activate certain sections of the periodic table, or you can deactivate certain sections of the periodic table. You can say the user can select anything except a transition metal when they're choosing. So that periodic element controls just a nice way of choosing elements. And you can look into the documentation a little bit more, look at what the interactive and the active does and the default. Turns out in the return, has a thing called return value, too, where you can say what you want to get. Do you want to get the symbol? Do you want to get the number, the name, the atomic weight, everything? So you can sort of, when the user chooses an element like helium, you can decide what your program is going to get. Is it going to get the name helium? Is it going to get the atomic number or the weight? So you can choose any of that with the periodic table, too. All right, it's kind of a potpourri grab bag of all weird features. And now I've got a lab assignment for you, which is also a potpourri grab bag of weird features. I wanted you to try a few of those things out in your Spirograph program. You remember the Spirograph program from yesterday? Maybe you still have it sitting around. If not, let me know, we could probably get you a solution. But what I wanted you to do is add a few things into your Spirograph program. If you remember from yesterday, the Spirograph program that we had only had three values. You choose three numbers and you get a Spirograph, right? We're going to add a few things on. First of all, put a note right up at the top and put whatever you want in the note. What I did was I put a note with some HTML, excuse me, an image. The image has an equation, so when I wanted the equation, I used an image for that. I put in some links. You remember there's that link to the article about Spirograph, so I put that in. So give it a try. Try to put a note in your Spirograph, build the HTML page, maybe some images in there, that kind of thing. That's step one. When you're done with that, try putting in groups. Make yourself a group model parameters and a group comments. And a group, usually like a group of groups thing. So you'll get tabs. There'll be a tab for model parameters and a tab for comments. You can try that much out. The comments tab should look like this. It should have a Boolean value with the string. So all your comment controls are inside the comments tab and all your model parameters and the models tab. So do that and get that much working. And then the very last thing, if you're looking for something to do, play with the enable and disable. Make it so that when you turn on comments, this is enabled. And when you turn off comments, the string is disabled. At least on the GUI, I don't know. Your program probably will ignore the comments. It doesn't have to do anything with them. If you're really ambitious, I guess you could take the input comments and produce an output string that has the comments too, if you want to. Yeah, I guess I said that. So when comments are enabled, produce an output string with comments. If you're looking for something to do, you can do that. So take it one step at a time. Start with the note, get that much working in your interface, add the groups, and get that much working in your interface. And then finally, play with the enable and disable within the comments tab. See if you can enable and disable the string. Okay, here's my solution for the lab assignment. We wanted to stick a note in the top. We wanted to create a couple of groups and we wanted to mess with enable and disable. So let me show you what I came up with. Oops, wrong one. Ah, this looks better. All right, so I've got this, I took the tool.xml and the Spyro program from the previous lab assignment. And I made a new directory called docs, makedir docs. And then I put some stuff in it. All right, so I've got two things in there. I've got an overview.html and a Spyro-EQNS.png. And if you're, this is just some simple HTML text. It's got an HTML and a slash HTML and a body and a slash body and some stuff in between. You can look up web tutorials about HTML and it'll show you simple stuff like this. Nothing real super fancy. I know one or two people tried grabbing a web page, like from Amazon.com or whatever, stuffing it in here. Doesn't work so great because modern web pages have so much stuff. First of all, they need this and that, JavaScript from this and that and they need all these different style sheets and things like that. So there are too many dependencies that you run into with modern. You gotta keep the HTML here really simple. Think 1990s HTML, but as you're developing that, you can use a web browser to kind of test it. If you have like Firefox or something and you give it the file, you can bring up Firefox or some web browser and you can test and see what that looks like. And then you can edit your HTML and then reload it here and edit it and reload it. So web browser is an easy way of kind of checking to see what it's ultimately going to look like in your tool. All right, so I've got my docs there. So then in my builder, let me open up my solution. In the builder, I added a note and the note is right here or you can find it under the documentation tab. Just kind of drag and drop that over. And this note, you just set, you just choose the HTML file. Here I have it set to that overview.html. I can just go in here and choose overview. And that sets the contents of that note. So that's all there is to it in terms of adding the note. And then when I go to preview it, there's my note. And if I change the HTML, it'll show me different text and so forth. So the other thing I wanted to do was add the groups. So in order to add the groups, I go over here and there's a group thing right here. And I just dragged and dropped that over. And you notice you can kind of rearrange things. If I want to grab a number and move it around up here or move the number back into there, move it up to the top, oops. You can rearrange and kind of drag things around. So if you have an older tool that you built with the builder with some old controls, you can move it all around. One thing though to be careful about as I'm moving this number around, if I move the number way up to the top and I look at its name, the name is really simple. The name here is input dot number parentheses one. But if I take that number and I drop it down inside of a group, the name changes. Now the name is input dot group tabs dot group model dot number one. And that's important for two reasons. One reason is back in your program, in your skeleton program, we use these names to get the values. And so you have to fix up your program to look for that number, not the old number, the new number, right? Different path. So when you move things around inside your program, be careful, those paths change. And you have to change your main program to use those names. Of course, if you regenerate the skeleton, like I usually do, if I go and save as and I save this out to a different tool dot XML and I choose another skeleton program, maybe like main two or something. If I do that and do save, then it'll regenerate a new skeleton with all the new names. And then maybe I can take my old code and kind of plunk it in the new skeleton and everything's all fixed up. So just be careful of that when you're moving things around, the names change. The other thing I did, inside the group comments, I added the boolean value and also the string. And then for the string, I wanted to set the enable condition. And the easy way of doing that is to say, all right, I want this boolean value to do the enabling. And so I grab its name and copy. And then I go over to the string and I set the enable statement to that, paste, paste. So that sets in enable condition. When the boolean control is on, then the string will be on. When the boolean control is off, then the string will be off. If I want to do the opposite, just like in C language, I can say exclamation point. The exclamation point at the beginning is like the logical not operator. So that would flip the control. I can also do things like, say, equal, equal, and then give it a string like, oops, like yes. You can do that too. I always forget though whether it's yes or no or on or off. And I don't know. It shouldn't matter but it does because when it evaluates it, if I'm trying to compare it to the string yes, it's got to actually be yes, yes. So if you're trying to do something like that, you may have to fuss with it a bit to get it right. But you should be able to do different things like that. The easiest thing for a boolean is just to copy the name in. All right, that's about it. In terms of saving, which I'm not going to save any of that, but that's about it. And then in my program, Spyro, again, if I edited my old program, I should be careful to change these names or maybe I generated a new skeleton and I stuck my code in, either way. But the names are different than they used to be because now it's not just input.number n1, it's input.grouptabs.groupmodel and all that. So I had to be careful to change the name there. I had to be careful to change the name there and the name there. Everything else is pretty much the same. I do my t and my z, just like I did before. And I save the values back, just like I did before. There's one other thing I added for the comments. I checked that boolean value to see if it's turned on. And if comments are enabled, then I went ahead and I put this stuff out. This is interesting. The way I did it right here, I'm actually, I'm putting two strings. I'm saving out the about.label and I'm saving out the current value for that string. I'm doing both of those things. That actually creates the control out of whole clock. Let me show you. My tool.xml, if you look in the output section, I have a curve in the output section, and that's it. There's nothing else there, there's no string. And when I'm executing my code and that ad statement is turned on, this ad statement actually creates a string as if I had created it in the builder. It does that by doing two things. Number one, it creates a label for the string. Rapture has to know what to call it. So that's what the output.string, parentheses, info.about.label, that gives it a label. And then the output.string, info current, gives it some text, okay? So that'll actually create it. Let me show you what it looks like then. To run this, I'm going to copy my tool.xml to a driver.xml. I'm going to edit the driver. I'm going to go in all the places where there's a default value. I'm going to make it a current value. You guys are used to this by now. I do this when I want to have a test case that I can run by hand. Okay, so I've got those three values. I'm also going to set values for the boolean, boolean value. I'll set it to yes, and I'll give it a string too. I'll set the string current value to testing, okay? So that's my driver file. I can run octave, I can set infile to the driver file, and I can run that main program. Oops, what did I call it? I called it Spyro. Oops, what did I call it? Spyro.m, oops, I-R-O, there, okay. So I ran it by hand now, and I can look in the run.xml, and you can see a couple of things. First of all, there's all the numbers. That's great. Wow, there's a lot of numbers. I forgot, I guess there's a thousand numbers, right? Maybe I should start at the top. Okay, so here's the curve in the output section. Here's the curve, and it now has a bunch of values, right? And if we go down, down, down, we can get to the end. Here's the end of the curve. And here's this string info. That didn't exist in my original tool.xml. I created it on the fly inside my program. My ad statement did two things. It created a string named info, and it said it's about label. And it created the current value testing. So that chunk right there of XML, that appeared because of these two statements. When you do RPLibputString, when you put a string in the output section, it'll look for, in the output section, it'll look for a string named info in this case. If it finds it, it'll change it. If it doesn't find it, it actually creates it. So you can dynamically create new outputs in your program, and that's what I'm doing here. This will dynamically create a string with the ID info, and it will set the about label to comments, just like the builder would have, if I would have created that string in the builder. And then also, it sets its current value to the text that I wanted for the comments. So I was expecting a curve to come out of this program. When the comments are enabled, I actually get a curve and a string. And you can see that if I do my rapture-load on that run file. You can see the results, right? This is my interface. You can see the curve, but you can also see the string. So I actually have two outputs there that I can flip back and forth between. All right, and going back to my interface now, seems like all the parts are there. If I just run rapture, I can change the model parameters and tie new cases, and I can put comments on or off. My enable is working properly because you can see the comments turning on and off and simulate, and now I get a spirograph and some comments. Questions on that? That business at the end that I showed you about creating new things in your program, we'll hit that a few more times. You'll see that coming up more. So if it didn't quite sink in yet, it will.