Excellent course. I am learning a lot.
There are almost always multiple ways to achieve the same thing. After struggling with this step for a while, I discovered a small modification which was easier for me to understand and manage.
- Initial conditions: store named attributes posN, posN-1
- Verlet integration - result is "posN+1" (Position)
- Constraints - for each constraint, check "posN+1". If necessary:
Reflect "posN+1"
Reflect posN, overwrite it
- At the end of the chain, shift and store:
posN -> posN-1
"posN+1" -> posN
It seems to work well.