资源简介
程序亮点
1. VASP使用PAW方法或超软赝势,因此基组尺寸非常小,描述体材料一般需要每原子不超过100个平面波,大多数情况下甚至每原子50个平面波就能得到可靠结果。
2. 在平面波程序中,某些部分代码的执行是三次标度。在VASP中,三次标度部分的前因子足可忽略,导致关于体系尺寸的高效标度。因此可以在实空间求解势的非局域贡献,并使正交化的次数最少。当体系具有大约2000个电子能带时,三次标度部分与其它部分可比,因此VASP可用于直到4000个价电子的体系。
3. VASP使用传统的自洽场循环计算电子基态。这一方案与数值方法组合会实现有效、稳定、快速的Kohn-Sham方程自洽求解方案。程序使用的迭代矩阵对角化方案(RMM-DISS和分块Davidson)可能是目前最快的方案。
4. VASP包含全功能的对称性代码,可以自动确定任意构型的对称性。
5. 对称性代码还用于设定Monkhorst-Pack特殊点,可以有效计算体材料和对称的团簇。Brillouin区的积分使用模糊方法或四面体方法。四面体方法可以用Blöchl校正去掉线性四面体方法的二次误差,实现更快的k点收敛速度。
代码片段和文件信息
/*
* Some functions callable from fortran to use shared memory
* wv 2011
* shmem stuff from Willem Vermin SARA
*/
#include
#include
#include
#include
#include
#include
/*
* get a shared memory segment
* input: size (fortran integer*8)
* output: shmem id
*/
void getshmem_(size_t *size int*id)
{
key_t key;
int shmflg;
int shmid;
key = IPC_PRIVATE;
shmflg = IPC_CREAT | IPC_EXCL | 0600 | SHM_NORESERVE ;
shmid = shmget(key *size shmflg);
if (shmid == -1)
{
fprintf(stderr“%s in %s: cannot create shared segment %ld \n“__FUNCTION____FILE__*size);
perror(0);
exit(1);
}
*id = shmid;
}
void getshmem_error_(size_t *size int*id)
{
key_t key;
int shmflg;
int shmid;
key = IPC_PRIVATE;
shmflg = IPC_CREAT | IPC_EXCL | 0600 | SHM_NORESERVE ;
shmid = shmget(key *size shmflg);
*id = shmid;
}
/*
* attach shared memory to a pointer
* input: shhmid: shared memory id
* output: address (fortran integer*8)
*/
void attachshmem_(int *shmid void **address)
{
void *shmaddr*r;
int shmflg;
shmflg = 0;
shmaddr = 0;
r = shmat(*shmid shmaddr shmflg);
if (r == (void*) -1)
{
fprintf(stderr“%s in %s: cannot get address of shared segment\n“__FUNCTION____FILE__);
perror(0);
exit(1);
}
*address = r;
}
/*
* detach shared memory from pointer
* input: address (fortran integer*8)
*/
void detachshmem_(void **address)
{
int r;
r = shmdt(*address);
if (r == -1)
{
fprintf(stderr“%s in %s:%d: cannot detach shared segment\n“__FUNCTION____FILE____LINE__);
perror(0);
exit(1);
}
}
/*
* destroy shared memory
* input: shmid: shared memory id
*/
void destroyshmem_(int *shmid)
{
struct shmid_ds buf;
int r = shmctl(*shmidIPC_RMID&buf);
if (r == -1)
{
fprintf(stderr“%s in %s:%d: cannot destroy shared segment\n“__FUNCTION____FILE____LINE__);
perror(0);
exit(1);
}
}
/*
* get a set of semaphores
* input: size
* output: semaphores id
*/
void getsem_(int *size int*id)
{
key_t key;
int semflg;
int semid;
int mysize;
int i rc;
short sarray[(*size)+1];
key = IPC_PRIVATE;
semflg = IPC_CREAT | IPC_EXCL | 0600;
semflg = IPC_CREAT | 0600;
mysize=(*size)+1 ;
/* here I have an odd problem: using *size+1 instead of mysize
sometimes failed
very odd some cross C-Fortran problem no idea */
semid = semget(key mysize semflg);
if (semid == -1)
{
perror(0);
fprintf(stderr“%s in %s: cannot create semaphores \n“__FUNCTION____FILE__);
fprintf(stderr“requested size was %d\n“ mysize);
exit(1);
}
/* ‘1‘ -- The shared memory segment is being used. */
/* ‘0‘ -- The shared memory segment is freed. */
/* the very first sempaphore can be used to loc all others
currently this is not entirely thread save and might fail if no barrier
is used before this lock since we do not
评论
共有 条评论