In the half-blood prince, voldemort practices occlumency against harry so he cant see into his mind, also stopping the pain in harrys scar. but in deathly hallows, harrys scar hurts and he sees into voldemorts mind. why does that happen? does this mean voldemort stopped using occlumency against harry in deathly hallows?
In the Half-Blood Prince, the purpose of Voldemort's occulmency was out of fear regarding his encounter with Harry in the Order of the Phoenix, where by possessing Harry he felt true pain and anguish due to Harry's capacity to love.
Also Voldemort's occulmency was of the upmost importance in Half-Blood Prince, especially regarding Voldemorts sceme to kill Dumbledore; had the plan been reveiled to Harry there was viturally no chance for it's success. For this reason, it is assumed that Voldemort took special concetraition in closing his mind to Harry.
However in the final book, the Deathly Hallows, as the plot escalates with Voldemorts take over of the Wizarding World Harry's connection with Voldemort reopens, suggesting Voldemort is no longer employing occulmency.
In my opinion, it's not so much that Voldemort has decided to allow Harry to enter his mind; that would've been foolhardy, especially when considering Harry's multiple triumph's over Voldemort in the past and it seems Voldemort has become slightly more cautious. It is important to note the times when Harry and Voldemort's connection is reopened, for example his anger when torturing Ollivander, when anguish discovering Grindelwald no longer is in possession of the Elder Wand and his feeling of Triumph when taking the Elder Wand from Dumbledore's tomb. These are all times where Voldemort has lost control of his emotions.
To quote Serverous Snape when teaching Harry the fundamentals of occlumency:
"I told you to empty yourself of emotion! ... Fools who wear their hearts proudly on their sleeves, who cannot control their emotions, who wallow in sad memories and allow themselves to be provoked this easily — weak people, in other words — they stand no chance against his powers! He will penetrate your mind with absurd ease, Potter!"
Ironically, the measures Harry was supposed to take to block Voldemort were Voldemorts own downfall; by letting his emotions get the best of him leaving his mind was vunerable to Harry.