If I wanted to code the following what would be the best method? I cannot get my brain around this and I am sure it is super easy!!!

I am going to 3bet 3x the bet via Raise 3 Force -- but I want to jam my stack if doing Raise 3 leaves me with Less than a pot sized bet. How would that line of code look?
I am looking to do the following:
All in when any action would leave us with less than a pot sized bet