Lammps_CG-Method
所属分类:Linux/Unix编程
开发工具:Unix_Linux
文件大小:311KB
下载次数:4
上传日期:2019-05-03 10:59:40
上 传 者:
nickyang
说明: CG-Method is designed for obtaining mesoscopic information like density profiles, force
interactions, stress tensors, and so on, from a microscopicconfiguration obtained through a MD simulation.
文件列表:
CHANGELOG.md (5242, 2016-06-16)
examples (0, 2016-06-16)
examples\params.h (2025, 2016-06-16)
povray (0, 2016-06-16)
povray\base.pov (3488, 2016-06-16)
povray\garamond.ttf (648744, 2016-06-16)
povray\render.sh (346, 2016-06-16)
povray\temperature.pov (3716, 2016-06-16)
src (0, 2016-06-16)
src\Makefile (454, 2016-06-16)
src\aux.c (1122, 2016-06-16)
src\cg.c (40211, 2016-06-16)
src\cg.h (9840, 2016-06-16)
src\draw.c (5170, 2016-06-16)
src\io.c (8098, 2016-06-16)
src\macrofunctions.c (3498, 2016-06-16)
src\mesofunctions.c (13986, 2016-06-16)
src\microfunctions.c (6476, 2016-06-16)
src\verlet.c (6186, 2016-06-16)
CG-Method
=========
*CG-Method* obtains mesoscopic information like density profiles, force
interactions, stress tensors, and so on, from a microscopic configuration
obtained through a MD simulation. A MD input script for LAMMPS can be obtained
in https://github.com/UNEDSoftMatter/Nanopore.
*CG-Method* needs blas, lapack and GSL. If you get an error compiling the
code, verify that the development version of these libraries are installed.
All the parameters are specified in the header file `params.h`. Note that
**you should compile whenever the parameters are changed**. A good practice is
to do a `make clean`, followed by `make`. An example `params.h` file can be
found in `~/examples/` directory. Note that **you should copy the file to
~/src/ before compiling the code**. If you obtain the following error
```
~/CG-Method/src$ make
gcc -c cg.c -o cg.c.o -lm -lblas -llapack -Wall -lgsl -lgslcblas -fopenmp -O2 -std=gnu99
In file included from cg.c:15:0:
cg.h:19:20: fatal error: params.h: No existe el fichero o el directorio
#include "params.h"
^
compilation terminated.
Makefile:13: recipe for target 'cg.c.o' failed
make: *** [cg.c.o] Error 1
```
it is because you did not copy `params.h` into the `src` directory.
Note that *CG-Method* is currently limited to 100000 snaphots (see `char
basename[7];` in `cg.c`).
The file `params.h` should contains the location (see below) of the positions
file and the velocities file created by LAMMPS. In LAMMPS, use a custom dump
output like this one
```
dump custom positions 100 id type x y z output.positions
dump custom positions 100 id type vx vy vz output.velocities
```
Please, see LAMMPS documentation to understand the meaning of these commands.
*CG-Method* admits arguments.
### *CG-Method* with arguments
If you do not provide any argument, *CG-Method* calls to the function `void
PrepareInputFiles(void)` (located in `src/io.c`). This function will create
snapshots for the positions and velocities using system calls. Then, it will
create a file list called `sim` which will be used to process each snapshot.
Essentially, `PrepareInputFiles` will do the following:
```
~$ if [ ! -d data/positions ]; then mkdir -p data/positions; fi
~$ cd data/positions
~/data/positions$ ln -s ../../PositionsFileStr ./output.positions
~/data/positions$ split -a 4 -d --lines=NParticles+9 output.positions
~/data/positions$ for i in $(ls |grep x); do cat $i | tail -n +10 | sort -n |awk '{print $2,$3,$4,$5}' > $i.pos ; rm $i ; done
~/data/positions$ rm output.positions
~/data/positions$ cd ../../
~$ if [ -d data/velocities ]; then mkdir -p data/velocities; fi
~$ cd data/velocities
~/data/velocities$ ln -s ../../VelocitiesFileStr ./output.velocities
~/data/velocities$ split -a 4 -d --lines=NParticles+9 output.velocities
~/data/velocities$ for i in $(ls |grep x); do cat $i | tail -n +10 | sort -n |awk '{print $3,$4,$5}' > $i.vel ; rm $i ; done
~/data/velocities$ rm output.velocities
~/data/velocities$ cd ../../
```
Note that both `PositionsFilesStr` and `VelocitiesFilesStr` are given in
`src/params.h`. **You should specify the relative path from where the binary
`CG` is located**.
Once the snapshots are created, *CG-Method* creates a txt file with the
basename of each snapshot:
```
~$ for i in $(ls data/positions/ | grep .pos); do basename $i .pos; done > sim
```
The program uses the file `sim` to process each snapshot.
### *CG-Method* without arguments
If you provide an argument to *CG-Method*, it will omit the creation of
snapshots and it will use `argv[1]` as the file list.
## Checklist
1. *CG-Method* needs blas, lapack and GSL. If you get an error compiling the
code, verify that these libraries are installed.
2. Note that the position files have 4 columns: the type of atom, and the
coordinates x, y and z. The velocitiy files have 3 columns: the velocities
in x, y and z.
3. The file `params.h` should be in `~/src` directory.
4. You should compile whenever you change `params.h`.
5. If called without arguments, `params.h` should contain the relative path of
positions and velocities.
近期下载者:
相关文件:
收藏者: