24小时热门版块排行榜    

查看: 2221  |  回复: 18
【奖励】 本帖被评价12次,作者jjf_sxnu增加金币 11
当前主题已经存档。

jjf_sxnu

铜虫 (正式写手)


[资源] 【分享】自已写的洛仑兹展宽的程序。可以从能级得到DOS,及做IR等

/*###############################################################################################################
#
# This program is written for Lorentz boarding by Jianfeng Jia( ShanXi Normail University) . It can
# be used for Freq. NMR. DOS and so on.
# Using it by:        Loz inputfile outputfile delta steplength
# Parameter:        inputfile give the isolated input data want to boarding line by line for
#                       For example:
#                             12.1
#                             13.5
#                             4.
#                             ........
#                      outputfile is the result give in X and Y sets, It can be imported to
#                         Orign to give a plot.
#                           delta is a boarding parameter for Lorentz.
#                      steplength is the step length of X in output file.  
#################################################################################################################*/
#include
#include
#include
#include
#include
#include
#include
#define PI 3.14159265
using namespace std;
main(int argc, char * argv[])
{          if(argc!=5)
        { cout<<"You must and only can provide two file. and then a delta and a steplength"<         exit (1);
        }
        ifstream inf(argv[1]);
        if(inf==NULL)
        {cout<<"Can not open file: "<         exit(1);
        }
        vector inputed_xvalues;
        string s_x;       
        double halfwidth=atof(argv[3]);
        while(!inf.eof())
        {
        inf>>s_x;
        if(!s_x.empty()) inputed_xvalues.push_back(atof(s_x.c_str()));
        }
        sort(inputed_xvalues.begin(),inputed_xvalues.end());
        double max_X=*max_element(inputed_xvalues.begin(),inputed_xvalues.end())+10*halfwidth;
        double min_X=*min_element(inputed_xvalues.begin(),inputed_xvalues.end())-10*halfwidth;
        map output_XX_YY;
        double xx=min_X;
        double step=atof(argv[4]);
        while(xx         {       
                double yy=0;
                vector::iterator iter;
                for(iter=inputed_xvalues.begin();iter!=inputed_xvalues.end();iter++)
                yy=yy+(halfwidth/PI)/((xx-*iter)*(xx-*iter)+halfwidth*halfwidth);
                output_XX_YY.insert(map::value_type(xx,yy));
                xx+=step;
        }
        ofstream of(argv[2]);
        map::iterator m_iter;
        for(m_iter=output_XX_YY.begin();m_iter!=output_XX_YY.end(); m_iter++)
        {       
                of<first<<"\t"<second<         }
}

[ Last edited by zeoliters on 2009-6-13 at 15:37 ]
回复此楼

» 收录本帖的淘帖专辑推荐

双咪唑

» 猜你喜欢

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
回帖支持 ( 显示支持度最高的前 50 名 )

erylingjet

铁杆木虫 (著名写手)


不过,怎么用呢?嘿嘿
5楼2009-03-12 18:13:50
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
普通回帖

gwdavid

木虫 (著名写手)


★★★★★ 五星级,优秀推荐

支持原创!
2楼2009-03-11 22:17:44
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

wgpig

木虫 (小有名气)


★★★★★ 五星级,优秀推荐

支持原创!
3楼2009-03-12 08:45:47
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

erylingjet

铁杆木虫 (著名写手)


★★★★★ 五星级,优秀推荐



不支持,自己都会后悔的
4楼2009-03-12 18:12:27
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

jjf_sxnu

铜虫 (正式写手)


引用回帖:
Originally posted by erylingjet at 2009-3-12 18:13:
不过,怎么用呢?嘿嘿

C++编译后产生可执行文件,如Loz

就用  Loz   inputfile  outputfile   delta   step

delta 是展宽系数,step 是生成数据在x轴上的变化值(一般可取0.001)

输入输出都是文本文件,输入文件中只提供一列数据, 如画DOS,就提供每个能级的数据。一个能级一行如:

-20.6
-17.8
-5.6
-0.004
0.03

等,输出文件直接导入Origin画图。
6楼2009-03-12 19:45:01
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

benjamming

木虫 (正式写手)


★★★ 三星级,支持鼓励

那做红外怎么用呢?
7楼2009-03-13 15:39:26
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

carlaty

金虫 (正式写手)


★★★★★ 五星级,优秀推荐

最近刚好在研究c++,源代码收藏,呵呵。感谢
8楼2009-03-13 17:02:52
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

★★★★★ 五星级,优秀推荐

非常强烈的支持
10楼2009-03-27 12:26:56
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

nyzhaoyin

新虫 (正式写手)


★★★ 三星级,支持鼓励

学习中  谢谢!
11楼2009-03-29 05:38:46
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

lei0736

荣誉版主 (职业作家)


★★★★★ 五星级,优秀推荐

鼓励原创
12楼2009-06-13 22:28:06
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

chuzhaonan

铁杆木虫 (著名写手)


学习中谢谢,请楼主讲一下红外用法
13楼2009-06-16 08:31:15
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

lerel12345

木虫 (职业作家)


支持原创!
15楼2009-07-21 17:56:33
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

jjf_sxnu

铜虫 (正式写手)


如下是画PDOS,很多朋友问红外的,其实与此类似,看一看,想一想就明白了,仅多乘了一个强度因子。
#include
#include
#include
#include
#include
#include
#include
#define PI 3.14159265
using namespace std;
main(int argc, char * argv[])
{          if(argc!=7)
        {
        exit (1);
        }
        ifstream inf(argv[1]);
        if(inf==NULL)
        //argv[1] is input filename;
        {cout<<"Can not open file: "<         exit(1);
        }
        vector > inputed_line;
        //argv[3] is detal for extention.
        double halfwidth=atof(argv[3]);
        while(!inf.eof())
        {        bool havedata=1;
                vector tmp;
                //argv[5] the number of colum of the inputfile.
                for(int i=0;i                 {        
                        string s_x;
                        inf>>s_x;
                        if(!s_x.empty()) tmp.push_back(atof(s_x.c_str()));
                        else {havedata=0; break;}
                }
                if(havedata) inputed_line.push_back(tmp);
        }
        for(int i=0;i                 {
                        for(int j=0;j.size();j++)
                                cout<[j]<<"\t";
                        cout<                 }
        double max_X=inputed_line[0][0];
        double min_X=inputed_line[0][0];
        for(int i=0;i         {
                if(inputed_line[0]>max_X) max_X=inputed_line[0];
                if(inputed_line[0][0];
        }
        //cout<         max_X+=10*halfwidth;
        min_X-=10*halfwidth;
        vector > out_line;
        double xx=min_X;
        //argv[4] is the step for x;
        double step=atof(argv[4]);
        while(xx         {       
               
                //vector::iterator iter;
                //for(iter=inputed_xvalues.begin();iter!=inputed_xvalues.end();iter++)
                vector tmp;
                tmp.push_back(xx);
                for(int j=1;j                 {
                        double yy=0.0;       
                        for(int i=0;i                         {        double tmp=0.0;
                                tmp=(halfwidth/PI);
        //                        cout<         //                        cout<[0]<         //                        cout<                                
                                double tmp2=(xx-inputed_line[0])*(xx-inputed_line[0])+halfwidth*halfwidth;
        //                        cout<                                 tmp=tmp/tmp2;
        //                        cout<                                 tmp=tmp*inputed_line[j];
        //                        cout<[j]<<"\t"<         //                        tmp=tmp*atoi(argv[6]);
        //                        cout<                                 yy+=tmp;
                        }
        //                cout<                         tmp.push_back(yy);
                }
                out_line.push_back(tmp);
                xx+=step;
        }
        ofstream of(argv[2]);
        for(int i=0;i         {
                for(int j=0;j.size();j++)
                        of<[j]<<"\t";
                of<         }

}
16楼2009-08-05 22:06:08
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

mingdong

荣誉版主 (知名作家)


★★★★★ 五星级,优秀推荐

非常谢谢了
17楼2009-10-15 10:14:46
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

study163

木虫 (正式写手)


★★★★★ 五星级,优秀推荐

严重支持原创贴
19楼2009-12-07 14:15:12
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
简单回复
fox-fox9楼
2009-03-13 23:18   回复  
 
dalongmao14楼
2009-07-14 16:26   回复  
 
2009-12-06 21:40   回复  
谢谢分享
相关版块跳转 我要订阅楼主 jjf_sxnu 的主题更新
☆ 无星级 ★ 一星级 ★★★ 三星级 ★★★★★ 五星级
普通表情 高级回复 (可上传附件)
信息提示
请填处理意见