it is called equilibration. you really need some tutoring in basic MD simulation methodology and best practices.
what you have demonstrated in your recent emails is a demonstration of how many mistakes one can make without the proper training and understanding of the basic principles.
a) if you want to study transfer of heat, you best avoid any kind of irrelevant boundary and surface effects. that means, you’ll be best off using periodic boundaries, not walls
b) if you create a system geometry, you must make certain that you don’t create overlapping positions, and that includes overlaps across periodic boundaries. when you define your box geometry to include lattice points, it is almost guaranteed that you get such close contacts causing extremely high forces that will catapult atoms through the system at extremely high velocity. this can be avoided by either defining the box and region boundaries with a small offset or redefine the lattice with a shifted origin
c) when you create a geometry and want the optimal positions for a given material, its potential and parameters and the conditions you want to study, you best use a geometry that represents the equilibrium at those conditions. this can be determined by doing a simulation of the bulk system with variable cell (fix npt) at the desired temperature and then use the averaged lattice constant once the system has equilibrated.
d) when you create initial positions they are likely not at the minimum of the potential energy, so even without adding some kinetic energy through the velocity command, the system will try to equilibrate which means that some of the potential energy will be converted to kinetic energy. if you create a geometry with high potential energy, there is going to be correspondingly more kinetic energy created while the system equilibrates
e) when, on the other hand, you run a minimization (and including relaxing of the box dimensions), then you are removing potential energy from your system. thus if you add kinetic energy with the velocity command, some of it will be converted to potential energy during equilibration.
f) when you have a 2d-system (plate) it makes no sense at all to do isotropic box relaxation. you only want to relax the directions where the plate is periodic in.
g) when you want to study heat transfer, you ideally want to have a near infinite bulk with a surface, then your second material. however, this is not easily possible with the time and length scales available. thus you use a periodic system with a sufficiently thick slab so you can attach a (dissipative?) thermostat to the “core” of the metal plate and thus mimicking the behavior of a much bigger slab where kinetic energy can be exchanged with the bulk. how to proceed from there depends on the method you choose to determine the heat exchange.
h) keep in mind that when you have relaxed your system to the bulk lattice at the desired temperature, you will still have relaxation (and possibly reconstruction) of the layers at the surface. thus even if you would theoretically have perfect positions, you will still see some excess kinetic energy generated because of that. starting with a minimization would be counterproductive in this case, as it removes potential energy, and thus re-equilibrates while consuming some of the kinetic energy added. in short, it is extremely difficult to predict the exact amount of kinetic energy to be added, and thus it is common practice to run for a while with a thermostat (and LAMMPS offers a large variety of those) until the system is in equilibrium.
i) when a system is in equilibrium and has the proper simulation settings, continuing from the equilibration run with a thermostat with just fix nve should preserve the (average) temperature and total energy. if not, then either the system is not fully equilibrated or the simulation settings are such that the necessary energy conservation is not given.
j) there are more points to discuss about accurately measuring heat flux, but it is pointless to discuss those for as long as you have not managed to set up a meaningful simulation of just your base system that is maintaining the expected geometry, has proper dimensions and sizes and can conserve energy to a sufficient degree.
most of the points mentioned above have been discussed in some form or another and many of them multiple times on this mailing list, but more importantly, I would expect that somebody aiming to do an advance study using MD methodology (and studying heat transfer qualifies as such), has learned those beforehand, and most appropriately through tutoring by a competent person, most of the time that would be the adviser or a senior/experienced colleague. expecting to learn this through the mailing list is not likely to work, since people usually don’t have the time to study your inputs and monitor your actions at the level of detail necessary. more importantly, you so far only noticed problems because they were very obvious because of rather obvious mistakes or misconceptions. however, doing accurate studies of advanced MD simulations requires much more attention to detail and you may get completely bogus results from simulations that appear to have run correctly. MD simulations are as much a craft as they are science and thus - like in any other craft - a certain type of apprenticeship and transfer or knowledge and experience (especially of the kind that cannot easily be written on paper) is required to be successful. otherwise you will see problems where there are none, or don’t notice when things go wrong.
HTH,
Axel.