# [lammps-users] about the minimize command

Hello Lammps,

I just found one strange problem about the minimize command.

The minimize command considers energy due to fixes which can act as
constraints or apply force to atoms. The Lennard-Jones potential is
used between this two balls.

Now I created one problem. There are two balls, and one ball is fixed
the other one is applied an external force. Then I use the minimize
command to find the lowest potential energy position. I think at the
lowest potential point this system must be at balance state. So the
external force must be equal to the attraction( or repulsion) force to
make the potential energy minimum. But the lammps does not follow this
rule. Please run the below code.

# minimization test

echo screen
dimension 3
units real
atom_style atomic
boundary f f f

pair_style lj/cut 100
neighbor 100 bin
neigh_modify every 1

group upper id 2
group lower id 1

velocity lower set 0 0 0 units box
velocity upper set 0 0 0 units box
fix 1 lower planeforce 0 1 0

#displace_atoms upper move 0 1.107 0 units box

fix 3 upper addforce 0 1.0 0
minimize 1.0e-19 1.0e-19 100000000 100000000

timestep 1
thermo 1
dump 2 upper custom 1 dump.try2 y fy vy
dump 1 all xyz 1 dump.try1
run 1000

# Below is the data.try file
2 atoms
1 atom types

-300 300 xlo xhi
-300 300 ylo yhi
-300 300 zlo zhi

Masses

1 1

Pair Coeffs

1 1.0 1.0 100

Atoms

1 1 0.0 0.0 0
2 1 0.0 1.9 0

If you observe the dump.try2 file you can find the fy is not zero. But
that should be zero to make the potential minimum, and fy is not zero it
means the system is not in balance. So I think lammps is not correct for
the minimize command.

Thank you,

Jian Yao

Jian Yao,

The problem is that you are not using the addforce fix properly. Please see the documentation: http://lammps.sandia.gov/doc/fix_addforce.html

First, you need to use fix_modify to include the energy from the addforce fix in the output. See the docs: http://lammps.sandia.gov/doc/fix_modify.html

Second, if you continuously add a force to your upper atom, it will continuously move to the right. Better to not use the addforce fix at all:

# minimization test
echo screen
dimension 3
units real
atom_style atomic
boundary f f f
pair_style lj/cut 100
neighbor 100 bin
neigh_modify every 1