zoukankan      html  css  js  c++  java
  • LAMMPS Polydisperse Packings

    LAMMPS Polydisperse Packings

     

    image

    Random polydisperse spherical packings can be generated by randomly placing spheres of different sizes into a box until no more will fit. While this sounds fairly straightforward, its not something that I want to invest time doing myself. Fortunately for me, a free and open source software package called LAMMPS, which is normally used for molecular dynamics simulations, can be used to create these packed systems. In this article I explain how this can be done.

    LAMMPS Installation

    Since this project only requires a basic build of LAMMPS, compiling from source is relatively simple. Download the source from their webpage and execute the following commands in the corresponding directories.

    path/to/lammps/src/STUBS> make
    path/to/lammps/src> make yes-granular
    path/to/lammps/src> make serial

    This will build a simple version of lammps with the optional granular package right in the directory. Note, this worked for me on mac OS X 10.10 and should be similar for linux.

    LAMMPS Script

    LAMMPS runs by reading in a script and executing the commands. I got the idea for using LAMMPS from another blog post. However, his scripts are intended for a dated version of LAMMPS, so I have posted my versions where I have made a few changes. The basic idea of the script is to periodically “pour” spheres into the top of the system and let them fall to the bottom. Interestingly, a quadratic potential is used for the pairwise interactions so they’re not technically hard sphere. However, this allows one to use a straightforward molecular dynamics simulation with gravity turned on to do the packing.

    atom_style sphere
    boundary p p fm
    newton off
    comm_modify vel yes
    
    region reg block 0 1 0 1 0 1 units box
    create_box 1 reg
    
    neighbor 0.2 bin
    neigh_modify delay 0
    
    pair_style gran/hooke/history 200.0 NULL 50.0 NULL 0.5 0
    pair_coeff * * 
    
    timestep 0.001
    
    fix 1 all nve/sphere 
    fix 2 all gravity 1.0 spherical 0.0 -180.0
    fix zlower all wall/gran 200.0 NULL 50.0 NULL 0.5 0 &
    zplane 0.0 200.0
    
    region slab block 0 1 0 1 0.5 1 units box
    fix ins1 all pour 500 1 12345 region slab diam one 0.2
    
    dump 1 all custom 100 dump.lmp type x y z radius
    run 1000

    Theres a lot going on here, but the most important line is the “fix pour” command. This command tells LAMMPS to insert 500 particles with diameter 0.2 into the system. For polydisperse systems, replace this line with the below “fix pour” command. This will insert particles with diameter 0.1 with 75% probability and diameter 0.2 with 25% probability.

    fix ins1 all pour 500 1 12345 region slab diam poly 2 0.1 0.75 0.2 0.25

    The “dump” command details data output (every 100 time steps) and format (type x y z rad). The last command actually runs the simulation. For a fully packed system, you will probably need to run for many more time steps (>100000). Note that you may not actually be able to fit 500 particles. The script is run with the following command.

    path/to/lammps/src/lmp_serial -in script_file
    

    Visualization

    For visualization, I used software called OVITO, which is excellent and free. Thanks to Joel Berry for introducing this to me. It interfaces very nicely with LAMMPS. Just load the dump file using OVITO’s “LAMMPS Text Dump File” format option. Below is a small animation I created in OVITO of the simulation in action.

    讨论:

    Hi Ryan, I have a quick question:

    I get: ERROR: Lost atoms: original 500 current 449 (../thermo.cpp:427) at timestep 0. I’m assuming that you put in an ignore statement as these lost atoms are due to them not fitting in the domain?

    Many thanks again
    Brani

    (PS. cool blog, hope your PhD is going swell)

    rsdavis
    January 20, 2017 - 7:09 pm Permalink
     

    Yeah, this is a common error, I get it too. Its correct that not all particles will fit. But, I think the error is due to particles getting too close together (overlapping), creating a very large force that can’t be dealt with, and so Lammps removes those particles from the system. For packing systems, this shouldn’t be a big issue, but I would try visualizing the system to confirm that it is sufficiently packed. Ovito is visualization software that is free and great for this application, VMD will work as well.

     
     
    S. Choi
    April 27, 2017 - 4:58 am Permalink
     

    Your post is very interesting and helpful.

    I have a question for poly-disperse(more than 2) system.

    For example, I modified input file of 3 type particle system as,
    fix ins1 all pour 1000 1 12345 region slab diam poly 3 0.05 0.50 0.1 0.25 0.2 0.25.
    (0.05~50%, 0.1~25%, 0.2~25%)
    but, this input file brought error.

    Is my input file is right?

    rsdavis
    April 27, 2017 - 7:17 pm Permalink
     

    Glad you found it helpful. I’ve never tried running with 3 different particle sizes, but your command looks correct according to the Lammps documentation. Perhaps there is an error elsewhere in your file. Also, make sure you have the granular package installed. It does not install by default and the script will not work without it.

  • 相关阅读:
    高级软件工程2017第2次作业—— 个人项目:四则运算题目生成程序(基于控制台)
    高级软件工程2017第1次作业
    2017高级软件工程 课程信息
    15061009-第0次作业(阅读与感想)
    新的開始!第一次作業
    软工实践第一次作业
    OO第四单元作业总结
    OO第二单元作业总结
    OO第一单元作业总结
    Dell BOSS 卡是什么
  • 原文地址:https://www.cnblogs.com/Simulation-Campus/p/8777118.html
Copyright © 2011-2022 走看看