The Z400's engine is a bit tall, you'll have to drop the frame a tad or angle the engine forward more.
I measured again tonight, and I think the z400 engine might just fit in there fairly easily. It looks tall, but I don't think it's much taller than the factory engine. The only disclaimer would be the spark plug in the center of the head, and making that clear the center pipe of this chassis.
I got some measurements from the drz250 engine, and it seems like it is just as tall as the z400 engine, but much larger in diameter due to the cooling fins. I have doubts that it will fit because of the way the gas tank straddles the upper part of the frame. Unless I wanted to make a custom tank.
Which leads me to the rmz250 engine. Just by going by pictures on the internet, I suspect this engine will drop in easily. The only real pain with it would be dealing with the kick starter, as this chassis was not designed to accommodate a rear kicking kickstarter. But that would probably be easier to deal with than a custom tank. This option is VERY expensive compared to the others and you have no electric start or reverse. I'd like to get a height measurement on this engine if anyone has access to one.