Monday, November 1, 2010

Linux command to display package description, information, version and usage (zz)

How do I display installed packages list?

If you are using rpm based distro such as Redhat/CentOS/Suse/Fedora Linux, enter:
# rpm -qa
# rpm -qa | less

If you are using apt based distro such as Debian/Ubuntu Linux, enter:
# dpkg --list

Task: Display package description and other information

If you are using rpm based distro such as Redhat/CentOS/Suse/Fedora Linux use rpm command:
rpm -qi {package-name}

For example display package description, version, vendor, build date for package called mtop, enter:
# rpm -qi mtop
Output:

Name        : mtop                         Relocations: (not relocatable) Version     : 0.6.6                             Vendor: Dag Apt Repository, http://dag.wieers.com/apt/ Release     : 1.2.el4.rf                    Build Date: Fri 20 Jan 2006 05:40:49 PM CST Install Date: Wed 07 Feb 2007 07:04:54 PM CST      Build Host: lisse.leuven.wieers.com Group       : System Environment/Base       Source RPM: mtop-0.6.6-1.2.el4.rf.src.rpm Size        : 138090                           License: GPL Signature   : DSA/SHA1, Fri 20 Jan 2006 05:48:51 PM CST, Key ID a20e52146b8d79e6 Packager    : Dag Wieers  URL         : http://mtop.sourceforge.net/ Summary     : Tool to monitor a MySQL database Description : mtop (MySQL top) monitors a MySQL database showing the queries which are taking the most amount of time to complete. Features include 'zooming' in on a process to show the complete query and 'explaining' the query optimizer information.

If you are using rpm based distro such as Debian/Ubuntu Linux use dpkg command:
dpkg -p {package-name]

For example display package description, version, and other information for package called zip, enter:
$ dpkg -p zip
Output:

Package: zip Priority: optional Section: utils Installed-Size: 248 Maintainer: Santiago Vila  Architecture: i386 Version: 2.32-1 Replaces: zip-crypt (<= 2.30-2) Depends: libc6 (>= 2.4-1) Recommends: unzip Conflicts: zip-crypt (<= 2.30-2) Size: 105640 Description: Archiver for .zip files  This is InfoZIP's zip program. It produces files that are fully  compatible with the popular PKZIP program; however, the command line  options are not identical. In other words, the end result is the same,  but the methods differ. :-)  .  This version supports encryption. 

Friday, October 29, 2010

Install Lammps on CentOS 5.2

http://planet.admon.org/howto/set-syste-variables-in-debian-and-centos/
http://rpm.pbone.net/index.php3/stat/11/limit/11/dl/40/vendor/3950/com/http:
wget -m -nd http://lammps.sandia.gov/tars/lammps.tar.gz

check linux Operation System: $ cat /etc/redhat-release

yum list will give you a list of all installed packages, and other packages available in the repos.

sudo yum install compat-libstdc++-33.x86_64

1. sudo yum install gcc gcc-c++ kernel-devel
sudo yum groupinstall "Development Tools"


2. sudo yum install tcsh

3. install fftw (version 2.1.5,download from http://www.fftw.org/download.html )
$ tar xvzf fftw-2.1.5.tar.gz
$./configure
$make
$sudo make install
$make check (to put the test programs through their paces. )

4. install gfortran

5. install mpich2 (version mpich2-1.3)
download from http://www.mcs.anl.gov/research/projects/mpich2/downloads/index.php?s=downloads

For install process, pls follow the file of Installguide
$ tar xzf mpich2-1.3.tar.gz
$ mkdir /home/.../mpich2-install
$ mkdir /tmp/.../mpich2-1.3


$ cd /mpich2-1.3
$ ./configure --prefix=/home/lxi/apps/mpich2-install 2>&1 | tee c.txt
$make 2>&1 | tee m.txt
$ make install 2>&1 | tee mi.txt

Add the bin subdirectory of the installation directory to your path:
(add to the file ~/.bashrc)
for bash and sh:

$ ~
$vi ./bashrc
(add " PATH=/home//mpich2-install/bin:$PATH ; export PATH "to the file)
$source .bashrc
$env (check if env variable set correctly)
$ which mpicc
$ which mpiexec
$mpiexec -n 5 ./examples/cpi
A file named .mpd.conf file must be present in the user's home directory

(/etc/mpd.conf if root) with read and write access only for the user, and
must contain at least a line with: MPD_SECRETWORD= One way to safely create
this file is to do the following:
cd $HOME
touch .mpd.conf
chmod 600 .mpd.conf
and then use an editor to insert a line like MPD_SECRETWORD=mr45-j9z into the file.
(Of course use some other secret word than mr45-j9z.)

5. install lammps
tar xvzf lammps.tar.gz
Copy Makefile to lammps-24Jan10/src/MAKE/Makefile.centos
$chmod 777 Makefile.centos

Make sure you are sitting in lammps-24Jan10/src (not the MAKE directory!).

# for parallel binaries make ubuntu # for serial, make STUBS, then LAMMPS cd STUBS ; make ; cd .. make ubuntu

Try an example to verify it works
While sitting in the src directory, the first command should run the "crack" example in serial mode. If your computer supports it, the second command should utilize 2 cores and run faster. Remember, even if you compile using the parallel makefile, the first invocation will still work, and is the reason you don't need a separate binary for serial runs.
Code:
# change to the examples/crack directory cd ../examples/crack # for serial or parallel builds ../../lmp_ubuntu <> 

Wednesday, September 15, 2010

Linux command

  1. scp
     ~$ scp Interfaces.txt new_file02.txt labu@10.21.36.3:.
~$
scp -r folder labu@10.21.36.3:.

http://www.basicconfig.com/linux/linux_scp_command_example


check linux Operation System: $ cat /etc/redhat-release

Friday, July 23, 2010

install pizza.py

1. download pizza package from : http://lammps.sandia.gov/index.html
2. uncompress
3. go the fold "scr"
4. open the file pizza.py
check the first line "#!/usr/local/bin/python -i", and change it to the fold where you python is installed. (You can use the COMMAND: $which python)
5. add pizza.py to the environment parameters in the file .bashrc

Install the tools of lammps

After installed the lammps, you can also install the tools which can be used to create/convert the data files of lammps

If you have installed Intel fortran (ifort)
1. Go to the fold "......./lammps/tools"
2. $ make

If you have installed gfortran, you should modify the Makefile
1. Go to the fold "......./lammps/tools"
2. Open Makefile, change "ifort" --> to "gfortran"
Notes:using the "Tab" to begin the line of gfortran
3.$ make

If you want to use the tools directly with command, you can add the tools fold to the PATH environment parameter in .bashrc file

Thursday, July 22, 2010

error tips

1. "Make" error: "*** missing separator (did you mean TAB instead of 8 spaces?). Stop."
A: Unlike most other DOS Make programs which accept any whitespace character at the beginning of a command in a rule, GNU Make insists that every such line begins with a TAB. (Most other Unix Make programs also require TABs, and the Posix standard requires it as well.) Make sure that the line whose number is printed in the error message (in this case, line 10) begins with a TAB.

Tuesday, July 20, 2010

Install lammps on Ubuntu

1. http://ubuntuforums.org/showthread.php?t=1390490
2. http://lammps.sandia.gov/doc/Section_start.html#2_2 (Including/excluding optional packages to lammps)

(1) Install required packages to build LAMMPS
You will need superuser privileges to successfully issue:
Code:
sudo apt-get install build-essential fftw-dev tcsh mpich2 gfortran
  • build-essential is non-negotiable, and you may already have it installed.
  • fftw-dev installs developer files for FFTW2 (not FFTW3, which won't work!) at standard locations that ubuntu knows about. It's possible to configure a LAMMPS compilation without any FFT tables, but I won't cover that here.
  • tcsh is required so the LAMMPS Makefile system works. Substituting this with the "csh" package probably won't make any difference. (EDIT: As of the 30 Jan 2010 patch, this package is no longer needed).
  • mpich2 will install MPICH-2, which can perform compilation of MPI programs linking to native MPI libraries. If only want a serial binary, you may safely leave this package off the list. While there are many other MPI implementations, I am not going to cover them here, though the idea is still the same. MPICH is kind of odd in that it requires a little bit more configuration to make it work, see below for the additional instructions.
  • gfortran is required to compile and link against the Fortran libraries MEAM and REAX. If you use a different Fortran compiler, or will not be linking these libraries, it is safe to leave this item off the package list.
(2) Get LAMMPS
You can do this by going to the LAMMPS WWW site (link) or by issuing the following command in terminal
Code:
  1. wget -m -nd http://lammps.sandia.gov/tars/lammps.tar.gz
(3) Unpack LAMMPS
Code:
tar xvzf lammps.tar.gz


(5) Copy Makefile to lammps-24Jan10/src/MAKE/Makefile.ubuntu (see: http://ubuntuforums.org/showthread.php?t=1390490 )

Have attached two files, one for serial and parallel builds. Due to the restrictions of the ubuntuforums.org, I had to give these with a ".txt" extension. When copying the makefile, I highly recommend removing everything from the underscore to the end off the filename (especially including the .txt!).

(6)Compile LAMMPS

Make sure you are sitting in lammps-24Jan10/src (not the MAKE directory!). You'll need the STUBS library if you're making a serial binary

  1. Code:
    # for parallel binaries
    make ubuntu
    # for serial, make STUBS, then LAMMPS
    cd STUBS ; make ; cd ..
    make ubuntu
  2. Try an example to verify it works
    While sitting in the src directory, the first command should run the "crack" example in serial mode. If your computer supports it, the second command should utilize 2 cores and run faster. Remember, even if you compile using the parallel makefile, the first invocation will still work, and is the reason you don't need a separate binary for serial runs.
    Code:
    # change to the examples/crack directory
    cd ../examples/crack
    # for serial or parallel builds
    ../../lmp_ubuntu <>

Finally, note that if you want to build lammps again after a new release or when patches of merged with the trunk, You can simply begin at step 3 and follow to the end. That "wget" command should always give you the latest package as long as the LAMMPS people keep their website they way they have it now.

Monday, June 28, 2010

Ubuntu没有声音了怎么办? zz

http://forum.ubuntu.org.cn/viewtopic.php?p=964475

1. 问题的根源在于用户失去了访问audio设备的权限。可以通过命令

ls -la /dev/snd

来查看音频设备的使用权限。比如在我的系统下,输出

total 0
drwxr-xr-x 2 root root 180 2008-05-14 08:53 .
drwxr-xr-x 12 root root 4580 2008-05-15 13:01 ..
crw-rw----+ 1 root root 116, 8 2008-05-14 08:53 controlC0
crw-rw----+ 1 root root 116, 7 2008-05-14 08:53 hwC0D2
crw-rw----+ 1 root root 116, 6 2008-05-14 08:54 pcmC0D0c
crw-rw----+ 1 root root 116, 5 2008-05-14 14:04 pcmC0D0p
crw-rw----+ 1 root root 116, 4 2008-05-14 08:53 pcmC0D1p
crw-rw----+ 1 root root 116, 3 2008-05-14 08:53 seq
crw-rw----+ 1 root root 116, 2 2008-05-14 08:53 timer

这代表只有root和audio组的用户可以使用 音频设备。这也就是为什么
在root下Volume Control工作正常,而在其他用户下无法使用。也许是
一些错误操作将用户从audio组中删除而无法使用音频设备。解决办法是

sudo chmod -R a+rwx /dev/snd

这样就会让所有的用户可以访问音频设备。 更加恰当的方法是,

sudo usermod -a -G audio usrname.

上述操作将用户usrname添加到audio组中。

from http://blog.csdn.net/hecssy/archive/2008/08/23/2816887.aspx

2. 先用通过命令

ls -la /dev/snd查看一下声卡有没有权限。
如你在安装系统时你的名字不在列哪就说明这个用户没有权限。开通你用户的权限就可以了。方法如下
在系统管理--用户和组--点你的用户--点击以进行变更--输入你的开机密码--授权--双击你的用户名--点用户权限--把使用音频设备和视频设备都钩选--确定--重启电脑 。OK
希望对出现同样问题的朋友有所帮助。也谢谢楼上的老大给的方法。

Wednesday, June 23, 2010

Enable fold sharing in VirtualBox between Ubuntu(Host) & Windows7(Guest) OS

1.Enter VirtualBox, "Details"--> "Shared Folds", set the fold which u want share with Win7, such as: /home/katter/share

2.Enter virtual machie. "Device"-->"Install Gust Addition"

3.Enter Win7, open Command Prompt (like DOS), run the command: net use z: \\vboxsvr\share
Note: "share" is the fold i have set in Ubuntu, "z:" is not important, u can choose "x: y: i:....." as u like

Tuesday, June 22, 2010

Install an RPM Package on Ubuntu Linux (zz)

http://www.howtogeek.com/howto/ubuntu/install-an-rpm-package-on-ubuntu-linux/

Installing software on Ubuntu usually entails using Synaptic or by using an apt-get command from the terminal. Unfortunately, there are still a number of packages out there that are only distributed in RPM format.

There’s a utility called Alien that converts packages from one format to the other. This doesn’t always mean that an rpm will work on your system, though. You will need to install some prerequisite software packages in order to install alien, however. These packages include gcc and make.

Run this command to install alien and other necessary packages:

sudo apt-get install alien dpkg-dev debhelper build-essential

To convert a package from rpm to debian format, use this command syntax. The sudo may not be necessary, but we’ll include it just in case.

sudo alien packagename.rpm

To install the package, you’ll use the dpkg utility, which is the internal package management tool behind debian and Ubuntu.

sudo dpkg -i packagename.deb

The package should now be installed, providing it’s compatible with your system.

Tuesday, June 15, 2010

Add/build tools of LAMMPS

Go to the tools fold of LAMMPS,
Such as build the tool lmp2arc, do as following:

To build the program
% cd lmp2arc
% cd src
% make
% cp lmp2arc.exe ../bin

The program is only a few files so should compile
quickly.

Installing Software in GNU/Linux (zz)

http://www.linuxforums.org/forum/linux-tutorials-howtos-reference-material/64958-how-install-software-linux.html

Tuesday, June 8, 2010

tips for running .bashrc

Error: bash: export: `-L/usr/local/lib': not a valid identifier
Answer: that error is what you would get if you had a space before and after the '='. No spaces!

Friday, May 14, 2010

scp ifconfig

Installing Debian LAMMPS

http://perso.ens-lyon.fr/emmanuel.quemener/dokuwiki/doku.php?id=lammps4debian

Installing Debian LAMMPS

System Preparation
1.Retrieve the latest version on the website of Sandia:
wget -m -nd http://lammps.sandia.gov/tars/lammps.tar.gz

2.Opening the archive:
tar xvf lammps.tar.gz

3.Go through the archive:
cd-lammps * /

4.Setting a variable root Lammps:
export LAMMPSROOT=$(pwd)

5.Setting the local MPI:
cd $LAMMPSROOT/src/STUBS
make clean
make
6.Edit the file $LAMMPSROOT/src/change_box.cpp by adding #include

7.Compiling an indispensable yes-aspheric:
cd $LAMMPSROOT/src
make yes-asphere

Compilation basic
cd $LAMMPSROOT/src
make serial

If compilation is successful, the command ldd lmp_serial you must provide information like:
linux-gate.so.1 => (0xb7f92000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7e8d000)
libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb7e67000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7e59000)
libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb7cfe000)
/lib/ld-linux.so.2 (0xb7f93000)

The executable is LAMMPS lmp_serial

Compiling with FFTW

Preliminary Installation
sudo apt-get install fftw2 fftw-dev

Importing the Makefile Makefile.fftw in the $ LAMMPSROOT / src MAKE:
cd $LAMMPSROOT/src/MAKE
wget http://perso.ens-lyon.fr/emmanuel.quemener/software/LAMMPS/Makefile.fftw

Compilation
cd $LAMMPSROOT/src
make fftw

If compilation is successful, the command ldd lmp_fftw you must provide information like:
linux-gate.so.1 => (0xb7f22000)
libfftw.so.2 => /usr/lib/libfftw.so.2 (0xb7edf000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7df1000)
libm.so.6 => /lib/i686/cmov/libm.so.6
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7dbd000)
libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb7c62000)
/lib/ld-linux.so.2 (0xb7f23000)

The executable is LAMMPS lmp_fftw

Compiling with FFTW and OpenMPI
Preliminary Installation
sudo apt-get install libopenmpi-dev openmpi-bin libopenmpi1 openmpi-common
sudo apt-get install fftw2 fftw-dev

Compilation basic
cd $LAMMPSROOT/src
make serial

If compilation is successful, the command ldd lmp_serial you must provide information like:
linux-gate.so.1 => (0xb7f92000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7e8d000)
libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb7e67000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7e59000)
libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb7cfe000)
/lib/ld-linux.so.2 (0xb7f93000)

The executable is LAMMPS lmp_serial

Compiling with FFTW

Preliminary Installation
sudo apt-get install fftw2 fftw-dev

Importing the Makefile Makefile.fftw in the $ LAMMPSROOT / src MAKE:
cd $LAMMPSROOT/src/MAKE
wget http://perso.ens-lyon.fr/emmanuel.quemener/software/LAMMPS/Makefile.fftw

Compilation Compilation
cd $LAMMPSROOT/src
make fftw

If compilation is successful, the command ldd lmp_fftw you must provide information like:
linux-gate.so.1 => (0xb7f22000)
libfftw.so.2 => /usr/lib/libfftw.so.2 (0xb7edf000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7df1000)
libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb7dca000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7dbd000)
libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb7c62000)
/lib/ld-linux.so.2 (0xb7f23000)

The executable is LAMMPS lmp_fftw

Compiling with FFTW and OpenMPI

Preliminary Installation
sudo apt-get install libopenmpi-dev openmpi-bin libopenmpi1 openmpi-common
sudo apt-get install fftw2 fftw-dev

Importing the Makefile Makefile.openmpi in the $ LAMMPSROOT / src / MAKE:
cd $LAMMPSROOT/src/MAKE
wget http://perso.ens-lyon.fr/emmanuel.quemener/software/LAMMPS/Makefile.openmpi

Compilation
cd $LAMMPSROOT/src
make openmpi

If compilation is successful, the command ldd lmp_openmpi you must provide information like:
linux-gate.so.1 => (0xb7f77000)
libfftw.so.2 => /usr/lib/libfftw.so.2 (0xb7f34000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7e46000)
libmpi_cxx.so.0 => /usr/lib/libmpi_cxx.so.0 (0xb7e27000)
libmpi.so.0 => /usr/lib/libmpi.so.0 (0xb7da3000)
libopen-rte.so.0 => /usr/lib/libopen-rte.so.0 (0xb7d4f000)
libopen-pal.so.0 => /usr/lib/libopen-pal.so.0 (0xb7cf8000)
libdl.so.2 => /lib/i686/cmov/libdl.so.2 (0xb7cf4000)
libnsl.so.1 => /lib/i686/cmov/libnsl.so.1 (0xb7cdb000)
libutil.so.1 => /lib/i686/cmov/libutil.so.1 (0xb7cd6000)
libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb7cb0000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7ca3000)
libpthread.so.0 => /lib/i686/cmov/libpthread.so.0 (0xb7c8a000)
libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb7b2f000)
/lib/ld-linux.so.2 (0xb7f78000)

Compiling with MPICH and FFTW
Preliminary Installation
sudo apt-get install libmpich1.0-dev libmpich1.0gf mpich-bin
sudo apt-get install fftw2 fftw-dev

Importing the Makefile Makefile.mpich in the $ LAMMPSROOT / src / MAKE:
cd $LAMMPSROOT/src/MAKE cd $ LAMMPSROOT / src / MAKE
wget http://perso.ens-lyon.fr/emmanuel.quemener/software/LAMMPS/Makefile.mpich

Compilation Compilation
cd $LAMMPSROOT/src c
make mpich

Importing the Makefile Makefile.openmpi in the $ LAMMPSROOT / src / MAKE:
cd $LAMMPSROOT/src/MAKE
wget http://perso.ens-lyon.fr/emmanuel.quemener/software/LAMMPS/Makefile.openmpi

Compilation
cd $LAMMPSROOT/src
make openmpi

If compilation is successful, the command ldd lmp_openmpi you must provide information like:
linux-gate.so.1 => (0xb7f77000)
libfftw.so.2 => /usr/lib/libfftw.so.2 (0xb7f34000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7e46000)
libmpi_cxx.so.0 => /usr/lib/libmpi_cxx.so.0 (0xb7e27000)
libmpi.so.0 => /usr/lib/libmpi.so.0 (0xb7da3000)
libopen-rte.so.0 => /usr/lib/libopen-rte.so.0 (0xb7d4f000)
libopen-pal.so.0 => /usr/lib/libopen-pal.so.0 (0xb7cf8000)
libdl.so.2 => /lib/i686/cmov/libdl.so.2 (0xb7cf4000)
libnsl.so.1 => /lib/i686/cmov/libnsl.so.1 (0xb7cdb000)
libutil.so.1 => /lib/i686/cmov/libutil.so.1 (0xb7cd6000)
libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb7cb0000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7ca3000)
libpthread.so.0 => /lib/i686/cmov/libpthread.so.0 (0xb7c8a000)
libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb7b2f000)
/lib/ld-linux.so.2 (0xb7f78000)

Compiling with MPICH and FFTW
Preliminary Installation
sudo apt-get install libmpich1.0-dev libmpich1.0gf mpich-bin
sudo apt-get install fftw2 fftw-dev

Importing the Makefile Makefile.mpich in the $ LAMMPSROOT / src / MAKE:
cd $LAMMPSROOT/src/MAKE
wget http://perso.ens-lyon.fr/emmanuel.quemener/software/LAMMPS/Makefile.mpich

Compilation
cd $LAMMPSROOT/src
make mpich

Tuesday, May 4, 2010

Install GROMACS

  • For single CPU
1.First, install FFTW library
Download FFTW 3.2.2 from http://www.fftw.org/download.html

$sudo ./configure --enable-float --enable-threads --enable-sse
$sudo make
$sudo make install

(note: --enable-float is important for install GROMACS correctly)

2. Set environment values to .bashrc file
export CPPFLAGS=-I/usr/local/include
export LDFLAGS=-L/usr/local/lib

3. Install GROMACS
Download GROMACS 4.0.7 from http://www.gromacs.org/index.php?title=Download_%26_Installation

$sudo ./configure --enable-float
$sudo make
$sudo make install

4. Set environment value for GROMACS
 # GROMACS
GROMACS=/usr/local/gromacs
export PATH=$GROMACS/bin:$PATH
export MANPATH=$GROMACS/share/man:$MANPATH
export LD_LIBRARY_PATH=$GROMACS/lib:$LD_LIBRARY_PATH

source $GROMACS/bin/GMXRC

  • For parallel computation with multi-processor
1. Install lam-mpi or open mpi or mpich2
2. Set environment valuables

export PATH=/usr/lib/lam/bin:$PATH

2. Install FFTW3
$ sudo ./configure --enable-float --enable-mpi --enable-sse
$sudo make
$sudo make install

3. Set environment valuables of FFTW3 for GROMACS

export CPPFLAGS="-I/usr/local/include -I/home/liuxi/apps/openmpi/include -I/home/liuxi/apps/openmpi/lib -I/usr/lib/lam/lib -I/usr/lib/lam/include"
export LDFLAGS=-L/usr/local/lib

4. Install GROMACS
$sudo ./configure --prefix=/home/xxxx/apps/gromacs --enable-mpi --enable-float --program-suffix="_mpi"
$sudo make
$sudo make install

5. Set environment valuable

# GROMACS
GROMACS=/usr/local/gromacs
export PATH=$GROMACS/bin:$PATH
export MANPATH=$GROMACS/share/man:$MANPATH
export LD_LIBRARY_PATH=$GROMACS/lib:$LD_LIBRARY_PATH

source $GROMACS/bin/GMXRC


------------------------------------
Some useful links:
http://lists.gromacs.org/pipermail/gmx-users/2008-April/033406.html
http://www.mail-archive.com/gmx-users@gromacs.org/msg27951.html
http://youyong.zz23.com/html/keyangongju/2010/0128/38529.html
http://www.mdbbs.org/thread-18939-1-2.html

Monday, May 3, 2010

Install LAMMPS on UBUNTU

1. lammps install with makefile.serial no makefile.linux
From: http://ubuntuforums.org/showthread.php?t=1038282&highlight=LAMMPS&page=2

Download it from lammps.sandia.gov


In the terminal write the following:

gunzip lammps*.tar.gz
tar xvf lammps*.tar


This will create a file named: ''lammps-21Nov09'' (The date may change depending of the updates in the website).


It will contain the following files: bench, doc, examples, lib, potentials, src, tools.


christian@christian-laptop:~/lammps/lammps-21Nov09$ cd src
christian@christian-laptop:~/lammps/lammps-21Nov09$ cd MAKE


Before keep going it is necessary to solve some dependencies: build-essential (to compile in C), MPIch (to work in parallel) , FFTW ( to compute long-range interactions), libxaw7 (to compute the movies). In one line code you choose


sudo apt-get install build-essential mpich-bin libmpich1.0-dev fftw2 fftw-dev libxaw7-dev


If you are working in your personal computer you just need


sudo apt-get install build-essential
sudo apt-get install libxaw7-dev


To avoid future problems it will be better installing with the first line code
Now in the MAKE file you will see a lot of makefiles.xxx. Most users think Makefile.linux is the one they should use because they use ''linux.'' If you open the Makefile.linux you will see that it requires MPICH and FFTW. Things that we actually don't need (especially if we are starting the use of lammps). What a Beginner needs to install is Makefile.serial. If you open this file you will see in the first line that it says: no MPICH, no FFTW.


If you read carefully the Makefile.serial, in one line it says:
# MPI library, can be src/STUBS dummy lib.
If you go to STUBS you will find a Makefile, this will create a dummy lib for MPI in accordance to the Makefile.serial. So in the STUBS file you type:


christian@christian-laptop:~/lammps/lammps-21Nov09/src/STUBS$ make clean
christian@christian-laptop:~/lammps/lammps-21Nov09/src/STUBS$ make


Then you go back to src and compile lammps


christian@christian-laptop:~/lammps/lammps-21Nov09/src$ make clean-all
christian@christian-laptop:~/lammps/lammps-21Nov09/src$ make serial

It will work correctly, to verify your installation we will run some examples. First type


christian@christian-laptop:~/lammps/lammps-21Nov09/src$ ./lmp_serial
You should get:


LAMMPS (7 Jul 2009)


This means you are ok in the installation process, ctrl-C to get out and let's go to the examples file (cd ../examples), Choose any, and get deep in learning the meaning of the codes. Each example has one or more lammps input files.
For instance I will choose ''flow'' (cd flow). It has two in.flow.xxx files. (input files). I will run one of them by typing:


christian@christian-laptop:~/lammps/lammps-21Nov09/examples/flow$ ../../src/lmp_serial < in.flow.couette


Where is the data stored? Check the in.flow.couette file to see where it is. Almost at the end it says:


dump 1 all atom 50 dump.flow


So the data is stored in dump.flow
To finish this test let's visualize the data in a movie. First let's install xmovie
For this


christian@christian-laptop:~/lammps/lammps-21Nov09/examples/flow$ cd ../../tools/
christian@christian-laptop:~/lammps/lammps-21Nov09/tools$ cd xmovie
christian@christian-laptop:~/lammps/lammps-21Nov09/tools/xmovie$ make
christian@christian-laptop:~/lammps/lammps-21Nov09/tools/xmovie$ ./xmovie


Now you will be able to visualize your data using xmovie just by typing in the flow directory


christian@christian-laptop:~/lammps/lammps-21Nov09/examples/flow$ ../../tools/xmovie/xmovie -scale dump.flow


This will open the program, maybe your screen will appear black, change the color of your particles and click in Start to watch it.

http://ubuntuforums.org/attachment.php?attachmentid=140676&d=1261350130



2. 1. lammps install with makefile for parallel
From : http://ubuntuforums.org/showthread.php?t=1390490

I will tell you how to compile a serial and parallel version of LAMMPS (24Jan10) on Ubuntu 9.10. I don't expect to be making many return trips to this post, since as far as I can tell, everything works smoothly.

A couple disclaimers:
  • Nearly everything can be figured out by thoroughly reading the LAMMPS documentation (link). That includes this entire guide!
  • Don't forget the mailing list (link). Someone may have already asked your question so be sure to search it (link).
  • I am going to assume you are comfortable issuing commands in the terminal.
  • I will not deal with the instructions for older versions of LAMMPS or Ubuntu, since they are outdated and correspondingly more complicated.
  • I am not responsible if you cannot get LAMMPS to compile.
  • These instructions have been only tested to work on 25 January 2010 on a fresh Ubuntu 9.10 (Karmic) installation.
  • It is your job to manage multiple MPI implementations if that is an issue on your machine. I assume there is no MPI infrastructure installed and install mpich2.
  • The version of LAMMPS changes very rapidly, so just replace lammps-24Jan10 with lammps-(whatever your package release date is) and everything should still work.
  • Finally, LAMMPS will probably never be available through apt-get because of very quick release of patches and updates as well as the inability to modify/extend LAMMPS if it were installed by apt-get. That means LAMMPS never gets "installed", and when you call it, the path to the binary must be explicitly given or be found within the $PATH.

Let's start making LAMMPS!
  1. Enable Universe Repository, if not enabled (link)
  2. Install required packages to build LAMMPS
    You will need superuser privileges to successfully issue:
    Code:
    sudo apt-get install build-essential fftw-dev tcsh mpich2 gfortran
    • build-essential is non-negotiable, and you may already have it installed.
    • fftw-dev installs developer files for FFTW2 (not FFTW3, which won't work!) at standard locations that ubuntu knows about. It's possible to configure a LAMMPS compilation without any FFT tables, but I won't cover that here.
    • tcsh is required so the LAMMPS Makefile system works. Substituting this with the "csh" package probably won't make any difference. (EDIT: As of the 30 Jan 2010 patch, this package is no longer needed).
    • mpich2 will install MPICH-2, which can perform compilation of MPI programs linking to native MPI libraries. If only want a serial binary, you may safely leave this package off the list. While there are many other MPI implementations, I am not going to cover them here, though the idea is still the same. MPICH is kind of odd in that it requires a little bit more configuration to make it work, see below for the additional instructions.
    • gfortran is required to compile and link against the Fortran libraries MEAM and REAX. If you use a different Fortran compiler, or will not be linking these libraries, it is safe to leave this item off the package list.
  3. Get LAMMPS
    You can do this by going to the LAMMPS WWW site (link) or by issuing the following command in terminal
    Code:
    wget -m -nd http://lammps.sandia.gov/tars/lammps.tar.gz
  4. Unpack LAMMPS
    Code:
    tar xvzf lammps.tar.gz
  5. Copy Makefile to lammps-24Jan10/src/MAKE/Makefile.ubuntu
    I have attached two files, one for serial and parallel builds. Due to the restrictions of the ubuntuforums.org, I had to give these with a ".txt" extension. When copying the makefile, I highly recommend removing everything from the underscore to the end off the filename (especially including the .txt!).
  6. Compile LAMMPS
    Make sure you are sitting in lammps-24Jan10/src (not the MAKE directory!). You'll need the STUBS library if you're making a serial binary
    Code:
    # for parallel binaries
    
    make ubuntu
    # for serial, make STUBS, then LAMMPS
    cd STUBS ; make ; cd ..
    make ubuntu
  7. Try an example to verify it works
    While sitting in the src directory, the first command should run the "crack" example in serial mode. If your computer supports it, the second command should utilize 2 cores and run faster. Remember, even if you compile using the parallel makefile, the first invocation will still work, and is the reason you don't need a separate binary for serial runs.
    Code:
    # change to the examples/crack directory
    
    cd ../examples/crack
    # for serial or parallel builds
    ../../lmp_ubuntu < in.crack
    # for parallel builds only
    mpiexec -np 2 ../../lmp_ubuntu <>

Finally, I note that if you want to build lammps again after a new release or when patches of merged with the trunk, You can simply begin at step 3 and follow to the end. That "wget" command should always give you the latest package as long as the LAMMPS people keep their website they way they have it now.

--------

Finishing the configuration of MPICH2
To finish your MPICH2 installation, you need to make a file at ~/.mpd.conf. The MPICH2 documentation tells you:
Code:
A file named .mpd.conf file must be present in the user's home

directory (/etc/mpd.conf if root) with read and write access
only for the user, and must contain at least a line with:
MPD_SECRETWORD=
One way to safely create this file is to do the following:
cd $HOME
touch .mpd.conf
chmod 600 .mpd.conf
and then use an editor to insert a line like
MPD_SECRETWORD=mr45-j9z
into the file. (Of course use some other secret word than mr45-j9z.)
The secret word isn't the utmost secret there is to be had--it's more just a mechanism that MPICH2 uses to make sure users don't step on each others toes. So just type in a jumble of letters and get on with running stuff.
Attached Files
File Type: txt Makefile.ubuntu_serial.txt (649 Bytes, 96 views)
File Type: txt Makefile.ubuntu_parallel.txt (649 Bytes, 115 views)

Last edited by Yoshis88; February 1st, 2010 at 02:02 PM..


Thursday, April 22, 2010

Amber in practice (in Chinese)

http://www.zhuaxia.com/item/211097608:

第一步:生成小分子模板

蛋白质中各氨基酸残基的力参数是预先存在的,但是很多模拟过程会涉及配体分子,这些有机小分子有很高的多样性,他们的力参数和静电信息不可能预存在库文件中,需要根据需要自己计算生成模板。amber中的antechamber 程序就是生成小分子模板的。

生成模板要
进行量子化学计算,这步可以由antechamber中附带的mopac完成,也可以由gaussian完成,这里介绍用gaussian计算的过程。

建议在计算前用
sybyl软件将小分子预先优化,不要用gaussian优化,大基组从头计算进行几何优化花费的计算时间太长。gaussian计算的输入文件可以用antechamber程序直接生成,生成后去掉其中关于几何优化的参数即可

将小分子优化后的结构存储为
mol2各式,上传到工作目录,用antechamber程序生成gaussian输入文件,命令如下:

antechamber -i 49.mol2 -fi mol2 -o 49.in -fo gzmat

这样可以生成49.in文件,下载到windows环境,运行gaussian计算这个文件,如果发现计算时间过长或者内存不足计算中断,可以修改文件选择小一些的基组。

获得输出文件
49.out之后将它上传到工作目录,再用antechamber生成模板,命令如下:

antechamber -i 49.out -fi gout -o 49mod.mol2 -fo mol2 -c resp

运行之后就会生成一个新的mol2文件,如果用看图软件打开这个文件会发现,原子的颜色很怪异,这是因为mol2的原子名称不是标准的原子名称,看图软件无法识别。下面一步是检查参数,因为可能会有一些特殊的参数在gaff中不存在需要程序注入,命令如下:

parmchk -i 49mod.mol2 -f mol2 -o 49mod

这样那些特殊的参数就存在49mod这个文件中了

第二步:处理蛋白质文件

amber
带的leap程序是处理蛋白质文件的,他可以读入PDB各式的蛋白质文件,根据已有的力场模板为蛋白质赋予键参数和静电参数。

PDB格式的文件有带有氢原子和孤对电子的信息,但是在这种格式下氢原子和孤对电子的命名不是标准命名,力场模板无法识别这种不标准的命名,因此需要将两者的信息删除

ATOM 12 1H ARG A 82 12.412 8.891 34.128 1.00 0.00 H

PDB各式里面,氢原子的信息会在第13或者14列出H字符,可以应用grep命令删除在13或者14列出H的行

命令如下:

grep -v '^.............H' 1t4j.pdb > x
grep -v '^............H' x > 1t4j_noh.pdb

除了删除氢和孤对电子,还应该把文件中的结晶水、乙酸等分子删除,这些分子的信息常常集中在文件的尾部,可以直接删除。

处理过之后的蛋白质文件,只包括各氨基酸残基和小分子配体的重原子信息,模拟需要的氢原子和水分子将在
leap中添加

接下
来需要进一步整理蛋白质文件,主要关注氨基酸的不同存在形态和小分子的原子名称。

半胱氨酸有两种存在形态,有的是两个半胱氨酸通过二硫键相连,有的则是自由的,两种半胱氨酸在力场文件中是用不同的
unit来表示的,这相当于是两个完全不同的氨基酸,需要手动更改蛋白质文件中半胱氨酸的名字,桥连的要用CYX,自由的用CYS

组氨酸有若干种质子态,和半胱氨酸一样,也需要查阅文献确定这些质子态,并更改残基名称

最后需要修改的是配体分子的原子名,这是工作量最大的事情,仔细观察可以发现,一般
PDB文件中配体的各个原子名称,和我们上面通过antechamber 生成的49mod.mol2中原子名称并不一致,这会造成leap无法识别这些原子,无法为这些原子赋予力参数和静电参数,因此需要手动更改蛋白质文件中配体分子的原子名称。

进行这一步可以同时用看图软件打开
49mod.mol2和蛋白质文件,隐藏蛋白质文件中除配体分子以外的所有结构,旋转两个文件,让他们姿态相近,以方便观察,并且在各自均标识原子名称,然后用文字编辑软件打开蛋白质文件,核对看图软件中两个分子对应的原子名称,手动逐一修改。

修改原子名称需要极大的耐心和细心,如果发生错误下一步的操作会无法继续。我现在想到的也只有这个笨办法,如果谁还有别的好法子,欢迎告诉我。

现在文件的准备工作都已经完成,该开始正式的模拟了
第三步:生成拓扑文件和坐标文件

amber进行分子动力学模拟需要坐标和拓扑文件,坐标文件记录了各质点所座落的坐标,拓扑文件记录了整个体系各质点之间的链接状况、力参数电荷等信息。这两个文件是由leap 程序生成的

amber中有两个leap程序,一个是纯文字界面的tleap,一个是带有图形界面的Xleap。但是amber图形界面做得很差,用远程登录使用图形界面不仅麻烦而且慢,所以我比较偏爱使用tleap,两个leap的命令是完全一样的,其实用哪一个都无所谓。

启动
tleap,在shell输入命令tleapleap就启动了,shell里会显示
-I: Adding /usr/local/amber8/antechamber-1.23/dat/leap/prep to search path.
-I: Adding /usr/local/amber8/antechamber-1.23/dat/leap/lib to search path.
-I: Adding /usr/local/amber8/antechamber-1.23/dat/leap/parm to search path.
-I: Adding /usr/local/amber8/antechamber-1.23/dat/leap/cmd to search path.

Welcome to LEaP!
(no leaprc in search path)
>
这个>leap的提示符

下面要
调入库文件。amber是模拟生物分子的好手,主要就是依靠专门为蛋白质多糖核酸量身订做的amber场,力场的所有参数都存储在库文件里,所以打开leap第一件事便是调入库文件。

amber提供了很多种库,这里我们只用到两个库,gaff02库,输入命令:
>source leaprc.gaff
>source leaprc.ff02
之后
两个库就调入进来了
这时可以用
list命令看看库里都有什么:
> list
ACE ALA ARG ASH ASN ASP CALA CARG
CASN CASP CCYS CCYX CGLN CGLU CGLY CHCL3BOX
CHID CHIE CHIP CHIS CILE CIO CLEU CLYS
CMET CPHE CPRO CSER CTHR CTRP CTYR CVAL
CYM CYS CYX Cl- Cs+ DA DA3 DA5
DAN DC DC3 DC4 DC5 DCN DG DG3
DG5 DGN DT DT3 DT5 DTN GLH GLN
GLU GLY HID HIE HIP HIS HOH IB
ILE K+ LEU LYN LYS Li+ MEOHBOX MET
MG2 NALA NARG NASN NASP NCYS NCYX NGLN
NGLU NGLY NHID NHIE NHIP NHIS NILE NLEU
NLYS NMABOX NME NMET NPHE NPRO NSER NTHR
NTRP NTYR NVAL Na+ PHE PL3 POL3BOX PRO
RA RA3 RA5 RAN RC RC3 RC5 RCN
RG RG3 RG5 RGN RU RU3 RU5 RUN
Rb+ SER SPC SPCBOX T4E THR TIP3PBOX TIP4PBOX
TIP4PEWBOXTP3 TP4 TP5 TRP TYR VAL WAT
gaff parm99
>
这里面罗列的就是库里面的unit,包括20种氨基酸、糖以及核酸还有一些常见离子的参数

下面一步是调入配体分子的模板,首先补全参数,输入命令:
>loadamberparams 49mod
然后
读入模板文件,输入命令:
>MOL = loadmol2 49mod.mol2
其中
MOLunit的名字,要保证这个名字和pdb文件中配体的残基名完全一致,否则系统仍然无法识别pdb文件中的小分子

现在再输入list命令会发现库里面多了一个unit:
>list
ACE ALA ARG ASH ASN ASP CALA CARG
CASN CASP CCYS CCYX CGLN CGLU CGLY CHCL3BOX
CHID CHIE CHIP CHIS CILE CIO CLEU CLYS
CMET CPHE CPRO CSER CTHR CTRP CTYR CVAL
CYM CYS CYX Cl- Cs+ DA DA3 DA5
DAN DC DC3 DC4 DC5 DCN DG DG3
DG5 DGN DT DT3 DT5 DTN GLH GLN
GLU GLY HID HIE HIP HIS HOH IB
ILE K+ LEU LYN LYS Li+ MEOHBOX MET
MG2
MOL NALA NARG NASN NASP NCYS NCYX
NGLN NGLU NGLY NHID NHIE NHIP NHIS NILE
NLEU NLYS NMABOX NME NMET NPHE NPRO NSER
NTHR NTRP NTYR NVAL Na+ PHE PL3 POL3BOX
PRO RA RA3 RA5 RAN RC RC3 RC5
RCN RG RG3 RG5 RGN RU RU3 RU5
RUN Rb+ SER SPC SPCBOX T4E THR TIP3PBOX
TIP4PBOX TIP4PEWBOXTP3 TP4 TP5 TRP TYR VAL
WAT gaff parm99
>
那个就是配体分子的模板

下面
读入pdb文件,输入命令:
>comp = loadpdb 1t4j_noh.pdb
如果
输入这个命令之后,屏幕上出现了大量的创建unit或者atom的信息,如下所示,则说明上面一步的pdb文件处理没有做好,还需要重新处理,通常这种情况都发生在配体分子上面,有时则是因为蛋白质中存在特殊残基。
Creating new UNIT for residue: FRJ sequence: 1
Created a new atom named: O36 within residue: .R
Created a new atom named: S33 within residue: .R
Created a new atom named: O35 within residue: .R
Created a new atom named: N34 within residue: .R
如果屏幕仅仅显示添加原子,这说明输入的PDB文件中缺失了部分重原子,leap根据模板自动补全了这些缺失的原子,这种情况不会影响进一步的计算
Added missing heavy atom: .R.A
Added missing heavy atom: .R.A
Added missing heavy atom: .R.A
Added missing heavy atom: .R.A

根据体系的具体情况,还可能要将成对的CYX残基中的二硫键相连,有时候还会链接其他原子,比如将糖基链接在氨基酸残基上,用bond命令可以完成,命令用法如下:

>bond comp.35.SG comp.179.SG

其中
comp刚才读入的分子名称,35179是残基序号,SGCYX残基模板中硫原子的名称,用comp.35.SG这样的语法就可以定位一个原子

如果希望进行考虑溶剂效应的动力学模拟,可能还需要为体系加上水,加水有很多种命令,这里只列举一个:

>solvatebox comp TIP3PBOX 10.0

solvatebox命令是说要加上一个方形的周期水箱,comp指要加水的分子,TIP3PBOX选择的水模板名称,10.0是水箱子的半径

有的体系
总电荷不为0为了模拟稳定,需要加入抗衡离子,系统会自动计算体系的静电场分布,在合适的位置加上离子,命令如下:

>addions comp Na+ 0

意思是用
钠离子把体总电荷补平,还可以选择其他库里面有的离子。

完成这一步之后就可以输出拓扑文件和坐标文件了,但是为了方便起见,在运行最后一步之前要先把
leap里加工好的分子单独存成一个库文件,以后可以直接调用这个库文件,免得重复上面的操作:

>saveoff comp 1taj.off

这样就生成了一个off文件在那里,下面输出拓扑文件和坐标文件

>saveamberparm comp 1t4j.prmtop 1t4j.inpcrd
Checking Unit.

Building topology.
Building atom parameters.
Building bond parameters.
Building angle parameters.
Building proper torsion parameters.
Building improper torsion parameters.
total 1 improper torsion applied
Building H-Bond parameters.
Not Marking per-residue atom chain types.
Marking per-residue atom chain types.
(Residues lacking connect0/connect1 -
these don't have chain types marked:

res total affected

CMET 1
)
(no restraints)

>quit

现在准备好拓扑文件和坐标文件,接下来就可以开始能量优化和动力学模拟了。如果愿意的话还可以用ambpdb这个命令生成一个pdb文件,直观地看一看生成了什么东西,命令如下:
[snowyowls@localhost actualamber]$ ambpdb -p 1t4j.prmtop <1t4j.inpcrd> kankan.pdb
| New format PARM file being parsed.
| Version = 1.000 Date =
09/08/06 Time = 16:36:09
[snowyowls@localhost actualamber]$

可以下载之后用看图软件欣赏,如果加了溶剂盒子的话,看的时候可要小心,会恨吓人的样子。

下面就要开始真正的模拟了

转好文章(amber 动力学)

amber 动力学过程:

1、选择力场 tleap -s -f $AMBERHOME/dat/leap/cmd/leaprc.ff99

2、导入晶体结构 model=loadpdb "sbp_lin.pdb"

保存crd和top文件 saveamberparm model polyAT_vac.top polyAT_vac.crd

此时注意电荷是否平衡:

如果缺正电荷 addions model Na+ 0 负离子就用Cl-

选择水箱 solvateoct model TIP3PBOX 8.0

3、保存crd和top文件 saveamberparm model model_wat.top model_wat.crd

4、退出tleap quit

5、保存新的pdb ambpdb -p model_wat.top <> model2.pdb

6、溶剂环境能量最优化。这一步保持溶质(蛋白)不变,去除溶剂中能量不正常的范德华相互作用。

该步骤的配置文件min1.in如下:

---------------------------------------------------------------------

oxytocin: initial minimisation solvent + ions ##说明信息######

&cntrl ##模拟参数起始

imin = 1, ##任务是优化,0 是分子动力学

cut = 10 ##非键相互作用的截断值为10 挨

ntb = 1, ##周期边界条件 0 不采用;1 定容 ;2 定压

maxcyc = 4000, ##优化步数

ntr = 1, ##优化时需要一些约束原子 -ref

ncyc = 2000, ##前2000最陡下降,后面步骤共轭梯度

/

Hold the protein fixed ##约束说明

500.0 ##作用在肽键上的力 kcal/mol

RES 1 9 ##限制的残基序号 同restrain=’:1-9’

END

END

------------------------------------------------------------------------------

任务命令:如果

sander -O -i min1.in -p model_wat.top -c model_wat.crd -o min1.out -r min1.rst –ref model_wat.crd &

7、对蛋白进行优化,min2.in文件将min1.in中的限制原子修改,限制水的位置。

也可以考虑利用restrainmask=’:1-9@CA,N,C’约束蛋白主链上的原子。

sander -O -i min2.in -p model_wat.top -c min1.rst -o min2.out -r min2.rst&

8、整体的优化,去掉限制条件

sander -O -i min3.in -p model_wat.top -c min2.rst -o min3.out -r min3.rst &

9、有限制的分子动力学

第一步分子动力学保持蛋白分子位置不变,但是不是完全固定每个原子,同时缓解蛋白分子周围的水分子,是溶剂环境能量优化。在这个步骤中,我们将主要目的是对特定的原子使用作用力使其能量优化。

Eq1.in 如下:

fix protein ,relax H2O

&cntrl

nstlim=25000, dt=0.002, ntx=1, irest=0, ntpr=500, ntwr=500,ntwx=500,

tempi=0.0,temp0=300,ntt=3, gamma_ln=1.0,

ntb=1, ntp=0,

nrespa=1,

cut = 10,

ntc=2,ntf=2,

NTR=1,

/

fix protein and HEM

10

RES 1 284

END

END

-----------------------------

nstlim = #:#表示计算的步数。dt = 0.002:表示步长,单位为ps,0.002表示2fs。ntx=1 irest=0 默认 ntb = 1:表示分子动力学过程保持体积固定。

imin = 0:表示模拟过程为分子动力学,不是能量最优化。

temp0 = 300:表示最后系统到达并保持的温度,单位为K。

tempi = 100:系统开始时的温度。 ntc=2,ntf=2 忽略氢键

gamma_ln = 1:表示当ntt=3时的碰撞频率,单位为ps-1(请参考AMBER手册)

ntt = 3:温度转变控制,3表示使用兰格氏动力学。

sander -O -i eq1.in -p model_wat.top -c min3.rst -o eq1.out -r eq1.rst -ref min3.rst -x eq1.mdcrd

11整系统分子动力学模拟: eq2

-------------------------------------------------

f2:500ps MD

&cntrl

imin = 0, irest=1, ntx=5,

ntb=2, pres0 = 1.0, ntp=1,

taup = 2.0, ntc=2, ntf=2,

cut = 10, ntr = 0,

ntt = 3, gamma_ln = 1.0,

tempi = 300.0 , temp0 = 300.0

nstlim=500000, dt=0.002,

ntpr=500, ntwr=500, ntwx=500

/

----------------------------------------------------------

ntb=2:表示分子动力学过程的压力常数。Pres0=1:引用1个单位的压强。

ntp=1:表示系统动力学过程各向同性。taup = 2.0:压力缓解时间,单位为ps。

使用以下命令进行MD:

sander -O -i eq2.in -p model_wat.top -c eq1.rst -o eq2.out -r eq2.rst -x eq2.mdcrd -ref eq1.rst &

结果处理:

在动力学过程中,将会产生 .rst 和.mdrcd 文件(需要的),由于crd文件很多,可以将其压缩成.gz 文件:gzip filename,将产生一个filename.gz 文件

做出已跑动力学的rmd图,判断是否平衡:

ptraj xxx.top <>

xxx.in 内容:

trajin eq2.mdcrd.gz

trajin eq3.mdcrd.gz

trajin eq4.mdcrd.gz

trajin eq5.mdcrd.gz

rms first mass out xin.rms.dat1 :1-284@CA,C,N time 0.1

#产生一个xin.rms.dat1的文件,整体1-284骨架上的C与N原子

rms first mass out xin.rms.dat2 :88-91,172,201-204,230@CA,C,N time 0.1

#产生一个xin.rms.dat2的文件,保守残基骨架上的C与N原子

----------------------------------------------------------------------------

利用xmgrace 作图:

xmgrace xin.rms.dat1 xin.rms.dat2

如果需要取随即的点的构型:

ptraj xxx.top <>

xxx.in内容:

trajin eq7.mdcrd.gz 117 117 #eq7中的117ps 的构型

strip :WAT #冒号前有空格,后没有,注意wat与top的水的大小写一致

strip :Na+

trajout eq7.pdb pdb nobox 产生一个eq7.pdb.117的文件

-------------------------------------------

traj AR.top <<>

> trajin AR.md7.crd 300 500

> center :1-250

> image center familiar

> rms first mass out rms.dat :1-250

> average average.rst restrt

> average average.pdb pdb

> EOF

对于有些小分子利用sybyl构建的一般缺少原子参数,首先将小分子单独存成mol2,用amber的antechamber 做出参数。

1、利用gaussian

* antechamber -i 49.mol2 -fi mol2 -o 49.in -fo gzmat

这样可以生成49.in文件,下载到windows环境,运行gaussian计算这个文件,如果发现计算时间过长或者内存不足计算中断,可以修改文件选择小一些的基组。

you have Gassian output file.out (don’t forget to put some keyword in the Gassian input for the special format used by amber)

* -antechamber –i file.out –fi gout –o filr.prep –fo prepi –c resp (this step prepare the “file.prep” for your drug -c bcc all right )

* -parmchk –i file.prep –f prepi –o file.frcmod )this step prepare the file “file.frcmod”for the drug)

2、 直接用mol2 转

也可以直接把sybyl 的mol2 做参数

* -antechamber –i file.mol2 –fi mol2 –o filr.prep –fo prepi –c resp / -c bcc

* -parmchk –i file.prep –f prepi –o file.frcmod

now you have 2 files: file.prep and file.frcmod for the drug .

注意修改file.prep 中文件名。要与pdb中的配体一致。(vi prep。假设是abc)

对应pdb与prep文件中的原子名称,,原子顺序要一致。

prep 在xleap中打开

using tleap for the protein or drug or/and complex

-xleap –s –f leaprc.ff99

-mod = loadamberparams file.frcmod

-loadamberprep file.prep

edit abc

pdb 可以用sybyl打开。用vi 修改pdb

-source leaprc.gaff

-RL = loadpdb file.pdb

-Solvateoct RL TIP3PBOX 10

-Addions RL Cl- 0 (0:zero for neutral charge,Cl- can be replaced by Na+)

-Saveamberparm RL fileWT.top fileWT.crd (save topology and coord. With water)

Amber网上教程地址[zz]


http://www.rosswalker.co.uk/tutorials/amber_workshop/


http://amber.scripps.edu/tutorials/


amber8/9

http://amber.scripps.edu/dbase.html

amber ff in gmx

http://folding.stanford.edu/ffamber/

other

http://www.chpc.utah.edu/%7Echeatham/software.html

AMBER 上好用低SMD计算
各位好以文字附上AMBER低输入档(
umbrella.RST

# Change distance between atoms 1771
and 3787 from 63 A to 253 A

&rst iat=1771,3787,r1=10., r2=63.,r3=63.,r4=210.,rk2=10.,rk3=10., /

smd.in

Sample pulling input
&cntrl
nstlim=1000000, cut=99.0, igb=1, saltcon=0.1,
ntpr=10, ntwr=10, ntt=3, gamma_ln=5.0,
ntx=5, irest=1, ntwx=10, ig = 256251,
ntc=2, ntf=2, tol=0.000001,
dt=0.002, ntb=0, tempi=310., temp0=310.,
jar=1,
/
&wt type='DUMPFREQ', istep1=1, /
&wt type='END', /
DISANG=dist.RST
DUMPAVE=dist_vs_t
LISTIN=POUT
LISTOUT=POUT


amber中生成小分子模板
第一步:生成小分子模板
蛋白质中各氨基酸残基的力参数是预先存在的,但是很多模拟过程会涉及配体分子,这些有机小分子有很高的多样性,他们的力参数和静电信息不可能预存在库文件中,需要根据需要自己计算生成模板。amber中的antechamber 程序就是生成小分子模板的。生成模板要进行量子化学计算,这一步可以由antechamber中附带的mopac完成,也可以由gaussian完成,这里介绍用gaussian计算的过程。
建议在计算前用sybyl软件将小分子预先优化,不要用gaussian优化,大基组从头计算进行几何优化花费的计算时间太长。gaussian计算的输入文件可以用antechamber程序直接生成,生成后去掉其中关于几何优化的参数即可
将小分子优化后的结构存储为mol2各式,上传到工作目录,用antechamber程序生成gaussian输入文件,命令如下:
antechamber -i 49.mol2 -fi mol2 -o 49.in -fo gzmat
这样可以生成49.in文件,下载windows环境,运行gaussian计算这个文件,如果发现计算时间过长或者内存不足计算中断,
可以修改文件选择小一些的基组。
获得输出文件49.out之后将它上传到工作目录,再用antechamber生成模板,命令如下:
antechamber -i 49.out -fi gout -o 49mod.mol2 -fo mol2 -c resp
运行之后就会生成一个新的mol2文件,如果用看图软件打开这个文件会发现,原子的颜色很怪异,这是因为mol2的原子名称
不是标准的原子名称,看图软件无法识别。下面一步是检查参数,因为可能会有一些特殊的参数在gaff中不存在需要程序注入,
命令如下:
parmchk -i 49mod.mol2 -f mol2 -o 49mod
这样那些特殊的参数就存在49mod这个文件中了
第二步:处理蛋白质文件
amber自带的leap程序是处理蛋白质文件的,他可以读入PDB各式的蛋白质文件,根据已有的力场模板为蛋白质赋予键参数和静电参数。
PDB格式的文件有时会带有氢原子和孤对电子的信息,但是在这种格式下氢原子和孤对电子的命名不是标准命名,力场模板无法识别这
种不标准的命名,因此需要将两者的信息删除
ATOM 12 1H ARG A 82 12.412 8.891 34.128 1.00 0.00 H
在PDB各式里面,氢原子的信息会在第13或者14列出现H字符,可以应用grep命令删除在13或者14列出现H的行
命令如下:
grep -v '^.............H' 1t4j.pdb > x
grep -v '^............H' x > 1t4j_noh.pdb
除了删除氢和孤对电子,还应该把文件中的结晶水、乙酸等分子删除,这些分子的信息常常集中在文件的尾部,可以直接删除。
处理过之后的蛋白质文件,只包括各氨基酸残基和小分子配体的重原子信息,模拟需要的氢原子和水分子将在leap中添加
接下来需要进一步整理蛋白质文件,主要关注氨基酸的不同存在形态和小分子的原子名称。
半胱氨酸有两种存在形态,有的是两个半胱氨酸通过二硫键相连,有的则是自由的,两种半胱氨酸在力场文件中是用不同的unit来表示的,
这相当于是两个完全不同的氨基酸,需要手动更改蛋白质文件中半胱氨酸的名字,桥连的要用CYX,自由的用CYS
组氨酸有若干种质子态,和半胱氨酸一样,也需要查阅文献确定这些质子态,并更改残基名称
最后需要修改的是配体分子的原子名,这是工作量最大的事情,仔细观察可以发现,一般PDB文件中配体的各个原子名称,和我们上面通过
antechamber 生成的49mod.mol2中原子名称并不一致,这会造成leap无法识别这些原子,无法为这些原子赋予力参数和静电参数,
因此需要手动更改蛋白质文件中配体分子的原子名称。
进行这一步可以同时用看图软件打开49mod.mol2和蛋白质文件,隐藏蛋白质文件中除配体分子以外的所有结构,旋转两个文件,
让他们姿态相近,以方便观察,并且在各自均标识原子名称,然后用文字编辑软件打开蛋白质文件,核对看图软件中两个分子对
应的原子名称,手动逐一修改。
修改原子名称需要极大的耐心和细心,如果发生错误下一步的操作会无法继续。我现在想到的也只有这个笨办法,如果谁还有别的好法子
欢迎告诉我。
现在文件的准备工作都已经完成,该开始正式的模拟了
第三步:生成拓扑文件和坐标文件
用amber进行分子动力学模拟需要坐标和拓扑文件,坐标文件记录了各个质点所座落的坐标,拓扑文件记录了整个体系各质点之间的
链接状况、力参数电荷等信息。这两个文件是由leap 程序生成的
amber中有两个leap程序,一个是纯文字界面的tleap,一个是带有图形界面的Xleap。但是amber的图形界面做得很差,用远程登录使用
图形界面不仅麻烦而且慢,所以我比较偏爱使用tleap,两个leap的命令是完全一样的,其实用哪一个都无所谓。
启动tleap,在shell里输入命令tleap,leap就启动了,shell里会显示
-I: Adding /usr/local/amber8/antechamber-1.23/dat/leap/prep to search path.
-I: Adding /usr/local/amber8/antechamber-1.23/dat/leap/lib to search path.
-I: Adding /usr/local/amber8/antechamber-1.23/dat/leap/parm to search path.
-I: Adding /usr/local/amber8/antechamber-1.23/dat/leap/cmd to search path.
Welcome to LEaP!
(no leaprc in search path)
>
这个>是leap的提示符
下面要调入库文件。amber是模拟生物分子的好手,主要就是依靠专门为蛋白质多糖核酸量身订做的amber力场,力场的所有参数都存
储在库文件里,所以打开leap第一件事便是调入库文件。
amber提供了很多种库,这里我们只用到两个库,gaff和02库,输入命令:
>source leaprc.gaff
>source leaprc.ff02
之后两个库就调入进来了
这时可以用list命令看看库里都有什么:
这里面罗列的就是库里面的unit,包括20种氨基酸、糖以及核酸还有一些常见离子的参数
下面一步是调入配体分子的模板,首先补全参数,输入命令:
>loadamberparams 49mod
然后读入模板文件,输入命令:
>MOL = loadmol2 49mod.mol2
其中MOL是unit的名字,要保证这个名字和pdb文件中配体的残基名完全一致,否则系统仍然无法识别pdb文件中的小分子
现在再输入list命令会发现库里面多了一个unit:
那个就是配体分子的模板
下面读入pdb文件,输入命令:
>comp = loadpdb 1t4j_noh.pdb
如果输入这个命令之后,屏幕上出现了大量的创建unit或者atom的信息,如下所示,则说明上面一步的pdb文件处理没有做好,
还需要重新处理,通常这种情况都发生在配体分子上面,有时则是因为蛋白质中存在特殊残基。
Creating new UNIT for residue: FRJ sequence: 1
Created a new atom named: O36 within residue: .R
Created a new atom named: S33 within residue: .R
Created a new atom named: O35 within residue: .R
Created a new atom named: N34 within residue: .R
如果屏幕仅仅显示添加原子,这说明输入的PDB文件中缺失了部分重原子,leap根据模板自动补全了这些缺失的原子,这种情况
不会影响进一步的计算
Added missing heavy atom: .R.A
Added missing heavy atom: .R.A
Added missing heavy atom: .R.A
Added missing heavy atom: .R.A
根据体系的具体情况,还可能要将成对的CYX残基中的二硫键相连,有时候还会链接其他原子,比如将糖基链接在氨基酸残基上
,用bond命令可以完成,命令用法如下:
>bond comp.35.SG comp.179.SG
其中comp是刚才读入的分子名称,35和179是残基序号,SG是CYX残基模板中硫原子的名称,用comp.35.SG这样的语法就可以定
位一个原子
如果希望进行考虑溶剂效应的动力学模拟,可能还需要为体系加上水,加水有很多种命令,这里只列举一个:
>solvatebox comp TIP3PBOX 10.0
solvatebox命令是说要加上一个方形的周期水箱,comp指要加水的分子,TIP3PBOX是选择的水模板名称,10.0是水箱子的半径
有的体系总电荷不为0,为了模拟稳定,需要加入抗衡离子,系统会自动计算体系的静电场分布,在合适的位置加上离子,命令如下:
>addions comp Na+ 0
意思是用钠离子把体系总电荷补平,还可以选择其他库里面有的离子。
完成这一步之后就可以输出拓扑文件和坐标文件了,但是为了方便起见,在运行最后一步之前要先把leap里加工好的分子单独存
成一个库文件,以后可以直接调用这个库文件,免得重复上面的操作:
>saveoff comp 1taj.off
这样就生成了一个off文件在那里,下面输出拓扑文件和坐标文件
>saveamberparm comp 1t4j.prmtop 1t4j.inpcrd
Checking Unit.
Building topology.
Building atom parameters.
Building bond parameters.
Building angle parameters.
Building proper torsion parameters.
Building improper torsion parameters.
total 1 improper torsion applied
Building H-Bond parameters.
Not Marking per-residue atom chain types.
Marking per-residue atom chain types.
(Residues lacking connect0/connect1 -
these don't have chain types marked:
res total affected
CMET 1
)
(no restraints)
>quit
现在准备好拓扑文件和坐标文件,接下来就可以开始能量优化和动力学模拟了。如果愿意的话还可以用ambpdb这个命令生成一
个pdb文件,直观地看一看生成了什么东西,命令如下:
[snowyowls@localhost actualamber]$ ambpdb -p 1t4j.prmtop <1t4j.inpcrd> kankan.pdb
| New format PARM file being parsed.
| Version = 1.000 Date = 09/08/06 Time = 16:36:09
[snowyowls@localhost actualamber]$
可以下载之后用看图软件欣赏,如果加了溶剂盒子的话,看的时候可要小心,会恨吓人的样子。
第四步:能量优化
用amber进行分子动力学模拟需要坐标和拓扑文件,这在上一步已经完成了,分别生成了1t4j.prmtop 和1t4j.inpcrd两个文件
,下面一步就是动力学模拟之前的能量优化了。
由于我们进行的起始结构来自晶体结构或者同源模建,所以在分子内部存在着一定的张力,能量优化就是在真正的动力学之前,
释放这些张力,如果没有这个步骤,在动力学模拟开始之后,整个分子可能会因此散架。
能量优化由sander模块完成,运行sander至少需要三个输入文件,分别是分子的拓扑文件,坐标文件以及sander的控制文件。
现在分子的拓扑文件和坐标文件已经完成,需要建立输入文件,min_1.in
Initial minimisation of our structures
&cntrl
imin=1, maxcyc=4000, ncyc=2000,
cut=10, ntb=1,ntr=1,
restraint_wt=0.5
restraintmask=':1-283'
/
文件首行是说明,说明这项任务的基本情况; &cntrl与/之间的部分是模拟的参数
其中imin=1表示任务是能量优化,maxcyc=4000表示能量优化共进行4000步,ncyc=2000表示在整个能量优化的4000步中,
前 2000步采用最陡下降法,在2000步之后转换为共轭梯度法,如果模拟的时候不希望进行方法的转换,可以再加入另一
个关键词NTMIN,如果NTMIN =0则全程使用共轭梯度法,NTMIN=2则全程使用最陡下降法,此外还有=3和=4的选项,分别是xmin法和lmod法
,具体情况可以看手册
第二行的cut=10表示非键相互作用的截断值,单位是埃, ntb=1表示使用周期边界条件,这个选项要和前面生成的拓扑文件坐标文件相匹配,
如果前面加溶剂时候用的是盒子水,就设置ntb=1,如果加的是层水,那就应该选择ntb=0;ntr=1表示在能量优化的过程中要约束一些原子,
约束的是哪些原子呢?后面有。
第三行和第四行都是关于约束原子的信息,restraint_wt=0.5限定了约束的力常数,在这里约束原子就是把原子用一根弹簧拉在固定的
位置上,一旦原子偏离固定的位置,系统就会给他施加一个回复力,偏离的越远,回复力越大,回复力就是由这个力常数决定的,单位是
Kcal/(mol*A)。 restraintmask=':1-283'表示约束的是从1到283号残基,在这个分子中,1-283号残基是蛋白质上的氨基酸残基,从284
号开始,就都是水了,所以这个命令的意思就是,约束整个蛋白质,自由地优化溶剂分子。因为溶剂分子是前面的tleap自动给加上的,
所以一定要额外多关注一些。
下面运行sander来执行这个优化:
[snowyowls@localhost actualamber]$ sander -O -i min_1.in -p 1t4j.prmtop -c 1t4j.i
npcrd -ref 1t4j.inpcrd -r 1t4j_min1.rst -o 1t4j_min1.out
命令中,-O表示覆盖所有同名文件,-i min_1.in表示sander的控制文件是min_1.in,-p 1t4j.prmtop表示分子的拓扑文件
,-c 1t4j.inpcrd表示坐标文件,-ref 1t4j.inpcrd是参考坐标文件,只有在控制文件中出现关键词ntr=1的时候才需要给
sander指定-ref文件,这是约束原子的参考坐标,- ref 1t4j.inpcrd就是说以1t4j.inpcrd中的坐标为准进行约束原子的优化。
以上这四个是输入文件。-r 1t4j_min1.rst表示经过模拟之后新的原子坐标会输出到1t4j_min1.rst文件中,-o 1t4j_min1.out
则表示优化过程中的相关信息都会写入到1t4j_min1.out文件中。
运行起这个命令之后,等拿到 1t4j_min1.rst文件就意味着对溶剂的优化已经差不多了,显然下面还需要对蛋白质本身进行优化,
这个优化还要分两步进行,控制文件分别是min_2.in 和min_3.in
min_2.in
Initial minimisation of our structures
&cntrl
imin=1, maxcyc=5000, ncyc=2500,
cut=10, ntb=1,ntr=1,
restraint_wt=0.5
restraintmask=':1-283@CA,N,C'
/
在这里发生变化的是约束原子的范围, ':1-283@CA,N,C'表示1-283号残基中名叫CA,N和C的原子,这些原子实际上是蛋白质主链上
的原子,也就是说这一次的优化是约束了蛋白质主链上的原子之后,对溶剂和侧链原子进行自由优化。
min_3.in
Initial minimisation of our structures
&cntrl
imin=1, maxcyc=10000, ncyc=5000,
cut=10, ntb=1,
/
在这里不再进行约束原子的优化了,对整个分子进行全原子优化。
三步优化的命令如下:
[snowyowls@localhost actualamber]$ sander -O -i min_1.in -p 1t4j.prmtop -c 1t4j.inpcrd -ref 1t4j.inpcrd -r 1t4j_min1.rst -o 1t4j_min1.out
[snowyowls@localhost actualamber]$ sander -O -i min_2.in -p 1t4j.prmtop -c 1t4j_min1.rst -ref 1t4j_min1.rst -r 1t4j_min2.rst -o 1t4j_min2.out
[snowyowls@localhost actualamber]$ sander -O -i min_3.in -p 1t4j.prmtop -c 1t4j_min2.rst -r 1t4j_heat0.rst -o 1t4j_min3.out
接下来就是真正的分子动力学模拟了……
本文引用地址: http://www.sciencenet.cn/m/user_content.aspx?id=289031