 So remember when we spoke about Helmholtz and Gibbs free energies, this is going to be intimately related to that. If we are hardcore physicists that want to look at the simple systems without too many complications, you can imagine an isolated system that is not exchanging anything with the world. We're not exchanging particles, we're not changing the size of the system, and you're most definitely not exchanging any heat energy with the rest of the world. Simple, plain, boring, but also useful. We need to name this, and it turns out we tend to name the systems based on the things that are constant. So the number of particles are constant, we're not exchanging particles. We're not changing the volume of the system because we're not performing any mechanical work on it. And if we don't exchange even heat, the total energy in that system is going to be constant. This is what I frequently refer to as an ensemble, the rules under which the entire simulation or the system is going to operate. And this will determine some things that if you go into the gory details here, which I absolutely want to in this class, you can calculate fluctuations and everything and how they will depend on this. This is very useful if you're studying simple physical phenomena, and if you're focused on say the microscopic things, the microstates and everything, and partly based on that we occasionally call this for a micro-canonical ensemble. You don't have to remember the words, but I figured I should define them. What would that mean for a protein? Well, at first sight it might look like a very nice and simple application. Just put it in here and I can study how a protein should behave in an isolated form. But it leads to some problems. For a large protein, if this was 100 residues, in general you're not going to start out in the most optimal state of the protein. And as the simulation then progresses, suddenly there will be a favorable hydrogen bond formed and the protein might pack better or something. Again, it's unlikely that you're starting out in a perfect state. But what will that lead to? That will typically lead to the enthalpy, the energy, which is the same in this case. We're not exchanging the pressure. The energy will go down, the potential energy will go down of my system. But that's strange, you just said that the energy was constant. Well, yes, the total energy is constant, but there is more than potential energy. If the potential energy goes down, what happens to the kinetic energy if the total energy is constant? The kinetic energy has to go up. But the kinetic energy corresponds directly to temperature. Remember Maxwell-Boltzmann, right? And if the kinetic energy then goes up, that means that my simulation that I might have started at 300 Kelvin because of the protein finding lower energy, suddenly I'm at 350 Kelvin. Oops. 350 Kelvin, then my protein would start to unfold. That was absolutely not what I wanted to simulate. So that's crap. This works great for a simple physical system that I know exactly how it behaves. When I have large molecules that might actually find lower energy states, it can be very dangerous. But it's a great way of taking that your program is correct. There are very few bugs in the world that conserve energy. So if you have a leak in energy in this example, it's likely a bug in the program. But for real proteins, I need something better. And I'm typically going to use, there is no coincidence that this is a center-on ensemble. I will stick to having a constant number of particles. I will stick to having a constant volume. Forget about mechanical work. This is kind of more Helmholtz. But instead of completely isolating this to the world, let's say that we talk a little bit at least. So we can exchange heat energy. I can heat the system or allow the system to heat my thermostat. And what if I adjust the amount of heat going in or out here, such that I keep the kinetic energy constant? If the kinetic energy is constant, the temperature is going to be constant. This is actually very easy to do. If the temperature is, say, 1% too high, well, then I just keep scaling down the velocities a little bit each time step until I have the right temperature again. Or if it's too low, I scale up the velocities. That sounds very much ad hoc, but it's roughly how some of the so-called thermostats work. That's going to be great. I will have the temperature constant, the volume constant, and the number of particles constant. And it's going to work great to simulate a protein. Usually. What I haven't told you yet is that when I take that protein, I'm going to need to add some water around it. And what if in my initial system, what if there are a few holes? I might not be able to pack the water perfectly against the protein. Now there's a bit of vacuum here. Nature abhors vacuum so that my molecules will instantly start to pack towards the protein. But suddenly I'm going to have a pressure here that it's a bit too low. I might have a pressure that's 0.9 atmospheres instead of 1. That's a fairly large pressure difference, much larger than the ones I would have liked to see for a protein. So that is also not ideal. So in this case, it's not so much the protein reacting per se that creating a pressure difference, but it's simply hard to create a perfect system that has exactly 1.0 atmospheres of pressure. Before I try to fix that, I'm going to name this system. This is the center, the normal system, and for that reason we typically call it a canonical ensemble. The center or the most normal one. The original. And there is a third ensemble that solves this, both these problems. So this would correspond more to Helmholtz. In Helmholtz, sorry, Gibbs. Gibbs would correspond to the lab where I'm also allowed to perform mechanical work on the system, and I'm definitely allowed to exchange heat. So the number of particles is still constant, but I allow the volume to change to make sure that we keep the pressure constant, and then I also keep the temperature constant. Keeping the pressure constant is roughly as easy as keeping the temperature constant. A simple way to do it would be that if the pressure is too high, I just increase the size of my system a little bit, so I give all the atoms a little bit more space that would reduce the pressure. And conversely, if the pressure is too low, I shrink the size of my system a bit to increase the pressure. This does not have an easier name. It's occasionally called the isothermal isobaric ensemble. Isothermal, same temperature, isobaric, same pressure. In particular, during relaxation or so, it's frequently convenient to adjust the pressure. And in cases where we simulate membranes, for instance, which we won't have time to do in this class, the membrane itself is a two-dimensional liquid, and there it can actually be advantageous to let the membrane change shapes. So we will typically stick to these two and forget about the micro-canonical one, and these are going to be all the tools we need to do the simulations.