Depositing magnetic layer or coating