St. Alphonsus of Liguori, [*Theologia Moralis* lib. 6, 942, p. 690][1]:

>A husband or wife rendering himself or herself impotent, even by licit means (e.g., fasts, etc.), sins gravely. If one cannot otherwise perform the [[marriage] debt][2], it is licit to not observe the fasts of the Church.<br><sub>Peccat graviter vir vel mulier, si se impotentem reddat, etiam mediis alias licitis, v.gr. ieiuniis etc. invita comparte: imo si aliter non posssit reddere debitum, licite non observat ieiunia ecclesiæ.</sub>

Impotency ≠ infertility, but they are related. An impotent husband is infertile, but an infertile husband isn't necessarily impotent.

 - [Impotence][3] means the inability to perform the marital act.<br><sup>A husband or wife invalidly marry if they know they cannot perform the marital act; impotency is [diriment impediment][4] to marriage.</sup>

 - Infertility (sterility) means a child does not result from a marital act.

Now, if one intentionally eats a diet to render himself impotent to the extent he becomes infertile, but is still able to perform the marital act, that is no different than *artificial* contraception, condemned in [*Casti Connubii*][5] §56:

>any use whatsoever of matrimony exercised in such a way that the act is **deliberately frustrated** in its natural power to generate life is an offense against the law of God and of nature, and those who indulge in such are branded with the guilt of a grave sin.<br><sub>quemlibet matrimonii usum, in quo exercendo, actus, **de industria hominum**, naturali sua vitæ procreandæ vi **destituatur**, Dei et naturæ legem infringere, et eos qui tale quid commiserint gravis noxæ labe commaculari.</sub>

  [1]: https://archive.org/details/theologiamoralis02ligu_0/page/690/mode/2up
  [2]: https://www.catholicculture.org/culture/library/dictionary/index.cfm?id=32969
  [3]: https://www.catholicculture.org/culture/library/dictionary/index.cfm?id=34126
  [4]: https://www.catholicculture.org/culture/library/dictionary/index.cfm?id=33109
  [5]: https://www.vatican.va/content/pius-xi/en/encyclicals/documents/hf_p-xi_enc_19301231_casti-connubii.html