Question: When I am eating a meal alone and that meal includes bread what parts of the Birkat Hamazon do I pray? Which parts do I exclude? And please be specific. (I use the Schottenstein Artscroll siddur hachol.)

Answer: 
I would like to try to answer this question as it relates to your request on function you said 
" I ask because I want to cope with it better, and the best way to cope with something is to know what it is really there for." which means you are looking to change ...

you are asking about change and coping IMO

Coping: Coping with thoughts about other women is shown in behavioural research to be very common, most married monogamous men and women report having these thoughts, just because science in terms of evolutionary biology, says it exists and serves a purpose. If you feel like mating everything with in a 5 yard radius you may have a high labido this can be due to imbalances in a diet, meds, mood. Seek medical advice. If you have mild to lust here are some ideas about not succumbing to it...being a man or a women lust wreaks havoc. I should know, I am a someone who is guilty of it, and live with that regret. So I am speaking from personal experience, and can tell you that I have not only repented of this sin but taken very SERIOUS steps to not let it happen again. Being 44 years of age I have lived long enough to speak to this. Lol. 

Disclaimer: These ideas are from my training as a Acceptance and Commitment (ACT) Therapist. So this type of therapy is used in treatment of unwanted behaviours. 

So think about it this way, 
You value your wife, and you value beautiful women. Your actions towards your wife is based on your values i.e she is beautiful and so you are attracted to her. You also value being sexually pure in thoughts and actions. 

Values based actions are not only in line with aligning with Hashem's desires for your life but values based action is also scientifically proved to help you not AVOID things... (see ACT Therapy and any research by Dr Steven Hayes) 

If you are having lust or thoughts that are not according to your values, to cope with that you can do the following according to the "ACT model" of living a values based life 
Scientifically proven approach to recover from habitual unwanted behavior 

1. Focus on what is important and make small steps towards committed action. ie. when you think of other women, notice that-and refocus your mind towards moving towards what you value and whats important, ie, living a life with habits and actions pleasing and honouring to Hashem
2. If you are using images of other women as an avoidance mechanism- ie. feeling lonley or stressed or not being fulfilled notice perhaps how you feel when you start to think lust full thoughts..are your tired? are you lonely? When notice that you can choose to t focus on committed action towards whats important-can take action-REST or call someone etc and notice how this improves your moves a way from whats most important to you.

In my opinion its about being VERY CLEAR on values clarification, and noticing when you are not living according to your values and then making committed action to correct the thought, action or behaviour. 

THis is based on values based research from contextualscience.org. or Steven Hayes or Dr Russ Harris work mainly if you want to read more about it. 

If you want to see how ACT can help with lust also this link can help which is Russ's ideas on not getting "hooked" by these thoughts 

<https://www.actmindfully.com.au/upimages/Choice_Point_2.0_A_Brief_Overview_-_Russ_Harris_April_2017.pdf>

I would like to end my saying I am glad you asked this question, as it is something we all struggle with, and it takes courage to ask this! 

Warm Regards, 
Ray Frank
Why does G-d tempt us? 
To reward us when we do good.

The 'Sahtan' (aka Satan) is an agent of G-d who puts challenges before you and hopes you will over-come them and he, that angel who brings temptation, rejoices when you over-come the temptations.

If you're going to be given an infinity of reward for something, the harder the task, the sweeter the reward.

Nobody every got any happiness out of something that was just given to them, including the lottery. There is no joy in that, the recipient doesn't have the inner muscles to handle it. 

Imagine a billionaire father who wants to give each child 500 million dollars.

Make your bed! the father demands.

You make your bed. 

OK, here's five million dollars. 

Just for making my bed? That's too much? 

The more you do for the 500 million, the happier you'll be.