![](https://secure.gravatar.com/avatar/519d491fa9fe7dfd0caf0f0a9c2ca61e.jpg?s=120&d=mm&r=g)
Hi Siegfried, This is probably an oversight on our part that these fields are not correctly detected as having “gas” type. For most MHD codes, we have a special function that handles magnetic fields, but it looks like you are entering them in from memory using the yt.load_particles function. I think if you access the field as ('io', 'magnetic_field_divergence'), It should work. By the way, are you using the yt-4.0 branch for this? You probably should in this case. Best, John ZuHone From: Siegfried Vanaverbeke <siegfriedvanaverbeke@gmail.com> Sent: Tuesday, May 26, 2020 10:58 AM To: yt-users@python.org Subject: [yt-users] magnetic fields with particle data All, I have output from an SPH code including magnetic fields for each particle. I see there are no specific fields for MHD data related to particles. For example, I have data = { 'particle_position_x': pos_x, 'particle_position_y': pos_y, 'particle_position_z': pos_z, 'particle_mass': pmass, 'particle_velocity_x': v_x, 'particle_velocity_y': v_y, 'particle_velocity_z': v_z, 'magnetic_field_x':b_x, 'magnetic_field_y':b_y, 'magnetic_field_z':b_z, 'magnetic_field_divergence': eb, 'smoothing_length': h, 'density': rho, 'temperature': Tgas, 'magnetic_field_magnitude': bmag } and then want to plot mag = yt.SlicePlot(ds, 'z', ('gas', 'magnetic_field_divergence'),width=(6.0,'pc')) But 'magnetic_field_x' is not known for particle data, so yt gives an error message. Is there a way to circumvent the problem ? Siegfried