📄 perm.cpp
字号:
// Perm.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "Perm.h"
#include "ProteinSeq.h"
#include <VECTOR>
#include "Simulation.h"
#include "GlobePar.h"
#include "UseXML.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// The one and only application object
CWinApp theApp;
using namespace std;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
}
else
{
//initial the random
srand((int)time(0));
rand();
// TODO: code your application's behavior here.
UseXML usexml;
usexml.readXML(argv[1]);
ProteinSeq protein( GlobePar::sequence, GlobePar::bestEnergy );
GlobePar parameter(3);
Simulation simulation( protein, parameter);
if( usexml.isInited == false ){
simulation.initialization();
}
else{
parameter.averageOfWei = usexml.averageOfWei;
for(int j=0; j<GlobePar.length; j++)
parameter.numberOfLen.push_back(1);
}
for(int i=0; i<GlobePar.round; i++){
simulation.run();
parameter.resetNumber();
}
usexml.outputXML(argv[2], parameter, simulation);
/*
CString strHello;
strHello.LoadString(IDS_HELLO);
CString string;
string = "H12(PH)2(P2H2)2P2HP2H2PPH2P2HP2(H2P2)2(HP)2H12";
ProteinSeq test(string, 55);
cout << (LPCTSTR)strHello<< endl;
cout <<test.getLength()<< endl;
cout <<test.getRecentEnergy()<< endl;
cout <<(LPCTSTR)test.getSequence() << endl;*/
//CString string("hphpphhphpphphhpphph");
/*
CString string("HHHHHHHHHHHHHHHHHHHHH");
ProteinSeq protein(string, 48);
#ifdef MYDEBUG
cout<<(LPCTSTR)protein.getSequence()<<endl;
#endif
GlobePar parameter(3);
Simulation simulation(protein, parameter);
simulation.initialization();
int tempEnergy = simulation.bestRecoder;
int initialization =tempEnergy;*/
// CString string("HHHHHHHHHHHHPHPHPPHHPPHHPPHPPHHPPHHPPHPPHHPPHHPPHPHPHHHHHHHHHHHH");
//CString string("HPPHPPHPHPPHP");
/* CString string("hphpphhphpphphhpphph");
ProteinSeq protein(string, 48);
#ifdef MYDEBUG
cout<<(LPCTSTR)protein.getSequence()<<endl;
#endif
GlobePar parameter(3);
Simulation simulation(protein, parameter);
simulation.initialization();
int tempEnergy = simulation.bestRecoder;
int initialization =tempEnergy;
for(int i=0; i<1; i++){
simulation.run();
parameter.resetNumber();
if(simulation.bestRecoder > tempEnergy){
tempEnergy = simulation.bestRecoder;
cout<<"Find a new structure and energy is"<<tempEnergy<<endl;
}
}
cout<<"The initial energy is: "<<initialization<<" The end energy is: "<<tempEnergy<<endl;
for(i=0; i< parameter.averageOfWei.size(); i++)
cout<<parameter.averageOfWei[i]<<endl;
for(i=0; i< simulation.bestResult.size(); i++)
cout<<simulation.bestResult[i].x<<" "
<<simulation.bestResult[i].y<<" "
<<simulation.bestResult[i].z<<endl;*/
}
return nRetCode;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -