I want to set up a cylindrical source, and the photon energy is sampled from the spectrum.There are no errors when the two parts run separately,but when I put them together, it turned out to be strange. After adding the SOURCE card, there will be conflicts with the cylindrical source.It seems to have become a point source.
The volumetric sources specified with the BEAMPOS card are disregarded if you use the source user routine. You need to implement the cylindrical sampling manually.
as pointed out by David your source routine does not include the volumetric sampling which you have to implement yourself.
Otherwise you can use the package provided in this post:
It supports all volumetric source definitions of FLUKA via the input file in combination with spectral sampling. Note that you would have to slightly adapt the input format of your spectrum.