Make atoms to be in one straight line

Dear Users,

I have been trying to pack some spheres. I want to pack spheres such that they are in a line. Is there a way to put angle constraints such that spheres are aligned in a straight line?

Thank You,
Dushyant

How do you mean “pack” in this sense?

You can define a spring with fix spring that applies forces in two dimensions but not a third to bias them to be on a line. That is probably the simplest.
Alternatively, if you start your particles on a line already, there is a fix lineforce that can make them only move along that line.

By “pack” I mean that combine some atoms to make compact molecule i.e. sphere packing (https://en.wikipedia.org/wiki/Sphere_packing). Thanks, spring is a good option but I am planning to move that molecule (pack of atoms in a line) using gravity and If I use spring it won’t allow me to move the molecule. I also tried using lineforce command but it starts moving atoms at a fixed velocity. I want to first put them in a line and then move them using gravity.

So why don’t you use fix spring to place the atoms in a line, then delete that fix with unfix, and then add gravity?

By "pack" I mean that combine some atoms to make compact molecule i.e.
sphere packing (https://en.wikipedia.org/wiki/Sphere_packing). Thanks,
spring is a good option but I am planning to move that molecule (pack of
atoms in a line) using gravity and If I use spring it won't allow me to
move the molecule. I also tried using lineforce command but it starts
moving atoms at a fixed velocity. I want to first put them in a line and
then move them using gravity.

​please explain for what kind of model does gravity matter on the molecular
scale?

axel.​

Thanks Stefan, it works now.