lammps 模拟tip4p冰

时间:2024-02-20 17:33:01

【求助】lammps 模拟tip4p冰,密度总是调不对 (1)

想请各位帮忙看看我的输入文件哪里有问题。
压强等于0,得到的密度是0.933g/cm3左右。文献上是0.933g/cm3。总是不一样。输入的结构和周期性边界条件也反复检查过。xyz三个方向分别重复了5周期。

Radial distribution functions and densities for the SPC/E, TIP4P and TIP5P models for liquid water and ices Ih, Ic, II, III, IV, V, VI, VII, VIII, IX, XI and XIIw

种类1是O,2是H;L-J参数选用的是那篇文献的参数epsilong=0.006722  sigma=3.154000 

输入的in文件:
log                 03.ThermoMD.log
units               metal
atom_style       full

read_data        large.water

mass             1 15.9994
mass             2 1.008

group            g1 type 1
group            g2 type 2

pair_style       lj/cut/coul/long/tip4p 1 2 1 1 0.15 8.5 8.5
pair_coeff       1 1   0.006722  3.154000 8.5
pair_coeff       * 2    0.000000  0.000000 8.5

bond_style       harmonic
bond_coeff       1 527.20    0.9572
angle_style      harmonic
angle_coeff      1 37.95     104.52

kspace_style     pppm/tip4p 0.0001

neighbor        2 bin
neigh_modify    delay 0

timestep         0.002
thermo           100

thermo_style     custom step temp pe ke  etotal press vol v_varDensitySI pxx pyy pzz enthalpy epair evdwl ecoul  xlo xhi ylo yhi  zlo zhi
thermo_modify   flush yes line one

dump            water all custom 10000 04.Traj.part/04.Trajectory.*.xyi id type x y z
restart         100000 X.restart/X.restart

velocity        all create 250 143573
fix               fixShake all shake 0.0001 20 0 b 1 a 1
fix               T      all npt 250 250 0.2 xyz 0.0 0.0 2.0  drag  0.2
run             2000000
unfix           T
输入的坐标文件:

    3000    atoms
    2000    bonds
    1000    angles

    2       atom types
    1       bond types
    1       angle types

     -11.2250000      11.2250000       xlo xhi
     -19.4417000      19.4417000       ylo yhi
     -18.2950000      18.2950000       zlo zhi

Masses

       1    15.99940
       2     1.00800

Atoms

      1      1   1   -1.04   -8.209 -18.493 -17.992
      2      1   2    0.52   -8.209 -18.502 -17.035
      3      1   2    0.52   -8.209 -19.495 -18.320
      4      2   1   -1.04   -8.209 -18.417 -15.253
      5      2   2    0.52   -7.414 -18.022 -14.924
      6      2   2    0.52   -9.004 -18.022 -14.924
      7      3   1   -1.04   -8.209 -13.265 -14.328
      8      3   2    0.52   -8.209 -13.256 -13.371
      9      3   2    0.52   -8.209 -12.263 -14.656
     10      4   1   -1.04   -8.209 -13.341 -11.589

Response:

即使你使用完全相同的输入文件,使用同一个版本的程序来计算,但机器不一样,编译程序不一样,都会导致数值计算结果的一些很小的差别,这样的差别在MD计算中,随着运行步数的增加会累积和放大。假如输入文件不完全相同,比如说初始速度的分布采用不同的参数、原子位置输入时小数点位数不一样,温压控制参数不同,计算步数和统计平均的步数不一样,计算结果有差别就是更自然的事了。 另外我刚才看了一下,你的文献是用Monte Carlo方法模拟的,你是用分子动力学模拟的,方法就不同嘛,结果有差别,这再也正常不过了。文献列出的实验值是0.920,你得到0.933,他是0.937,你的结果还好过他,你该把这次模拟看成是成功的模拟才对。你纠结什么啊。

ASk:

非常感谢你细致的建议!另外还有个问题就是:  我对于tip4p/ew模型和tip4p模型的差别不是很清楚。tip4p/ew是不是用的截断的静电相互作用,而tip4p模型用的是长程经典相互作用呢?这个文献上面是tip4p模型,大概和我的in文件也不同吧。因为我用的应该是tip4p/ew模型。

 TIP4P/Ice (2005) force field for simulation of ice 1h

From: Ankit Mishra <ankitmis@...114...> Date: Fri, 12 May 2017 01:47:49 -0700

Dear lammps Users,

 
I am trying to simulate ice 1h structure which is hexagonal in nature using TIP4P/Ice (2005) force field. My objective is to obtain phonon density of states of water at T = 100 K (though temperature does not effect DOS, but still I am doing at low temperature to avoid diffusion effects) using a force field which properly describes this phase. And compare it with the behaviour of water at similar T & P  using a reaxFF implementation for a system, which also has water in it. This way I can compare how good the reaxFF implementation is.
 
Since ice 1h is the most stable phase at my required condition of temperature and pressure, hence I am trying to obtain its phonon DOS.
 
I have constructed the input script based on the information related to charges, and LJ parameters on the lammps web site (attached with this email). 
 
But after a trying a lot of things, I am still unable to obtain a stable structure at even 10K.
 
So here I list all the problems I encountered and solutions I tried:
 
1. I encountered the first problem in kspace_style, since TIP4P/Ice require kspace_style pppm/tip4p for coloumb interaction calculations, and this style only works with orthogonal strcutures.
Response by Axel Kohlmeyer <akohlmey@gm...> - 2017-05-12 12:02:09
as of LAMMPS version 6 Jan 2017​ this statement is incorrect.
 
So I changed my hexagonal structure to a orthogonal one, by some basic transformations.
 Response by Axel Kohlmeyer <akohlmey@gm...> - 2017-05-12 12:02:09
 it is generally more convenient and more efficient to run simulations in orthogonal cells.
 
2. Then I tried to simulate this orthogonal structure and minimize it using style CG/hftn but both did not work, and the system blew up in less than 50 MD steps with a time step of 1 fs.
 Response by Axel Kohlmeyer <akohlmey@gm...> - 2017-05-12 12:02:09
you define bonds and angle with force constants of 0.0. no surprise you are getting garbage. you must use either fix shake or have suitable values there (or larger, if you want to emulate fix shake) for scenarios in which shake is not supported.​
 
 
3. Then I tried other ways to minimize it, using suggestions on lammps page, i.e. putting viscous damping using fix viscous, and fix nve/limit.  I tried both of them alone and combined initially, to obtain a stable system. But even that did not work, as system continuously increases in temperature and results in blow up.
 Response by Axel Kohlmeyer <akohlmey@gm...> - 2017-05-12 12:02:09
see above, that is just nonsense.
 
4. I have also tried making initial time step extremely small, so as to make integration very fine, but even that does not control system temperature.
Response by Axel Kohlmeyer <akohlmey@gm...> - 2017-05-12 12:02:09
besides, ​why should the ​temperature be "constant" when your system isn\'t
equilibrated yet? this looks a lot like you need to spend more time
studying MD basics.

i\'ve pared down your massive and needlessly complex and convoluted input
and it seems to be running fine in the NVT ensemble from the get go.

units real
boundary p p p
atom_style full
read_data data.water

mass 1 15.9994 # O
mass 2 1.008 # H

pair_style lj/cut/tip4p/long 1 2 1 1 0.1577 12.0
kspace_style pppm/tip4p 1.0e-5
pair_modify tail yes

pair_coeff 1 1 0.21084 3.1668
pair_coeff 1 2 0.0 0.0
pair_coeff 2 2 0.0 0.0

bond_style harmonic
bond_coeff 1 0.0 0.9572

angle_style harmonic
angle_coeff 1 0.0 104.52

neighbor 2.0 bin
neigh_modify every 1 delay 0 check yes

timestep 1.0
velocity all create 10 34455 dist gaussian mom yes rot yes
fix 1 all nvt temp 10 10 100
fix 4 all shake 0.0001 10 1000 b 1 a 1

thermo_style custom step temp pe ke etotal press
thermo 100
run 1000


$  mpirun -np 4  ~/compile/lammps-icms/src/lmp_omp -in in.H2O  -sf omp
LAMMPS (4 May 2017)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread.
(../comm.cpp:90)
  using 1 OpenMP thread(s) per MPI task
using multi-threaded neighbor list subroutines
Reading data file ...
  orthogonal box = (0 0 0) to (31.28 40.663 29.44)
  2 by 2 by 1 MPI processor grid
  reading atoms ...
  3456 atoms
  scanning bonds ...
  2 = max bonds/atom
  scanning angles ...
  1 = max angles/atom
  reading bonds ...
  2304 bonds
  reading angles ...
  1152 angles
Finding 1-2 1-3 1-4 neighbors ...
  special bond factors lj:   0          0          0
  special bond factors coul: 0          0          0
  2 = max # of 1-2 neighbors
  1 = max # of 1-3 neighbors
  1 = max # of 1-4 neighbors
  2 = max # of special neighbors
Finding SHAKE clusters ...
  0 = # of size 2 clusters
  0 = # of size 3 clusters
  0 = # of size 4 clusters
  1152 = # of frozen angles
PPPM initialization ...
  extracting TIP4P info from pair style
WARNING: Using 12-bit tables for long-range coulomb (../kspace.cpp:321)
  G vector (1/distance) = 0.258867
  grid = 25 30 24
  stencil order = 5
  estimated absolute RMS force accuracy = 0.00369145
  estimated relative force accuracy = 1.11167e-05
  using double precision FFTs
  3d grid and FFT values/proc = 12958 4680
Last active /omp style is kspace_style pppm/tip4p/omp
Neighbor list info ...
  update every 1 steps, delay 0 steps, check yes
  max neighbors/atom: 2000, page size: 100000
  master list distance cutoff = 14.3154
  ghost atom cutoff = 14.3154
  binsize = 7.1577, bins = 5 6 5
  1 neighbor lists, perpetual/occasional/extra = 1 0 0
  (1) pair lj/cut/tip4p/long/omp, perpetual
      attributes: half, newton on, omp
      pair build: half/bin/newton/omp
      stencil: half/bin/3d/newton
      bin: standard
Setting up Verlet run ...
  Unit style    : real
  Current step  : 0
  Time step     : 1
SHAKE stats (type/ave/delta) on step 0
  1 0.854612 0.0716265 6912
  1 109.171 3.05582
Per MPI rank memory allocation (min/avg/max) = 10.68 | 10.88 | 11.08 Mbytes
Step Temp PotEng KinEng TotEng Press
       0    15.002171   -12092.961    102.98699   -11989.974    9961.9129
     100    7.8817572   -18880.145    54.106731   -18826.039   -3929.4866
     200    10.183447   -18895.078    69.907381   -18825.171   -2630.8048
     300    12.622467   -18908.331    86.650779    -18821.68   -3014.7697
     400     12.09286   -18903.123    83.015134   -18820.107   -3450.2393
     500      7.54285   -18873.918    51.780199   -18822.138   -2649.3121
     600    6.8884116   -18866.929    47.287606   -18819.641   -3977.6456
     700    7.7839339   -18875.136    53.435192   -18821.701   -2479.4775
     800    11.398194   -18895.435    78.246384   -18817.189   -3450.9473
     900    14.024945   -18912.645    96.278521   -18816.366   -3011.2215
SHAKE stats (type/ave/delta) on step 1000
  1 0.9572 5.07075e-08 6912
  1 104.52 4.743e-06
    1000    11.626875   -18897.209    79.816235   -18817.392   -2855.3987
Loop time of 27.7428 on 4 procs for 1000 steps with 3456 atoms

Performance: 3.114 ns/day, 7.706 hours/ns, 36.045 timesteps/s
77.9% CPU use with 4 MPI tasks x 1 OpenMP threads

MPI task timing breakdown:
Section |  min time  |  avg time  |  max time  |%varavg| %total
---------------------------------------------------------------
Pair    | 20.714     | 21.907     | 23.106     |  23.8 | 78.96
Bond    | 0.004088   | 0.0047882  | 0.006242   |   1.2 |  0.02
Kspace  | 3.6502     | 4.7702     | 5.9004     |  47.8 | 17.19
Neigh   | 0          | 0          | 0          |   0.0 |  0.00
Comm    | 0.38473    | 0.46556    | 0.54987    |  10.8 |  1.68
Output  | 0.000372   | 0.00082325 | 0.002165   |   0.0 |  0.00
Modify  | 0.57102    | 0.57173    | 0.5725     |   0.1 |  2.06
Other   |            | 0.0229     |            |       |  0.08

Nlocal:    864 ave 928 max 800 min
Histogram: 2 0 0 0 0 0 0 0 0 2
Nghost:    10690 ave 10754 max 10626 min
Histogram: 2 0 0 0 0 0 0 0 0 2
Neighs:    489880 ave 519172 max 460588 min
Histogram: 2 0 0 0 0 0 0 0 0 2

Total # of neighbors = 1959520
Ave neighs/atom = 566.991
Ave special neighs/atom = 2
Neighbor list builds = 0
Dangerous builds = 0
Total wall time: 0:00:27
 
I really do not know now what to do now.
Response by Axel Kohlmeyer <akohlmey@gm...> - 2017-05-12 12:02:09
ever heard of the KISS principle?

axel.​
 
I think there can be some problem with my data file but I do not know, what specific problem. As structure is okay on visualization. There are no free H or O atoms in the system. As everything is bonded. There are 1152 water molecules in my system, and the total number of atoms is 3456. Also I have maintained the order of O atom id < H atom id and there arrangement in the data file.
 
So I do not know if there is anything wrong with it, as I have tried my best to avoid any mistakes in the data file which I am sending to everybody\'s scrutiny, to save your time and effort. Though any suggestion related to possible problems in it will be really helpful.
 
Can someone recommend me what to do based on my objective and problems that I encountered.
 
I am attaching my input and data file for clarity.
 
I will be really grateful for suggestions.
 
Thanks,
Ankit

 Problems with TIP4Pice

From: Amir Haji-Akbari <amirhajiakbari@gm...> - 2012-07-28 17:49:41
Hi everyone,

I want to do NVT and NPT simulations of liquid water using the TIP4P/ice water model. 
But the simulations crash unless I use a very small (<0.05fs) timestep.
From: Steve Plimpton <sjplimp@gm...> - 2012-07-30 14:15:21
How does it crash?  Do you get an error message?  Does it run
for a while?  Does the thermodynamic output go bad?  Running
NPT with a single molecule of water is an odd model.  If you are not
careful, the box will collapse around it rapidly and the molecule will
interact with itself in an odd manner.

Steve

I use all the tricks in the book i.e. energy minimization before the actual simulation etc, but irrespective, the simulations crash after a while unless I choose a very small [unpractical] timestep stating that one hydrogen is missing. Below I include my input script and data file for one such simulation. PS, I am using the most recent release of LAMMPS released on July 4, 2012. Also the problem persists even if I don\'t use \'replicate\' and use energy minimization on a configuration that I have obtained otherwise. Regards Amir DATA FILE single1.dat # One tip4p/ice water molecule 0 3.9199999 xlo xhi 0 3.9199999 ylo yhi 0 3.9199999 zlo zhi 2 atom types 3 atoms 1 bond types 2 bonds 1 angle types 1 angles Masses 1 15.9994 2 1.0079 Atoms 1 1 1 -1.1794 2.0000 2.0000 2.0000 2 1 2 0.5897 1.243049672736339 1.414117723381705 2.0000 3 1 2 0.5897 2.756950327263661 1.414117723381705 2.0000 Velocities 1 0 0 0 2 0 0 0 3 0 0 0 Bond Coeffs 1 100 0.9572 Bonds 1 1 1 2 2 1 1 3 Angle Coeffs 1 300 104.52 Angles 1 1 2 1 3 ==== INPUT SCRIPT ==== ## Simulation of tip4p/ice water NPT seed 1 units real dimension 3 boundary p p p atom_style full atom_modify map array bond_style harmonic angle_style harmonic pair_style lj/cut/coul/long/tip4p 1 2 1 1 0.1577 8.5 8.5 read_data single1.dat replicate 16 16 16 group oxy type 1 # Name atom types group hyd type 2 group water union oxy hyd pair_coeff 1 1 0.210701615058703 3.1668 pair_coeff 2 2 0.0 0.0 kspace_style pppm/tip4p 1e-4 # Electrostatics dielectric 1.0 pair_modify tail yes # long-range correction for truncated Lennard-Jones interactions fix 5 all shake 1e-12 200000 0 b 1 a 1 # Make molecules rigid using shake thermo_style custom step temp press vol ke pe emol etotal neighbor 1.0 bin neigh_modify delay 0 every 1 check yes thermo 100 timestep 1.0 #nothing greater than 0.05 works dump 1 all xyz 100 position.xyz fix 6 all npt temp 220.0 220.0 200.0 iso 1.0 1.0 1000.0 restart 100 tip4piceNPT1a.out tip4piceNPT1b.out run 1000000