Electronic and magnetic properties of twisted silver and palladium nanorods using density functional theory