For computer simulations on heavy ion beam (HIB) irradiation on a spherical fuel pellet in heavy ion fusion (HIF) the code OK1 was developed and presented in [Comput. Phys. Commun. 157 (2004) 160–172]. The new code OK2 is a modified upgraded computer program for more common purposes in research fields of medical treatment, material processing as well as HIF. OK2 provides computational capabilities of a three-dimensional ion beam energy deposition on a target with an arbitrary shape and structure. Program summary Title of program: OK2 Catalogue identifier: ADTZ Other versions of this program [1] : Title of the program: OK1 Catalogue identifier: ADST Program summary URL: http://cpc.cs.qub.as.uk/summaries/ADTZ Program obtainable from: CPC Program Library, Queen's University of Belfast, N. Ireland Computer: PC (Pentium 4, ∼1 GHz or more recommended) Operating system: Windows or UNIX Program language used: C++ Memory required to execute with typical data: 2048 MB No. of bits in a word: 32 No. of processors used: 1CPU Has the code been vectorized or parallelized: No No. of bytes in distributed program, including test data: 17 334 No of lines in distributed program, including test date: 1487 Distribution format: tar gzip file Nature of physical problem: In research areas of HIF (Heavy Ion Beam Inertial Fusion) energy [1–4] and medical material sciences [5], ion energy deposition profiles need to be evaluated and calculated precisely. Due to a favorable energy deposition behavior of ions in matter [1–4] it is expected that ion beams would be one of preferable candidates in various fields including HIF and material processing. Especially in HIF for a successful fuel ignition and a sufficient fusion energy release, a stringent requirement is imposed on the HIB irradiation non-uniformity, which should be less than a few percent [4,6,7]. In order to meet this requirement we need to evaluate the uniformity of a realistic HIB irradiation and energy deposition pattern. The HIB irradiation and non-uniformity evaluations are sophisticated and difficult to calculate analytically. Based on our code one can numerically obtain a three-dimensional profile of energy deposition onto an arbitrary shape and structure target. Method of solution: OK2 code works on the base of OK1 [1–9]. The code simulates a multi-beam illumination on a target with arbitrary shape and structure, and obtains the 3D energy deposition profile. Restrictions on the complexity of the problem: None Typical running time: The execution time depends on the pellet mesh number and the number of beams in the simulated illumination as well as on the beam characteristics (beam radius on the pellet surface, beam subdivision, projectile particle energy and so on). In almost of the practical running tests performed, the typical running time for one beam deposition is about 40 s on a PC with a CPU of Pentium 4, 2.4 GHz. Unusual features of the program: None