Question of coding

I am a student in DSGE.
I want to add capital into household utility function, but I am not sure if my code is right.
Could any one offer me some advice?

The basic model setting is as follows:
chapter_6(orginal).pdf (481.5 KB)
After the inclusion of BGG, there are some changes in the model setting.

And my setting like this: (add capital into the household utility function)

In the code, I add ‘qss’ in line82 and change the formular about the price of capital in line123.
tcm1002.mod (9.9 KB)

Is such a modification in the code correct ? I’m not sure this is the right way to do it .
Thank you very much!

The more fundamental question is: why would you derive utility from the presence of capital (instead of getting utility from the goods consumed with this capital stock)?

Thanks for your reply, Professor jpfeifer!
After I read some paper, I want to build housing in the model, and I found that most papers about housing are using this form in the household utility function: (L is the housing variable, after read the rest of the paper, I found is similar to K )

They both derive utility from the presence of housing, so I want to do so, and try to start from K to make the variable of housing.

Ok, so it’s about housing, not capital. There should be various papers you can start from that should show you the FOCs.

Thanks for your reply!
After adjust timing and some calculation error, the model looks not bad.