本文整理汇总了C++中Mol类的典型用法代码示例。如果您正苦于以下问题:C++ Mol类的具体用法?C++ Mol怎么用?C++ Mol使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mol类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test7
void test7() {
string smi = "c1ccccc1C";
#if 1
Mol *m = SmilesToMol(smi);
Mol::AromaticAtomIterator atomIt;
Mol::AromaticAtomIterator beginP(m->beginAromaticAtoms());
Mol::AromaticAtomIterator endP(m->endAromaticAtoms());
unsigned int idx = 0;
for (atomIt = beginP; atomIt != endP; atomIt++) {
TEST_ASSERT((*atomIt)->getIdx() == idx);
idx++;
}
TEST_ASSERT(idx == 6);
atomIt = beginP;
atomIt++;
atomIt--;
TEST_ASSERT((*atomIt)->getIdx() == 0);
delete m;
smi = "Cc1ccccc1";
m = SmilesToMol(smi);
beginP = m->beginAromaticAtoms();
endP = m->endAromaticAtoms();
idx = 0;
for (atomIt = beginP; atomIt != endP; atomIt++) {
TEST_ASSERT((*atomIt)->getIdx() == idx + 1);
idx++;
}
TEST_ASSERT(idx == 6);
#endif
BOOST_LOG(rdInfoLog) << "test7 done" << endl;
}
示例2: UpdateShadowmap
void MyFrame::OnReadFile (wxString filename)
{
if (mol.ReadPdb((const char*)filename.mb_str(wxConvUTF8) )) {
if ((mol.natm==0) && (mol.nhetatm!=0)) geoSettings.showHetatm=true;
MyTab::EnableGeom();
UpdateShadowmap();
wxString name( mol.GetMolName(), wxConvUTF8 );
SetTitle( name.BeforeLast('.')+ _T(" - QuteMol") );
m_tb->SetTitleText(name);
geoSettings.Apply();
// redo shaders, as texture size could have changed
cgSettings.UpdateShaders();
} else {
wxMessageBox(wxString::FromAscii(QAtom::lastReadError), _T(":-("), wxOK | wxICON_EXCLAMATION, this);
m_tb->SetTitleText();
}
// remake shaders cos texture size could have changed...
//theText->LoadFile(openFileDialog->GetFilename());
//SetStatusText(GetCurrentFilename(), 0);
}
示例3: free_dyna
Mol *read_atomic_coordinates(const char *file)
{
long fpos;
float x, y, z;
int ord, natoms;
free_dyna();
if(find_string("Standard orientation")) {
do {
fpos = ftell(fp);
natoms = addTrajectoryStep();
} while(find_string("Standard orientation"));
}
else {
rewind(fp);
if(find_string("Z-Matrix orientation")) {
do {
fpos = ftell(fp);
natoms = addTrajectoryStep();
} while(find_string("Z-Matrix orientation"));
}
else {
rewind(fp);
if(find_string("Input orientation")) {
do {
fpos = ftell(fp);
natoms = addTrajectoryStep();
} while(find_string("Input orientation"));
}
}
}
Mol *mol = add_mol(file);
dynamics.molecule = mol;
dynamics.current = dynamics.ntotalsteps - 1;
fseek(fp, fpos, SEEK_SET);
if(!find_string("Coordinates (Angstroms)")) return 0;
if(!find_string("-----")) return 0;
fgets(line, 255, fp);
do {
if(flagG9803) {
if(sscanf(line, "%*d %d %*d %f %f %f", &ord, &x, &y, &z) != 4) return 0;
}
else {
if(sscanf(line, "%*d %d %f %f %f", &ord, &x, &y, &z) != 4) return 0;
}
if(ord >= 0) mol->AddNewAtom(ord, x, y, z);
fgets(line, 255, fp);
} while(!strstr(line, "------"));
return mol;
}
示例4: glFinish
AOgpu2::AOgpu2( Point3f dir, Mol &m, int ndir){
shadowmap.computeAsTexture(dir, true, shadowAOCanvas );
glFinish();
moltextureCanvas.SetAsOutput();
glDisable(GL_VERTEX_PROGRAM_ARB);
glEnable(GL_FRAGMENT_PROGRAM_ARB);
aogpu_settings.BindDrawAOShader();
for (int i=0; i<3; i++) {
glProgramEnvParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, i,
matSM[0][i],matSM[1][i],matSM[2][i],matSM[3][i]
);
//printf("Sending %d (%f %f %f %f)\n", i, mat[0][i],mat[1][i],mat[2][i],mat[3][i]);
}
glProgramEnvParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 3, dir[0],dir[1],dir[2], 4.0/ndir );
glProgramEnvParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 4,
0,stick_radius,0,0
);
m.DrawOnTexture();
glDisable(GL_BLEND);
glEnable(GL_VERTEX_PROGRAM_ARB);
};
示例5: test5
void test5() {
string smi = "CCCC";
Mol *m = SmilesToMol(smi);
Mol::BondIterator bondIt;
unsigned int idx = 0;
for (bondIt = m->beginBonds(); bondIt != m->endBonds(); bondIt++) {
CHECK_INVARIANT((*bondIt)->getIdx() == idx, "bad idx");
idx++;
}
CHECK_INVARIANT(idx == 3, "bad idx");
idx = 0;
for (bondIt = m->beginBonds(); bondIt != m->endBonds(); bondIt++) {
CHECK_INVARIANT((*bondIt)->getIdx() == idx, "bad idx");
idx++;
}
CHECK_INVARIANT(idx == 3, "bad idx");
idx = 0;
Mol::BondIterator beginP(m->beginBonds());
Mol::BondIterator endP(m->endBonds());
for (bondIt = beginP; bondIt != endP; bondIt++) {
CHECK_INVARIANT((*bondIt)->getIdx() == idx, "bad idx");
idx++;
}
CHECK_INVARIANT(idx == 3, "bad idx");
BOOST_LOG(rdInfoLog) << "test5 done" << endl;
}
示例6: test8
void test8() {
{
string smi = "CC1CC2CC1C2";
Mol *m = SmilesToMol(smi);
QueryAtom *q = new QueryAtom();
q->setQuery(makeAtomExplicitDegreeQuery(3));
q->expandQuery(makeAtomRingBondCountQuery(2));
unsigned int nSeen = 0;
for (Mol::QueryAtomIterator queryIt = m->beginQueryAtoms(q);
queryIt != m->endQueryAtoms(); ++queryIt) {
TEST_ASSERT((*queryIt)->getIdx() == 1);
nSeen++;
}
TEST_ASSERT(nSeen == 1);
delete m;
delete q;
}
BOOST_LOG(rdInfoLog) << "test8 done" << endl;
};
示例7: test3
void test3() {
string smi = "C1COCCNCOCNSCC1";
unsigned char heteros[] = {2, 5, 7, 9, 10};
Mol *m = SmilesToMol(smi);
{
unsigned int nSeen = 0;
for (Mol::HeteroatomIterator heteroIt = m->beginHeteros();
heteroIt != m->endHeteros(); heteroIt++) {
CHECK_INVARIANT((*heteroIt)->getIdx() == heteros[nSeen], "bad hetero");
nSeen++;
}
}
{
unsigned int nSeen = 0;
for (Mol::HeteroatomIterator heteroIt = m->beginHeteros();
heteroIt != m->endHeteros(); ++heteroIt) {
CHECK_INVARIANT((*heteroIt)->getIdx() == heteros[nSeen], "bad hetero");
nSeen++;
}
}
{
Mol::HeteroatomIterator heteroIt = m->beginHeteros();
heteroIt++;
heteroIt++;
heteroIt--;
CHECK_INVARIANT((*heteroIt)->getIdx() == heteros[1], "bad hetero");
CHECK_INVARIANT((*--heteroIt)->getIdx() == heteros[0], "bad hetero");
CHECK_INVARIANT((*heteroIt)->getIdx() == heteros[0], "bad hetero");
}
BOOST_LOG(rdInfoLog) << "test3 done" << endl;
};
示例8: testIssue263
void testIssue263() {
string smi = "c1ccccc1C";
#if 1
Mol *m = SmilesToMol(smi);
Mol::AtomIterator atomIt;
unsigned int idx = 0;
for (atomIt = m->beginAtoms(); atomIt != m->endAtoms(); ++atomIt) {
TEST_ASSERT((*atomIt)->getIdx() == idx);
idx++;
}
TEST_ASSERT(idx == 7);
Mol::BondIterator bondIt;
idx = 0;
for (bondIt = m->beginBonds(); bondIt != m->endBonds(); ++bondIt) {
CHECK_INVARIANT((*bondIt)->getIdx() == idx, "bad idx");
idx++;
}
CHECK_INVARIANT(idx == 7, "bad idx");
#endif
BOOST_LOG(rdInfoLog) << "testIssue263 done" << endl;
}
示例9: printf
AO::AO( Point3f _dir, Mol &m) {
dir=_dir.Normalize();
// orthonormal basis
Point3f ax,ay,az=dir;
ax=az^Point3f(1,0,0);
if (ax.SquaredNorm()<0.1) ax=az^Point3f(0,1,0);
ax=ax.Normalize();
ay=(az^ax).Normalize();
// project...
m.Transform(ax,ay,az);
int target=32; //
bufx=bufy=target;
float bufscalex=target/(m.tx1-m.tx0);
float bufscaley=target/(m.ty1-m.ty0);
bufscale=(bufscalex<bufscaley)?bufscalex:bufscaley;
m.ScaleTransl(bufscale);
CubeMapSamp::Transform(ax,ay,az);
printf("Scale=%f\n",bufscale);
buf.resize(target*target,infty);
for (int i=0; i<m.atom.size()-1; i++) {
QAtom &a=m.atom[i];
CheckAtom(a);
RenderSphere( a.trp[0], a.trp[1], a.trp[2], a.trr );
PrintBuffer();
}
}
示例10: test4
void test4() {
string smi = "C1COCCNCOCNSCC1";
unsigned int heteros1[] = {2, 7};
Mol *m = SmilesToMol(smi);
QueryAtom *q = new QueryAtom();
q->setQuery(makeAtomNumQuery(8));
{
unsigned int nSeen = 0;
for (Mol::QueryAtomIterator queryIt = m->beginQueryAtoms(q);
queryIt != m->endQueryAtoms(); queryIt++) {
CHECK_INVARIANT((*queryIt)->getIdx() == heteros1[nSeen], "bad query");
nSeen++;
}
}
{
Mol::QueryAtomIterator queryIt = m->beginQueryAtoms(q);
queryIt++;
queryIt--;
CHECK_INVARIANT((*queryIt)->getIdx() == heteros1[0], "bad query");
CHECK_INVARIANT((*++queryIt)->getIdx() == heteros1[1], "bad query");
CHECK_INVARIANT((*queryIt)->getIdx() == heteros1[1], "bad query");
}
{
Mol::QueryAtomIterator queryIt = m->beginQueryAtoms(q);
queryIt++;
queryIt--;
Mol::QueryAtomIterator queryIt2 = queryIt;
CHECK_INVARIANT((*queryIt2)->getIdx() == heteros1[0], "bad query");
CHECK_INVARIANT((*++queryIt2)->getIdx() == heteros1[1], "bad query");
CHECK_INVARIANT((*queryIt2)->getIdx() == heteros1[1], "bad query");
}
smi = "CC(C)CC(C)CC(C)CC(C)C";
unsigned int heteros2[] = {1, 4, 7, 10};
m = SmilesToMol(smi);
// m->debugMol(cout);
q->setQuery(makeAtomImplicitValenceQuery(1));
{
unsigned int nSeen = 0;
for (Mol::QueryAtomIterator queryIt = m->beginQueryAtoms(q);
queryIt != m->endQueryAtoms(); ++queryIt) {
CHECK_INVARIANT((*queryIt)->getIdx() == heteros2[nSeen], "bad query");
nSeen++;
}
}
BOOST_LOG(rdInfoLog) << "test4 done" << endl;
};
示例11: test2
void test2() {
string smi = "C1COC1";
Mol *m = SmilesToMol(smi);
Mol::BondIterator bondIt;
unsigned int idx = 0;
for (bondIt = m->beginBonds(); bondIt != m->endBonds(); bondIt++) {
CHECK_INVARIANT((*bondIt)->getIdx() == idx, "bad idx");
idx++;
}
bondIt = m->beginBonds();
Mol::BondIterator bondIt2 = m->beginBonds();
CHECK_INVARIANT(bondIt == bondIt2, "iterators don't compare equal");
bondIt++;
CHECK_INVARIANT((*bondIt)->getIdx() == 1, "bad idx");
bondIt++;
bondIt++;
bondIt--;
CHECK_INVARIANT((*bondIt)->getIdx() == 2, "bad idx");
CHECK_INVARIANT(bondIt != bondIt2, "iterators don't compare different");
bondIt--;
--bondIt;
CHECK_INVARIANT((*bondIt)->getIdx() == 0, "bad idx");
CHECK_INVARIANT(bondIt == bondIt2, "iterator inequality failed");
bondIt++;
++bondIt;
CHECK_INVARIANT((*bondIt)->getIdx() == 2, "bad idx");
// past the end stuff
bondIt2 = m->endBonds();
bondIt = m->beginBonds();
bondIt--;
BOOST_LOG(rdInfoLog) << "test2 done" << endl;
};
示例12: InitQuteMol
int InitQuteMol(const char * filename)
{
CubeMapSamp::SetSize(CSIZE);
OctaMapSamp::SetSize(CSIZE);
if (filename==NULL) filename="porin.pdb";
mol.ReadPdb(filename);
cgSettings.SetDefaults();
// initGl gets called from the GL canvas on startup. It's not
// legal to call it before that time because the OpenGL context
// does not exist yet.
/*if (!initGl()) {
printf("failed to initialize! :(\n");
return 0;
}*/
//FillRandomTexture();
//mol.DuplicateTexels(texture, TSIZE);
//ReloadTexture(texture, bilinear);
return 1;
}
示例13: test1
void test1() {
string smi = "CCOC";
Mol *m = SmilesToMol(smi);
Mol::AtomIterator atIt;
unsigned int idx = 0;
for (atIt = m->beginAtoms(); atIt != m->endAtoms(); atIt++) {
CHECK_INVARIANT((*atIt)->getIdx() == idx, "bad idx");
idx++;
}
atIt = m->beginAtoms();
CHECK_INVARIANT((*(atIt + 2))->getIdx() == 2, "bad idx");
atIt = m->beginAtoms();
Mol::AtomIterator atIt2 = m->beginAtoms();
CHECK_INVARIANT(atIt == atIt2, "iterators don't compare equal");
atIt++;
CHECK_INVARIANT((*atIt)->getIdx() == 1, "bad idx");
atIt += 2;
CHECK_INVARIANT((*atIt)->getIdx() == 3, "bad idx");
atIt -= 1;
CHECK_INVARIANT((*atIt)->getIdx() == 2, "bad idx");
CHECK_INVARIANT(atIt != atIt2, "iterators don't compare different");
CHECK_INVARIANT(atIt2 < atIt, "iterator inequality failed");
CHECK_INVARIANT(atIt2 <= atIt, "iterator inequality failed");
CHECK_INVARIANT(atIt > atIt2, "iterator inequality failed");
CHECK_INVARIANT(atIt >= atIt2, "iterator inequality failed");
atIt--;
--atIt;
CHECK_INVARIANT((*atIt)->getIdx() == 0, "bad idx");
CHECK_INVARIANT(atIt == atIt2, "iterator inequality failed");
atIt++;
++atIt;
CHECK_INVARIANT((*atIt)->getIdx() == 2, "bad idx");
atIt = m->beginAtoms();
atIt = atIt + 2;
atIt = atIt - 2;
CHECK_INVARIANT((*atIt)->getIdx() == 0, "bad idx");
atIt2 = m->beginAtoms();
atIt2 += 2;
CHECK_INVARIANT(atIt2 - atIt == 2, "subtraction failed");
CHECK_INVARIANT(atIt - atIt2 == -2, "subtraction failed");
// past the end stuff
atIt2 = m->endAtoms();
atIt = m->beginAtoms() + 10;
CHECK_INVARIANT(atIt >= atIt2, "past-the-end failed");
// this is whack
atIt = m->beginAtoms();
atIt -= 10;
CHECK_INVARIANT(atIt >= atIt2, "past-the-end failed");
BOOST_LOG(rdInfoLog) << "test1 done" << endl;
};
示例14: wxConsumeTrackBallEvent
void TestGLCanvas::OnKeyDown( wxKeyEvent& event ){
wxConsumeTrackBallEvent(event,true,track);
#ifdef __DARWIN__
wxString path = wxStandardPaths::Get().GetResourcesDir() + "/presets/new.preset";
#else
wxString path = "presets\\new.preset";
#endif
if (event.GetKeyCode() == WXK_F7 ) {
cgSettings.Save(path.c_str());
}
if (event.GetKeyCode() == WXK_F6 ) {
if (cgSettings.Load(path.c_str())) {
MyTab::UpdateAll();
cgSettings.ResetHalo();
cgSettings.UpdateShaders();
SceneChanged();
}
}
if (event.GetKeyCode() == WXK_F5 ) {
mol.PrepareAOSingleView();
SceneChanged();
}
if (event.GetKeyCode() == WXK_F2 ) {
static int status=0;
status=(status+1) % 5;
draw_balls = (status==0) || (status==1) || (status==2) ;
draw_sticks = (status==0) || (status==1) || (status==3) || (status==4) ;
draw_wireframe_balls= (status==1) ;
draw_wireframe_sticks= (status==1) || (status==3) ;
SceneChanged();
}
if (event.GetKeyCode() == WXK_F1 ) {
wxString text;
if (!mol.IsReady() ) text=wxT("(no molecule)");
else {
text=wxString( mol.GetMolName(), wxConvUTF8 ).BeforeLast('.') +
wxT("\n (file: \"")+wxString( mol.filename, wxConvUTF8 ) +wxT("\")\n\n");
text=text+wxString::Format(wxT("%d atoms\n"),mol.atom.size());
if (mol.sticks) {
text=text+wxString::Format(wxT("%d bonds\n"),mol.bond.size());
}
text=text+wxString::Format(
_T("\nUsing:\n Texture size = %dx%d\n Patch size=%dx%d"),
moltextureCanvas.GetHardRes(),
moltextureCanvas.GetHardRes(),
CSIZE,CSIZE
);
}
wxMessageBox(text, _T("QuteMol - file info"), wxOK | wxICON_INFORMATION, this);
}
if (event.GetKeyCode() == WXK_F6 ) {
use_accurate_halo=!use_accurate_halo;
SceneChanged();
}
// temp, should e set auto depending on dist
if (event.GetKeyCode() == WXK_F2 ) {
cgSettings.P_capping=!cgSettings.P_capping;
cgSettings.UpdateShaders();
SceneChanged();
}
}
示例15: test4
void test4() {
BOOST_LOG(rdErrorLog) << "---------------------- Test4" << std::endl;
Mol m;
Atom *a = new Atom(6);
// we copy in addAtom, so this is safe
m.addAtom(a);
m.addAtom(a);
m.addAtom(a);
m.addAtom(a);
m.addAtom(a);
m.addAtom(a);
m.addAtom(a);
delete a;
m.addBond(0, 1, Bond::SINGLE);
m.addBond(1, 2, Bond::DOUBLE);
m.addBond(2, 3, Bond::SINGLE);
m.addBond(3, 4, Bond::DOUBLE);
m.addBond(4, 5, Bond::SINGLE);
m.addBond(5, 0, Bond::DOUBLE);
m.addBond(5, 6, Bond::SINGLE);
MolOps::sanitizeMol(m);
ATOM_NULL_QUERY *aeq = makeAtomNullQuery();
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(0)), "");
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(1)), "");
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(5)), "");
CHECK_INVARIANT(aeq->Match(m.getAtomWithIdx(6)), "");
delete aeq;
BOOST_LOG(rdErrorLog) << "Done!" << std::endl;
}