# How to create atoms randomly distributed on the lattice site?

Hello,

1. I know that I can create atoms randomly in a region so that atoms can be distributed disorderly in the region, but I want to know if I can first build a lattice, and then delete all the atoms, and finally refill the lattice site randomly with elements, especially, in a multi-element lattice.
2. Should the temperature be set for Tstart by the velocity command before using the fix nvt command? Can I omit the velocity command and only use the fix nvt directly setting the Tstart? Is the Tstart following the system temperature?

Thank you in advance.

Best regards,
Skyler

This is a bit confusing. Do you want a partially filled lattice or a fully filled lattice?
If you want a multi-element system, do you want specific ratios of those elements or just random?

There are a few general strategies:

• you can first create atoms at all lattice positions with create_atoms and then randomly delete some of them with delete_atoms
• you can directly only fill a fraction of the lattice positions using the ratio keyword of create_atoms
• you can change the type of a fraction of the atoms with the set command (there are multiple variants for that where you can specify numbers or ratios and depending on how much computational effort is spent to maintain a specific ratio)

Please check out the documentation of those three commands I mentioned and study it carefully to see what is suitable for your case. If you need more specific help, you need to ask a more specific question and explain in more detail what you have tried, what has happened and why you are not satisfied with that.

It is not strictly required, but often very convenient. A Nose-Hoover thermostat, as it is used by fix nvt, is not well suited to transfer a large amount of kinetic energy quickly. Its thermostat algorithm is designed for maintaining a canonical temperature. Thus setting an initial temperature can help reaching the desired target temperature faster and with less â€śstrainâ€ť on the thermostat algorithm. What is the best initial temperature depends on how close the initial structure is to the 0K minimum of the potential energy. So if you start with a system that has all atoms on their ideal lattice position about half of the initially assigned kinetic energy will be converted to potential energy and thus the resulting temperature will be correspondingly lower. You can see this effect when using the velocity command and then fix nve instead of fix nvt (i.e. no thermostat). E.g. in the melt example of the LAMMPS distribution, you start with creating an fcc lattice of LJ atoms and assign an initial temperature of 3 \tau, which then will then quickly equilibrate into a system at 1.5 \tau temperature. So it can be useful to assign an even higher temperature than what is the target. The opposite is true when you start from a geometry that have previously been equilibrated. Then you already have a suitable velocity assignment to the atoms. And if you want to run a system that has been equilibrated for a higher temperature than where you want to run, you may even want to set the temperature for the velocity command to a value lower than the desired target temperature to remove some excess kinetic energy from the system (part of which will be recovered by the system relaxing to a lower potential energy and converting the stored energy into kinetic energy in the process).

The thermostat will internally create an instance of compute temp to compute the actual temperature of the system. If the fix is applied to only a subset of atoms, so will the compute. This compute can be replaced with a custom compute that you create by using the fix_modify command. This can be use for all kind of complex â€śtemperature biasingâ€ť manipulations (e.g. to create a system with a temperature gradient or to thermostat only a specific region of the system or thermostat a flow system that has a center of mass motion and more). Please also see 8.2.4. Thermostats â€” LAMMPS documentation and 8.3.4. Calculate temperature â€” LAMMPS documentation

1 Like