A maqam (مقام), which in Arabic literally means 'place', is a standard melody type and set of related tunes.
The melodies used in a given maqam aims effectively to express the emotional state of the reader throughout the set liturgy (without changing the text).
The maqam that is used each Shabbat depends on the theme, story, or main message of the Sabbath weekly Torah portion.
The cantor, or hazzan, of the congregation leads the worshippers with the melodies of the particular maqam, which is preset and standardized on an official list.
Most of the prayers in the Shabbat morning service are rendered in a prose recitative, the exact tune of which varies with the maqam of the week.
However, certain important passages, such as Nishmat and Kaddish, are sung to the tunes of specific Pizmonim, which are chosen according to a rota so as to fit the maqam of the week.
This maqam is used for Beshalach (Shabbat Shirah), Vayetze and Shofetim due to the happy occasions mentioned in those parashiyyot.
Maqam Nahwand, named after Nahāwand/Nahāvand, a city in Iranian Hamadan province, is applied when there is disharmony between parties and fights, in general.
A related maqam is Rahawi Nawa (see below), but this has sunk in popularity and therefore most cantors almost always replace Rahawi Nawa with Maqam Nahwand, due to the surplus and variety of more Western-oriented songs in Nahwand, which closely resembles the western minor scale.
(Similarly in the Middle Ages, the minor or Aeolian mode, though acknowledged to exist, was never used in Gregorian chant.)
Other uses of Sabah include any parasha that mentions the army (Masei, Ki Tetse), since the word saba in Hebrew means 'army'.
When there is a death in the parasha (Sarah and Abraham in Chayei Sarah, Jacob and Joseph in Vayechi, or Nadab and Abihu in Acharei Mot), or a tragic episode (Golden Calf in Ki Tissa, Sin of the Spies in Shelach Lecha and the Temple's Destruction in the week of Devarim), then this maqam is applied.