Can lammps read custom velocities from file?

I am trying to augment ab initio md with lammps. Is there a way lammps can read velocities from file or is there a command to fix velocity per atom with numeric values. I could not find anything on the lammps wiki or I might have just missed it. Any help will be appreciated.

Thank you and regards,
Kaustubh Sawant

With LAMMPS a lot of things require multiple steps, so you may not find an immediate answer to your problem directly, but you need to “read around” for a bit and be a bit more creative.

Since the “velocity set” command accepts atom style variables, you could create an atomfile style variable for x, y, and z velocities (be careful with units!) and then assign them. Please see the documentation of the variable command for how atomfile variables work and what the structure of the file has to be, so that those variables can be “filled” from a file. In all cases, where a LAMMPS command accepts an atom-style variable, you may also use an atomfile-style variable.

Thank you ! I think I understand what to do. I need to just scale the following command for all atoms:
set atom 1 vx 0.0 vy 0.0 vz 0.0

That is a completely different thing. You could just replace 1 with *.

However setting all velocities to zero is also simpler with the velocity command.
velocity all set 0.0 0.0 0.0

Please consult the LAMMPS manual on both commands and the variable command, and you will find a lot more examples and explanations.

Thank you ! I just put 0 as an example. I have different velocities for each atom. So the most naïve solution is just have a list of set commands for each atom. I will think of a more smarter solution.

I already told you, that you should use atomfile variables. They are meant for that purpose, everything else would be overkill and a waste of time.

1 Like