xiaoqiugood的个人博客分享 http://blog.sciencenet.cn/u/xiaoqiugood

博文

再谈USPEX

已有 19107 次阅读 2014-10-19 21:57 |个人分类:物质结构及其预测|系统分类:科研笔记

关注:

1)对缺乏实验数据对比的、有争议的体系,有必要采用不同的预测方法预测,对比结果

2)USPEX工作流程

 

1. 参数准备:

建立需预测结构目录,拷贝USPEX脚步进入该目录,在USPEX文件夹下

(1) 进入Specific/   设定INCAR1-5

(2)  进入USPEX目录,编辑:INPUT,设定体系组成,包含的分子数(如6 18 for M6H18),体积(与M6H18对应的体积),键长(参考汉典元素周期表中的共价键),化合价(参考汉典元素周期表中的氧化态)等参数,无需特别指明VASP路径,程序会通过locate.m脚步定位可执行的VASP程序



(3)  进入USPEX/seeds/下,输入初始猜测的POSCAR,并命名为POSCARS,cp POSCARS seed



注意:各文件夹下的可执行文件,应chmod +x 变成实际可执行的文件

 

 

2. 提交:

 matlab <USPEX.m> log &

/opt/matlab2013/bin/matlab  <USPEX.m> log &


或为保证程序周期性执行,修改并执行下述脚本,通过该脚本提交,  如,nohup ./run-uspex.sh,其中run-uspex.sh内容如下:


cat  uspex_Sc-H
#!/bin/sh
while true;do
       date > log
       /opt/matlab2013/bin/matlab  < USPEX.m >>log
       sleep 60  【估计每个优化任务运行时间,可通过延长sleep时间如600s,来延缓队列中提交的任务数量的增加速度】
done


 


3. 看结果:

进入results文件夹/  vi goodstructures    找到对应的低焓结构  goodstructue_POSCAR



4. 重新提交及杀掉任务


(1) 每次重新提交,最好:

rm -rf results*    、

./clean_tough(清除CalcFold*文件夹)   、

cp Seeds/seed Seeds/POSCARS

(2) 改变VASP优化计算用CPU核的数目,需同时修改INPUT.TXT、submitJob_local.m、及SubmissionsubmitJob_local.m下的CPU数目

(3)如需 杀掉命令,则

ps aux |  grep uspex
yexq     23255  0.0  0.0 106092  1212 pts/1    S    04:51   0:00 /bin/sh ./uspex_Sc-H
yexq     31252  0.0  0.0 103244   876 pts/8    S+   05:15   0:00 grep uspex



kill 23255


对于在队列中已产生的大量任务,可通过脚本清除:

cat del-uspex.sh
#!/bin/sh
for((i=50747;i<50767;i++))
do
  qdel $i
done


% i为Job ID.







5.   探索:

1) matlab <USPEX.m> log &   产生结构后,自动生成 提交 结构优化任务的vasp的脚本

    vi results1/OUTPUT.txt

......  

*  There are  5 local relaxation steps for each individual structures *
Step  Abinitio Code                  Execute Command            K-resolution
 1      VASP                                       vasp         0.160
 2      VASP                                       vasp         0.120
 3      VASP                                       vasp         0.100
 4      VASP                                       vasp         0.080
 5      VASP                                       vasp         0.060

The script for job submission is prepared seperately in Submission/*_local.m
  5 parallel calculations are performed simutaneously



2)解读  Submission/*_local.m    





function doneOr = checkStatus_local(jobID)
%--------------------------------------------------------------------
%This routine is to check if the submitted job is done or not
%One needs to do a little edit based on your own case.
%1   : whichCluster (0: no-job-script, 1: local submission, 2: remote submission)

【在INPUT.TXT文件中已经指定】
%--------------------------------------------------------------------

%Step1: the command to check job by ID.
   [a,b] = unix(['qstat ' jobID ''])

%Step2: to find the keywords from screen message to determine if the job is done
%Below is just a sample:
%-------------------------------------------------------------------------------
%Job id                    Name             User            Time Use S Queue
%------------------------- ---------------- --------------- -------- - -----
%2455453.nano              USPEX            qzhu            02:28:42 R cfn_gen04
%-------------------------------------------------------------------------------
%If the job is still running, it will show as above.

%If there is no key words like 'R/Q Cfn_gen04', it indicates the job is done.
   if isempty(findstr(b,'R low')) & isempty(findstr(b,'Q low'))
      doneOr = 1
      unix('rm USPEX*');    % to remove the log file
   else
      doneOr = 0;
   end
function jobNumber = submitJob_local()
%-------------------------------------------------------------
%This routine is to check if the submitted job is done or not
%One needs to do a little edit based on your own case.

1   : whichCluster (default 0, 1: local submission, 2: remote submission)
%-------------------------------------------------------------

%Step 1: to prepare the job script which is required by your supercomputer
fp = fopen('run.sh', 'w');    
fprintf(fp, '#!/bin/sh\n');
fprintf(fp, '#PBS -l nodes=1:ppn=6,walltime=2:00:00\n');
fprintf(fp, '#PBS -N USPEX\n');
fprintf(fp, '#PBS -j oe\n');
%fprintf(fp, '#PBS -V \n');


fprintf(fp, '#PBS -q dell\n');  【自己服务器上的队列名称】
%fprintf(fp, '#PBS -V \n');
fprintf(fp, '#PBS -S /bin/bash\n');


fprintf(fp, 'cd $PBS_O_WORKDIR\n');
fprintf(fp,'mpirun  -np 8 vasp  > vasp.out\n');
fclose(fp);

%Step 2: to submit the job with the command like qsub, bsub, llsubmit, .etc.
%It will output some message on the screen like '2350873.nano.cfn.bnl.local'
[a,b]=unix(['qsub run.sh'])


%Step 3: to get the jobID from the screen message
end_marker = findstr(b,'.');
jobNumber = b(1:end_marker(1)-1);  



3) 解读:USPEX.m文件


cat   USPEX.m



try
unix('chmod +x getStuff');
unix('chmod +x getFromTo');
unix('chmod +x FunctionFolder/USPEX/getStuff');
unix('chmod +x FunctionFolder/USPEX/getFromTo');
unix('chmod +x Specific/getStuff');
unix('chmod +x Specific/getFromTo');
unix('chmod +x FunctionFolder/spacegroup_init/random_2d');
unix('chmod +x FunctionFolder/spacegroup_init/random_cell');
unix('chmod +x FunctionFolder/spacegroup_init/random_cell_mol');
unix('chmod +x FunctionFolder/spacegroup_stokes/findsym_new');
catch
end



[nothing, whichCode] = unix(['./getStuff INPUT.txt calculationMethod 1']);


if isempty(whichCode)
whichCode = 'USPEX';
else
whichCode(end) = [];
end


if strcmpi(whichCode, 'USPEX')
ev_alg();
elseif strcmpi(whichCode, 'VCNEB')
vcNEB();
elseif strcmpi(whichCode, 'META')
metasoft();
end


4)  解读./getStuff


#!/usr/bin/perl

$file   = shift;
$string = shift;
$column = shift;

unless(defined($column)) {
       print "usage : <file> <string> <column>\n";
       exit;
}

open(FILE, $file) or die "Can't open $file : $!\n";

while(<FILE>) {
       if(/$string/) {
       @a = split /\s+/;
               print $a[$column-1] . "\n";
       }
}


5)解读INPUT.txt



PARAMETERS EVOLUTIONARY ALGORITHM

******************************************
******************************************
*      TYPE OF RUN AND SYSTEM            *
******************************************
******************************************
USPEX : calculationMethod (USPEX, VCNEB, META)


300   : calculationType (dimension: 0-3; molecule: 0/1; varcomp: 0/1)  【变胞取1,如取301后,接下来如何处理?】
1     : optType (1=enthalpy, 2=volume, 3=hardness, 4=struc_order, 5=aver_dist)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% What symmetry(s) have to be satisfied by the randomly created structures
% symmetries
2-230
% endSymmetries

% numbers of specices (ions/molecules/blocks) of each type
% numSpecices
6 18
% EndNumSpecices
%%%%%%%%%%%%%%%%%%%%
% Here come the atomic numbers of the atoms involved
% atomType
Sc H
% EndAtomType
%%%%%%%%%%%%%%%%%%%%
% valences【是赝势的价电子数目吗?No,指汉典元素周期表中对应的氧化态。如何改变氧化态?同时具有+2,+3价的元素如何处理?】
3 1
% endValences

******************************************
*               POPULATION               *
******************************************
30    : populationSize (how many individuals per generation)
100   : initialPopSize
30    : numGenerations (how many generations shall be calculated)
25    : stopCrit

******************************************
%       FIRST VAR. COMP. GENERATION      *
******************************************
20    : firstGeneMax (how many different compositions for first generation)
8     : minAt (minimum amount of atoms/cell for first generation)
16    : maxAt (maximum amount of atoms/cell for first generation)  【可能需根据实际情况指定?】

【USPEX中如何实现变胞?8,16表达了什么含义?】

******************************************
*  SURVIVAL OF THE FITTEST AND SELECTION *
******************************************
0     : reoptOld
0.6   : bestFrac

******************************************
******************************************
*          VARIATION OPERATORS           *
******************************************
******************************************
0.50  : fracGene (fraction of generation produced by heredity)
0.20  : fracRand (fraction of generation produced randomly from space groups)
0.20  : fracAtomsMut (fraction of the generation produced by softmutation)
0.10  : fracTrans (fraction of the generation produced by transmutations)

****************************************
*             CONSTRAINTS              *
****************************************
1.5   : minVectorLength ( minimal length of any lattice vector)
%%%%%%%%%%%%%%%%
% IonDistances
1.44  088

0.0 0.32
% EndDistances

%  汉典元素周期表中的共价键长:http://www.zdic.net/appendix/f7.htm


或参考

http://www.webelements.com/plutonium/atom_sizes.html

 

 


%%%%%%%%%%%%%%%%

*****************************************
*                 CELL                  *
*****************************************
% The following is what you know about the lattice. If you know the lattice
% vectors, type them in as 3x3 matrix. If not, type the estimated volume.
% For variable composition - type the estimated atomic volume for each element.
% Latticevalues (this word MUST stay here, type values below)
177
% Endvalues (this word MUST stay here)

%日本NIMS数据库:http://crystdb.nims.go.jp/crystdb/search-materials

找到对应物质的模型结构,下载cif 文件,通过VESTA看体积数据


*****************************************
*   DETAILS OF AB INITIO CALCULATIONS   *
*****************************************
% supported:  1-vasp, 2-siesta, 3-gulp, 4-LAMMPS, 5-NeuralNetworks
% 6-dmacrys, 7-cp2k, 8-QuantumEspresso, 9-ASE, 10-ATK, 11-CASTEP
abinitioCode (which code from CommandExecutable shall be used for calculation? )
1 1 1 1 1
ENDabinit

%Resolution for KPOINTS - one number per step or just one number in total)
% KresolStart
0.16 0.12 0.10 0.08 0.06
%  Kresolend

% commandExecutable
vasp

% mpiexec -n 8 -machinefile .nodelists vasp > out.vasp

mpiexec  -np 8 vasp >log


% EndExecutable

5     : numParallelCalcs (how many parallel calculations shall be performed)
1     : whichCluster (0: no-job-script, 1: local submission, 2: remote)  

  【matlab语法,‘:’的作用】
submission)
0.010 : toleranceFing (tolerance for identical structures)

*****************************************
*               RESTART                 *
*****************************************
0    : pickUpYN (if pickUpYN~=0 , then a previous calculation will be continued )
0    : pickUpGen (at which generation shall the previous calculation be picked up? If = 0 , then a new calculation is started)
0    : pickUpFolder (number of the results folder to be used. If = 0 , then the highest existing number is taken)


手册摘录解读:Specify the following varcomp-only options:

$.triangleright $variable  firstGeneMax 【变量  第一代产生的different compositions数量】

Meaning: How many different compositions 【怎样确保产生自己想要的组成?!】are sampled in the first generation. If 0, then the number is equal to initialPopSize/4. For binaries, we recommend firstGeneMax=11, for ternaries a higher value is needed, e.g. 30.

Default: 11

Format:

10 : firstGeneMax


$.triangleright $variable  minAt

Meaning: Minimum number of atoms (for calculationType=301/201/300) or molecules (for calculationType=311) in the unit cell for the first generation.

Default: No default

Format:

10 : minAt

$.triangleright $variable  maxAt

Meaning: Maximum number of atoms (for calculationType=301/201/300 or in META calculations) or molecules (for calculationType=311) in the unit cell for the first generation.

Default: No default   【没有默认值,需自己指定】

Format:

20 : maxAt


根据自己服务器提交VASP任务脚本修改的submitJob_local.m文件


function jobNumber = submitJob_local()
%-------------------------------------------------------------
%This routine is to check if the submitted job is complete or not
%One needs to do a little edit based on your own situation.
%1   : whichCluster (default 0, 1: local submission, 2: remote submission)
%-------------------------------------------------------------

%Step 1: to prepare the job script that is required by your supercomputer
fp = fopen('myrun', 'w');    
fprintf(fp, '#!/bin/sh\n');
fprintf(fp, '#PBS -l nodes=1:ppn=8,walltime=1:30:00 -q cfn_short\n');
fprintf(fp, '#PBS -N USPEX\n');
fprintf(fp, '#PBS -j oe\n');
fprintf(fp, '#PBS -V \n');
fprintf(fp, '#PBS -q dell \n');
fprintf(fp,'#PBS -S /bin/bash \n');

fprintf(fp, 'cd ${PBS_O_WORKDIR}\n');
fprintf(fp, 'mpiexec -np 8 vasp > vasp.out\n');
fclose(fp);

%Step 2: to submit the job with a command like qsub, bsub, llsubmit, etc.

[a,b]=unix(['qsub myrun'])

%Step 3: to get the jobID from the screen message
%It will output some message on the screen like '2350873.nano.cfn.bnl.local'

end_marker = findstr(b,'.');
jobNumber = b(1:end_marker(1)-1);


为保证程序周期性执行,修改并执行下述脚本,nohup ./run-uspex.sh  &  :


cat run-uspex.sh
#!/bin/sh
while true
do
  date >> log
  /opt/matlab2013/bin/matlab  < USPEX.m >>log
  sleep 300
done



USPEX问答:

 最近在使用USPEX遇到以下两个问题,期盼您的解答:

   1) 怎样限制USPEX提交的任务数量,即始终保持只有五个任务在队列中排队或运算,而不是像下述情形一样,有上百个任务在队列中:

     50375.mu01  yexq dell     vasp    12    --  7200: R 47:25
50443.mu01  yexq dell     USPEX    8    --  01:30 Q   --
50444.mu01  yexq dell     USPEX    8    --  01:30 Q   --
50445.mu01  yexq dell     USPEX    8    --  01:30 Q   --
50446.mu01  yexq dell     USPEX    8    --  01:30 Q   --
50447.mu01  yexq dell     USPEX    8    --  01:30 Q   --
50448.mu01  yexq dell     USPEX    8    --  01:30 Q   --
50449.mu01  yexq dell     USPEX    8    --  01:30 Q   --
50450.mu01  yexq dell     USPEX    8    --  01:30 Q   --
50451.mu01  yexq dell     USPEX    8    --  01:30 Q   --
50452.mu01  yexq dell     USPEX    8    --  01:30 Q   --
50453.mu01  yexq dell     USPEX    8    --  01:30 Q   --

......

 


 

2)  IonDistances离子之间距离,感觉应该是共价半径的加和,不知对否?




Answer  from  Lirong Han


(1)这个我还真不知到在哪里设置,我用的都是已经写好的脚本,您可以查一下手册,上面应该有写。

(2) 一般设置为离子半径的平均值,实际只要在差不多的范围内就没有关系



From  Xing Wang


#!/bin/sh
#PBS -l nodes=1:ppn=12
#PBS -N UZr2_phonon
#PBS -j oe

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/software/compiler/mkl/lib/em64t
cd $PBS_O_WORKDIR

NPROCS=`wc -l < $PBS_NODEFILE`
echo This job has allocated $NPROCS nodes

echo The root node is
uname -n

master=`hostname | cut -f 1 -d '.'`
node_list=`cat $PBS_NODEFILE`
##cat $PBS_NODEFILE | awk '{ print $1"-clust" }' > ./hostfile
cat $PBS_NODEFILE | awk '{ print $1" slots=12" }' > ./hostfile

/home/software/mpi/openmpi1.4.3-intel/bin/mpirun  -np $NPROCS -hostfile ./hostfile /home/software/vasp/vasp.5.2.2/vasp >&vasp.log
rm hostfile vasp.log  EIGENVAL DOSCAR  IBZKPT WAVECAR CHG CHGCAR XDATCAR PCDAT




Thanks to QiangZhu and XInyue CHen

   1) 怎样限制USPEX提交的任务数量,即始终保持只有五个任务在队列中排队或运算,而不是像下述情形一样,有上百个任务在队列中:

关键就是你要修改 checkStatus_local.m, 里面把确定作业状态的关键词放进去 (Queue, Exit, Run)
你大概修改如下
%Step1: the command to check job by ID.     [a,b] = unix(['qstat ' jobID ''])
如果你用qstat查命令就不用修改
%Step2: to find the keywords from the screen message to determine if the job is complete%Below is just a sample:%-------------------------------------------------------------------------------%Job id                    Name             User            Time Use S Queue%------------------------- ---------------- --------------- -------- - ---------%2455453.nano              USPEX            qzhu            02:28:42 R cfn_gen04%-------------------------------------------------------------------------------
   if isempty(findstr(b,'R cfn_')) & isempty(findstr(b,'Q cfn_'))  
这里我找的是如果改作业状态不是在(Run)后者(Queue),就认为作业结束, 你需要对关键词修改即可

50375.mu01  yexq dell     vasp    12    --  7200: R 47:25
50443.mu01  yexq dell     USPEX    8    --  01:30 Q   --
50444.mu01  yexq dell     USPEX    8    --  01:30 Q   --
50445.mu01  yexq dell     USPEX    8    --  01:30 Q   --
50446.mu01  yexq dell     USPEX    8    --  01:30 Q   --
50447.mu01  yexq dell     USPEX    8    --  01:30 Q   --
50448.mu01  yexq dell     USPEX    8    --  01:30 Q   --
50449.mu01  yexq dell     USPEX    8    --  01:30 Q   --
50450.mu01  yexq dell     USPEX    8    --  01:30 Q   --
50451.mu01  yexq dell     USPEX    8    --  01:30 Q   --
50452.mu01  yexq dell     USPEX    8    --  01:30 Q   --
50453.mu01  yexq dell     USPEX    8    --  01:30 Q   --

......

(程xy博士:这个好像要修改提交的脚本,具体哪个跟每个超级机有关...
你需要修改uspex根目录下的submission里面的相关文件
这个比较复杂,最好问问ZhuQ博士)

2)  IonDistances离子之间距离,感觉应该是共价半径的加和,不知对否?
(程xy博士:是共价半径的0.8倍,估计值)  

0.6-0.8倍的区间都可以




USPEX目录下的文件及文件夹:

ls
AntiSeeds        Current_POP.mat  getStuff    multiple_runs  results1      Submission         USPEX.m
clean            ev_alg.m         INPUT.txt   nohup.out      run-uspex.sh  submitJob_local.m  uspex_MoSi2
clean_tough      FunctionFolder   log         out.uspex      Seeds         submit.sh
Current_ORG.mat  getFromTo        metasoft.m  out.uspex2     Specific      test

运行后产生Cal*等文件夹。


变胞方法: 参考uspex手册






   






https://blog.sciencenet.cn/blog-567091-837003.html

上一篇:bader电荷分析再谈
下一篇:声子谱虚频的另类情况及如何提高声子计算速度
收藏 IP: 139.205.190.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (1 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-11-24 22:54

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部