The question about command "setforce" and "pyy" output

Dear lammps user,

Recently I made a tensile test simulation of a polymer bar model. I used two methods to get the stress at different strain.

First, I used the command “setforce” to fix the two ends of the bar and assigned a velocity to one end. After dumping the output of “setforce,” I divided them by the area of the bar.

Second, I used the command “compute stress/atom”. The code is following:

compute		peratom all stress/atom NULL
compute		p all reduce sum c_peratom[1] c_peratom[2] c_peratom[3]
variable	press equal -(c_p[1]+c_p[2]+c_p[3])/(3*vol)
thermo_style	custom step temp etotal press v_press 
The problem is these two kinds of stress were not at the same magnitude. I don't know whether the problem is my code. 

Has anyone met such a problem? If the code is right, should these two methods get the same stress?

Best
Chi

These two methods would of course give you different answers. One is stress from the ends only the other is all the atoms; one is normalized by the area the other is by the volume.

To get a stress-strain curve, you should use only forces from the free atoms (without ends). It is your choice whether to normalize it by the cross sectional area or not.

Ray

Thanks Ray. I think you are right and appreciate your advice.

Best
Chi