共价模型单种自旋的电子组态的索引方法
来源:互联网 发布:周末网络国债理财机构 编辑:程序博客网 时间:2024/05/16 16:17
此方法来自武剑的论文,见 Jian Wu and Yuansheng Jiang, J. Comp. Chem. 2000, 21, 856.
此处的main函数只是用于测试算法是否正确,此算法最后会作为另一个程序的子函数。
/* luozhen, 2015-05-20*///Available only for Sz = 0#include <iostream>#include <vector>#include <bitset>using namespace std;//define the total number of atomsconst int atoms = 6;//combinatorial number calculation//compiled to 64bit binary, the maxinum number under handle is C(32,16)int _combinatorial(int n, int k){if(k > n)return 0;if(k > n/2)k = n - k;if(k == 1) {return n;} else if(k == 0) {return 1;} else {return _combinatorial(n-1, k-1) + _combinatorial(n-1, k);}}//Applied to Alpha electronsint GetAlphaIndex(bitset<atoms> _wave){vector<int> alpha_site;alpha_site.push_back(0);for(int ix = 0; ix != atoms; ++ ix) {if(_wave[ix]) {alpha_site.push_back(ix+1);}}int index = 1;for(int i = 1; i != atoms/2+1; ++ i) {if(alpha_site[i] - alpha_site[i-1] > 1) {for(int j = 1; j != alpha_site[i] - alpha_site[i-1]; ++ j) {index += _combinatorial(atoms - alpha_site[i-1] -j, atoms/2 - i);}}}return index;}//to check whether the code is rightint main(){bitset<atoms> iwave;iwave.reset();int site1, site2, site3;cout<<"Enter site1, site2 and site3 (1 <= site_i <= "<<atoms<<"):"<<endl;cin>>site1>>site2>>site3;iwave.set(site1-1);iwave.set(site2-1);iwave.set(site3-1);int temp = GetAlphaIndex(iwave);cout<<"config: "<<site1<<site2<<site3<<"\tbitset: "<<iwave<<"\tindex: "<<GetAlphaIndex(iwave)<<endl;return 0;}
0 0
- 共价模型单种自旋的电子组态的索引方法
- 简单的组态软件模型探讨
- 几种组态软件的比较
- 组态控制的学习
- LPC2138的引脚组态
- HL7 电子病历系统的功能模型
- 【VB.NET2010】自旋在单线程上的应用
- 自旋锁在单处理器环境是无效的理解
- 组态软件的一些资源
- C#开发的组态软件
- 关于组态王的心酸:
- Java实现快递查询预计电子面单的实现
- 可以打印快递电子面单的表格
- 自旋锁公平性的三种实现
- 常见的电子电路板维修检测方法
- 电子签名的c#实现方法
- word转换pdf电子文档的方法
- 初学电子快速入门的方法
- ANT发布SVN WEB项目到TOMCAT以及利用post-commit自动提交编译更新
- 555555555555555555555555
- 微信高级群发接口,微信自定义菜单,微信支付-微信公众平台开发
- android第三方应用跳转到QQ并指定QQ号聊天
- 【C++注意事项】1 数据类型及类型转换
- 共价模型单种自旋的电子组态的索引方法
- Java中jre和jdk的区别
- what is the difference between _source and _all in Elasticsearch
- 纯代码 适配 iPhone 6 (+)
- JAVA枚举类型
- java POI实现向Excel中插入图片
- 无意间看到一个留学生大牛的Open IMS Core战略思想-------太牛叉了!!!!------致敬
- Android View 事件分发机制 源码解析
- 磁盘满导致mysql死锁