zoukankan      html  css  js  c++  java
  • Ubuntu 下安装AMBER10/AmberTools 1.2

    Ubuntu 下安装AMBER10/AmberTools 1.2


    1 准备工作

    1.1
    编译前系统需要安装fortran/c编译器,csh/patch,以及flex(做语义分析的)
    sudo apt-get install gfortran g++ flex csh patch
    如果你要用intel编译器,可能会麻烦些。新手呢,最好听从amber作者David Case的建议先用gnu的编译器

    1.2
    修改 .profile或.bashrc文件,定义AMBERHOME变量:
    export AMBERHOME=/home/<FOO>/src/amber10   # 等号前后不能有空格!
    <FOO> 是你的用户名

    1.3
    到src目录下解压:
    cd ~/src/ 
    tar -xjvf Amber10.tar.bz2
    tar -xjvf AmberTools-1.2.tar.bz2


    1.4
    解压完成后在src上会生成amber10这个目录,也就是上面定义的AMBERHOME,进入这个目录下载bugfix并执行patch

    cd $AMBERHOME
    wget http://ambermd.org/bugfixes/10.0/bugfix.all
    wget http://ambermd.org/bugfixes/10.0/apply_bugfix_all.x
    chmod +x apply_bugfix_all.x
    ./apply_bugfix_all.x bugfix.all


    上面是Amber10的

    wget http://ambermd.org/bugfixes/AmberTools/1.2/bugfix.all -o bugfix.all_at_1.2
    patch -p0 -N <bugfix.all_at_1.2


    上面是AmberTools 1.2的

    2 编译AmberTools 1.2

    2.1 编译
    执行configure_at以配置Makefile_at

    ./configure_at gcc

    输出大概是(括号中的汉字是我的注释):
    ----------------------------------------------------------------
    Setting AMBERHOME to /home/liuzp/src/amber10


    Testing the C compiler:
    gcc  -march=pentium4 -m32 -o testp testp.c
    OK

    Obtaining the C++ compiler version:
    g++ -v
    The version is ../src/configure
    4.4.1
    [: 520: -lt: unexpected operator       (这个貌似有错误,其实没关系
    OK

    Testing the g77 compiler:
    g77 -O2 -fno-automatic -finit-local-zero -o testp testp.f
    ./configure_at: 538: g77: not found
    ./configure_at: 539: ./testp: not found
    Unable to compile a Fortran program using g77 -O2 -fno-automatic -finit-local-zero
    因为Ubuntu 9.10 中没有为f77建立链接g77,不过没关系,它会用下面的gfortran

    Testing the gfortran compiler:
    gfortran -O1 -fno-automatic -o testp testp.f
    OK

    Testing flex:
    OK

    Configuring netcdf; (may be time-consuming)

    NETCDF configure succeeded.

    The configuration file, config.h, was successfully created.

    The next step is to type 'make -f Makefile_at'

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

    照上面说的:
    make -f Makefile_at  |& tee make.at.log    # 屏幕输出的同时还输出到.log文件便于检查
    就开始编译喽,过程中可能会出现一个错误:
    ----------------------------------------------------------------
    g++ -c -O2 -Wall -W -D_REENTRANT  -Ihttp://www.cnblogs.com/freelib -Ihttp://www.cnblogs.com/freelib -o  fortran.o   fortran.cpp
    fortran.cpp: In function ‘void mort::write_ivalue(std::ostream&, const std::string&, const boost::any&)’:
    fortran.cpp:19: error: ‘sprintf’ was not declared in this scope
    fortran.cpp: In function ‘void mort::write_dvalue(std::ostream&, const std::string&, const boost::any&)’:
    fortran.cpp:36: error: ‘sprintf’ was not declared in this scope
    fortran.cpp: In function ‘void mort::write_svalue(std::ostream&, const std::string&, const boost::any&)’:
    fortran.cpp:52: error: ‘sprintf’ was not declared in this scope
    fortran.cpp: In member function ‘void mort::format::write(std::ostream&) const’:
    fortran.cpp:133: warning: comparison between signed and unsigned integer expressions
    fortran.cpp:138: warning: comparison between signed and unsigned integer expressions
    fortran.cpp:145: warning: comparison between signed and unsigned integer expressions
    fortran.cpp:153: warning: comparison between signed and unsigned integer expressions
    make: *** [fortran.o] 错误 1

    ----------------------------------------------------------------
    Google后发现这可能是gcc4.4.1检查语句较严所造成,这个帖子里Mark Williamson给出一个解决办法:

    修改文件/src/gleap/mortsrc/common/fortran.cpp,在头上加入

    #include <cstdio>

    再次编译就可以通过了

    2.2 测试
    测试的目的是看Amber的计算结果是否受硬件/软件环境和编译器等的影响,方法很简单,计算一些例子同amber提供的“标准结果”比较,如果结果差异不大就算通过。至于计算哪些项目,amber已经全安排好了,就在test目录下的Makefile_at里

    测试之前要手动修改一个小bug
    即 $AMBERHOME/bin/ 下 mopac.sh 中的一行:
    <...>/amber10/bin/mopac >& FOR006
    将 & 删除即可

    再进入test目录,
    cd $AMBERHOME/test
    make -f Makefile_at test & tee testat.log 


    就会运行一系列任务,如测试成功(计算结果与源码包中的一致)屏幕会显示“PASSED”,象这样:

    ==============================================================
    Running test to ........
    diffing XXXX.save with XXXX
    PASSED

    ==============================================================

    如果出现错误,会提前终止测试,比如:

    cd antechamber/tp && ./Run.tp
    ./Run.tp:  Program error
    make: *** [test.antechamber.hasG77] 错误 1


    这种情况要进入相应目录,查看Run.XXX文件,直接在命令行一步步执行,通过输出结果找出出错原因。

    如果输出中有“FAILED"字样,也不用着急,多数情况计算结果出入不大,这时AMBER有形如下面的提示:

    FAILED (OK if gyration radius is about 7 or 8)

    即如果你计算的结果在7和8之间都算正常

    测试结束后在test目录下可能会多出一个 TEST_FAILURES.diff 文件,AMBER认为这些结果可能不对(possible FAILURE),不过似乎基本上出入很小,因为AMBER仅用dacdiff进行结果比较,无法分辨由于舍入误差引起的不同。
    如果差异很明显,则需要了解该测试的具体功能,看是否真正出了问题。

    可以用grep命令查看“出错”的情况:
    grep FAIL  testat.log
    这时我机器的结果:
       FAILED (OK if gyration radius is about 7 or 8)
    FAILED (probably OK if energy is -115 to -125)
    possible FAILURE:  check tp.mol2.dif
    possible FAILURE:  check DGN.mol2.dif

    打开生成的TEST_FAILURES.diff文件检查,发现这些计算结果是正常的。

    3 编译串行版(serial)Amber10

    3.1 编译
    和上面类似,在src目录下先执行
    ./configure_amber gfortran
    其中gfortran可以是其他fortran编译器,可用--help查看。c编译器应该和前面AmberTools用的一样,这里是gcc
    再编译串行即单CPU版:
    make serial |& tee make.serial.amber.log

    3.2 测试
    cd ../test
    make test |& tee testamber.log

    grep FAIL testamber.log 

    possible FAILURE:  check gcg.dip.o.dif
    possible FAILURE:  check mdout.jar.dif
    possible FAILURE:  check first.pdb.dif
    possible FAILURE:  check first.pdb.dif


    打开生成的TEST_FAILURES.diff文件检查,上述四个结果也没有错误,其中第二个(mdout.jar.dif)结果为:
    ---------------------------------------
    possible FAILURE:  check mdout.jar.dif
    test/jar
    87c87
    < R1 = -85.000 R2 =  15.000 R3 =  15.000 R4 = 115.000 RK2 =5000.000 RK3 = 5000.000
    ---
    > R1 =   0. R2 =  15.000 R3 =  15.000 R4 = 115.000 RK2 =5000.000 RK3 = 5000.000

    ---------------------------------------
    貌似R1有问题,其实未必,可参考这里

    根据提示继续测试:
    make test.serial.QMMM |& tee testamber.QMMM.log
    ---------------------------------------
    possible FAILURE:  check nma_md.out.dif
    test/qmmm2/pure_QM_MD_shake
    160c160
    <  Etot   =       -33.476  EKtot   =         7.896  EPtot      =       -41.372
    ---
    >  Etot   =       -33.476  EKtot   =         7.896  EPtot      =       -41.373
    164c164
    <  PM3ESCF=       -41.372
    ---
    >  PM3ESCF=       -41.373

    ---------------------------------------
    结果也没问题,至此串行版AMBER安装完成。

  • 相关阅读:
    UVa 12174 (滑动窗口) Shuffle
    UVa 1607 (二分) Gates
    CodeForces ZeptoLab Code Rush 2015
    HDU 1525 (博弈) Euclid's Game
    HDU 2147 (博弈) kiki's game
    UVa 11093 Just Finish it up
    UVa 10954 (Huffman 优先队列) Add All
    CodeForces Round #298 Div.2
    UVa 12627 (递归 计数 找规律) Erratic Expansion
    UVa 714 (二分) Copying Books
  • 原文地址:https://www.cnblogs.com/greencolor/p/1861926.html
Copyright © 2011-2022 走看看