Aspects of the alloy app and scripts

本文档介绍了合金应用程序的程序设计,包括在构造函数和头文件中添加成员变量,输入命令的定制,错误消息的详细性,以及site_energy、event和propensity等关键方法的实现。在scripts和dump文件部分,讨论了dump命令的使用和ovito的配置。
摘要由CSDN通过智能技术生成

1. Program

  1. 我在constructor和header file加了member variables (原本app_diffusion是有的 )
//app_alloy.cpp
//1. Delete all things about Shweobel Hop
  // statistics
  ndeposit = ndep_failed = 0;
  nhop = 0;
//app_alloy.cpp
int ndeposit, ndep_failed, nhop;
double **Q;
double **hbarrier
int particleid //a global variable
  1. 大部分的array还需要一个alloc method,注意在deconstructor里也加上新的allocated memory
//cpp line 704 allocate_data()
// creat() alloc memory for 2D arrays, they NEED to be initialized!
  memory->create(firstevent,nlocal,"app:firstevent");
  memory->create(hbarrier,maxneigh+1,maxneigh+1,"app:hbarrier");
  for (int i = 0; i <= maxneigh; i++)
    for (int j = 0; j <= maxneigh; j++)
      hbarrier[i][j]  = 0.0;
      
  memory->create(Q, 128, 128, "app:Q");
  for (int i = 0; i < 128; i++)
    for (int j = 0; j < 128; j++)
      Q[i][j] = 0.0;
      
  hopsite = new int[maxneigh*maxneigh + maxneigh];
  
//cpp line 27 Alloy constructor for other initializations
//pointers are all instantiated as nullptr, in C style NULL  
  ninteger = 2; ndouble = 0;
  delpropensity = 3; delevent = 1;
  allow_kmc = 1;
  create_arrays();
  maxevent = 0;
  events = NULL; firstevent = NULL;
  Q = NULL;
  particleid = 0;
  hbarrier = NULL;
  //ecoord = NULL;
  hopsite = NULL;
  
//cpp line 73 AppAlloy::~AppAlloy() deconstructor
  memory->sfree(events);
  memory->destroy(firstevent);
  //delete Q, Q[128][128]
  memory->destroy(Q);
  memory->destroy(hbarrier);
  //delete [] ecoord;
  delete [] hopsite;

3.在 input_app() 可以添加和修改command, 比如说deposition里加了一个particleid, 注意这个是global variable, 需要在header file 里面declare. 有点类似于C0 virtual machine,可以定制command。

  if (strcmp(command,"deposition") == 0) {
   
    if (narg < 1) error->all(FLERR,"Illegal deposition command");
    if (strcmp(arg[0],
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值