To calculate the max load, you need to check the capacity of each piece and identify which one will fail first, in other words whatever has the lowest capacity is your max capacity. In some cases, you'll have load spread across multiple pieces, e.g. each of the decking boards will carry some of the load for the shelf and send half, give or take, to each side. This will all depend on how the load is distributed on the shelf itself, and it's a good idea to be conservative and assume someone places a heavy item on a single side and on a single board.
To start, you can check the weight bearing of a 2x4 turned on it's side for the two sides, and know the capacity can't exceed double that (since there are two sides, but I'd be conservative and assume all the load was applied towards a single side). Next, you can run a similar calculation on the 2x4 decking where the boards are turned flat and over a longer span. This will likely be a smaller rating per board and you'll have to decide how conservative you want to be with the load spread over multiple boards. The next piece of structure you have are the verticals which have to support all of the shelves down to the floor. This is compressive force where the 2x4 is strongest, but you'll want to run this calculation to be sure. Lastly, and where I and CoAstroGeek both suspect you have your weak point, you have the fasteners attaching the sides to the verticals. If those are simple nails, they have a small shear force compared to bolts and could also pull out if there's a sag in the decking.
When looking at how much weight each point can support, don't forget to include the load that's already there from the shelves themselves. So for the horizontal sides of the shelf, they need to support the weight of the 2x4 decking. And the vertical supports running to the floor have their share of 3 decks and sides.
Of course the practical method to calculate the max load is to get some weights and load up a unit until it fails, and then see how much it took before it broke. Or if you don't want to destroy a shelf, use the weights to double check your calculations once you believe you know a safe capacity. It's better to test the shelves when you are being extra safe and expecting a failure than when workers are being careless and a failure could injure someone.
Lastly, I agree with CoAstroGeek's concerns about the lack of diagonal bracing along the long axis, this could easily rack and collapse under a light load if any lateral force is applied.
Wooden wall? Pretty rare that walls are made of wood. Are you talking about the molding around the doorway?
The following diagram shows a typical way that a door might be framed:
![enter image description here](https://i.stack.imgur.com/ebZwQ.jpg)
Every door is a little different, so you need to determine how your door is framed. Your goal is to get the provided lag bolts to go at least 3.5 cm into solid wood. (I would not use those anchors unless you were fastening the bar to a brick or concrete wall.)
In all probability it will be impossible to get the bolts deep enough into solid wood because the spacing of the framing elements will not match your bolt holes. Also, the molding on the door may interfere with the mounting.
So, to get your bar right where you want it, you will need to add a mounting header, which is a thick board (or two thin boards) which is attached to the wall, and then the bar is screwed into that board. Your mounting header should ideally be between 5 and 6 cm thick.
Generally, what you have to do is make exploratory drill holes to discover where the door's framing members are. Once you know that, you can plan to cut and attach your mounting header appropriately. To attach your mounting header, you will need long lag bolts because they have to go through the header, through the plaster and any lathe and then deeply into the framing member. So, your lag bolts need to be 10-12 cm long and should have washers.
I should mention that normally, at least in the US, chinup bars of that type are designed with bolt holes 16 inches apart so that they will mate with wall studs which are normally spaced at that distance. The bar is intended to be mounted to a wall, not above a door.
Best Answer
There are lots of span calculators available online, which help you determine what size lumber to use in home or deck construction. For example
http://www.awc.org/codes-standards/calculators-software/reversecalc
and
http://www.awc.org/codes-standards/calculators-software/spancalc
You could try to figure out what the live loads and dead loads for the bed are and go from there.
Shortcut - I might try to get by with 2x4's spaced 2' or less apart if they run side to side across a single mattress, but I'd want 2x6's if they run long ways, or for a full or larger.