What does it mean "causing trouble"? Do you get an error message, or it generates unexpected results?
You probably already know, but you can generate a script by setting up the simulation in the GUI, selecting it and running "To Python" in the context menu.
Your script is incorrect. You use only one material settings for all tissues in Duke. However, different tissues (fat, muscle, bone, blood, lung, etc.) have very different properties. To replicate what the GUI does, you probably would want to group all entities with the same material tag (entity.MaterialName), get the material from the database, and create linked material settings:
material_settings = emfdtd.MaterialSettings()
components = [e for e in xcm.CollectEntities(duke_group.Entities) if e.MaterialName == "Muscle"]
mat = database["IT'IS 4.2"]["Muscle"]
simulation.LinkMaterialWithDatabase(material_settings, mat)
simulation.Add(material_settings, components)
Your script may also be wrong, because duke_group.Entities contains a sub-group "Bones". To recursively collect all entities in duke use CollectEntities:
import XCoreModeling as xcm
duke_all_entities = xcm.CollectEntities(duke_group.Entities)
You also want to create ManualGridSettings (with specified grid spacing), or AutomaticGridSettings, and assign the entities. You can then run UpdateGrid
simulation.UpdateAllMaterials()
simulation.UpdateGrid()
simulation.CreateVoxels()