How to compute forces between two atoms using fix move or alternative?

Hi,

I’m using the fix move approach to calculate the potential energy between two molecules at different separation distances. This works fine — I can extract the energy as the molecules are moved apart.

Now I would like to calculate the force between two atoms in a similar way.
But since fix move does not calculate forces (when I add the forces on all the atoms in a molecule, I get zero force), I’m not sure how to proceed. I could think of creating multiple input files with different separation lengths between the molecules and then running a single step each time. Is there any easier approach than this? something inbuilt in LAMMPS?
Here’s a simplified version of my input script:
I’m doing this to see if there is anything wrong with my ‘python style’ force field.
Thank you for any advice.

units		real	                             #Angstroms, g/mol, etc.
atom_style	full                                 #Molecule + charge
timestep	1.0				     
#boundary        p p p		
boundary  p p p		     
read_data       conf.data
		      	    			   
########
pair_style	 python 15.0
pair_coeff	* * mypot.FivePoint 1 2 3
#########

bond_style	 zero nocoeff 
angle_style	 zero nocoeff 
dihedral_style	none				     
improper_style	none				     

bond_coeff	1  0.24812988161300004     
bond_coeff  2  0.434260425799           #
angle_coeff	1  180.0			     
angle_coeff 2  180.0                 
group lonepair   type 1
group nitrogen   type 2
group centrepoint type 3
neigh_modify exclude molecule/intra all 	  	 	     	    	     
#Reset the time step counter
reset_timestep  0                                   

# fix move
group res2 molecule 2
fix fix1 res2 move linear 0.1 0 0

dump  dump_2 all  custom 1 dump_all.lammpstrj id type x y z vx vy vz fx fy fz

variable        KineticEnergy equal ke              # Kinetic energy
variable        TotalEnergy equal etotal  
variable        PotentialEnergy equal epair          #Call the intermolecular potential energy $PotentialEnergy
#variable        Temperature equal temp               #

fix             3 all ave/time 1 1 1  v_PotentialEnergy v_KineticEnergy v_TotalEnergy  file ave.mydata.out format " %g"


run           100
write_restart ./restart_file1
undump        dump_2

It does not calculate potential energies either.
It does what its documentation says it does and moves atoms along a prescribed trajectory, nothing more.

Look for variable style: atom, such as in:

variable Fx atom fx

thank you, but when I did this simulation, and plotted the potential energy, I’m getting the potential energy curve which I input. If its not calculating the potential energy, how is it able to output this? My model is a 5 site model of N2, so to get the N2-N2 potential energy curve, we have to calculate the potential between all sites and then add them ( which is not trivial ). Since LAMMPS is outputting this accurately, I thought it is calculating the energies.

Thank you, what i meant is: I want to keep the first molecule fixed, then move the second molecule from a distance 2.0 to 10.0. While ouputing the force at each step. I could move the atom in the desired way with the ‘fix move’ command, but this is not calculating the pair-forces for some reason.

It is. You are not paying attention with sufficient care.
I only said that “fix move” is not computing neither energy nor forces.
Both is done by the pair style and other force styles.

You can have an input without any fixes and LAMMPS will still compute
energies (if requested for output) and forces. Only those will be the same
for every step, since the atoms won’t move.

I suggest you spend some quality time with the publications describing LAMMPS
and perhaps also a couple of LAMMPS tutorials, before you continue.
It seems you are lacking the understanding of what LAMMPS does internally
to do the kind of task you want to do well and without to much confusion and incorrect conclusions.

Thank you, what I was trying to say is that while the ‘Fix move’ command is used, the net force on the molecule is zero.
Fix move: Perform updates of position and velocity for atoms in the group each timestep using the specified settings or formulas, **without regard to forces on the atoms**.

It seems that when I’m moving the atoms with Fix move, the net force is always zero. Which is nonphysical at that separation distances. This made me assume that, the calculation of pair forces are “turned off”, when the Fix move command is used.

That is not what the quoted documentation says. It says that it ignores the computed forces.