Hi all,
Sorry to bother again.
I want to add a force to molecules in a region,
This is the input script:
units real
atom_style full
boundary p p p
read_data 00.data.lammps
group water type 1 2
bond_style harmonic
bond_coeff 1 450 0.9572
angle_style harmonic
angle_coeff 1 55 104.52
pair_style lj/cut/coul/long 12.0
kspace_style pppm 0.0001
special_bonds lj/coul 0.0 0.0 0
neighbor 2.0 bin
neigh_modify delay 0 one 2000 check yes
timestep 1.0
thermo_style custom step temp etotal
thermo_style custom step temp etotal press
thermo_modify flush yes line one
thermo 100
fix 2 water nvt temp 300.0 300.0 100.0
velocity water zero linear
region forcing block INF INF INF INF 25 35 units box
variable P equal 2460 (pressure I need, in the unit atm)
variable press_conv_factor equal 0.1439 (convert pressure in the unit ‘atm’ to force/square in the unit kcal/(moleAngstrom))
variable N_in_region equal count(water,forcing)/3
variable force equal v_Pv_press_conv_factorlxly/v_N_in_region
fix 3 water addforce 0.0 0.0 -v_force region forcing
run 500000
But, the force can not be added to the atoms in the region ‘forcing’. Only if I change the comand '‘fix 3 water addforce 0.0 0.0 -1 region forcing’, it works. But, the output value ‘v_force’ is nonzero.
I don’t know how to solve the problem and I’m not sure if I need to change the unit from ‘atm’ to ‘kcal/(mole*angstrom)’
Thanks,
hang
2011-09-29