void MoleculeURLListProperty::loadMolecules(bool selectedOnly /*= false*/, bool removeOnFailure /*= false*/) { std::vector<std::string> failedURLs; for (size_t i=0; i<value_.size(); i++) { std::string url = value_[i]; if (selectedOnly && !isSelected(url)) continue; if (getMolecule(url)) continue; try { loadMolecule(url); } catch (tgt::FileException& e) { LERROR(e.what()); failedURLs.push_back(url); } catch (std::bad_alloc&) { LERROR("bad allocation while loading molecule: " << url); failedURLs.push_back(url); } catch (tgt::Exception& e) { LERROR("unknown exception while loading molecule '" << url << "':" << e.what()); failedURLs.push_back(url); } } if (removeOnFailure) { for (size_t i=0; i<failedURLs.size(); i++) removeURL(failedURLs.at(i)); } }
int main(int argc, char** argv) { float s; clock_t t; char inner = 0; float k = 0; if (argc!=5) { printf("Usage: levelSet <pdb File> <gridSize> <probeSize> <inner caves(1) or outer surface(0)\n"); return 1; } t = clock(); mol = loadMolecule(argv[1]); catrace = loadCATrace(argv[1]); printf("Number of CA atoms = %d\n",catrace->npoints); printf("Molecule loading time %f seconds\n",(clock()-t)/(float)CLOCKS_PER_SEC); N = (short)atoi(argv[2]); PR = (float)atof(argv[3]); inner = argv[4][0]-'0'; printf("Number of atoms: %d\n",mol->npoints); t = clock(); ttime = clock(); s = centerMolecule(mol, catrace); printf("Molecule centering time %f seconds\n",(clock()-t)/(float)CLOCKS_PER_SEC); PR = PR*s; t = clock(); grid = createGrid(N); printf("Grid creation time %f seconds\n",(clock()-t)/(float)CLOCKS_PER_SEC); t = clock(); signDistanceGridMol(grid,mol,PR); printf("Grid initialization time %f seconds\n",(clock()-t)/(float)CLOCKS_PER_SEC); t = clock(); shrink(grid,PR); /* c = findProbesMol(grid,PR); printf("There are %d probes.\n",c); printf("ProbesMol time %f seconds.\n",(clock()-t)/(float)CLOCKS_PER_SEC); */ printf("Shrinking time %f seconds.\n",(clock()-t)/(float)CLOCKS_PER_SEC); t = clock(); k = s/(512/N); k = k * k * k; printf("Total cavity/molecule volume = %f\n",fastMarching(grid,inner)/k); printf("Fast marching time %f seconds\n",(clock()-t)/(float)CLOCKS_PER_SEC); init(); return 0; }
/* initialization */ void initEvent() { vl::Log::notify(appletInfo()); /* initialize the text actor */ mText->setText("Drop a MOL2 file inside the window."); mText->setFont( vl::defFontManager()->acquireFont("/font/bitstream-vera/VeraMono.ttf", 10) ); mText->setAlignment( vl::AlignHCenter | vl::AlignTop ); mText->setViewportAlignment( vl::AlignHCenter | vl::AlignTop ); mText->setTextAlignment(vl::TextAlignCenter); mText->translate(0,-5,0); mText->setColor(vl::white); vl::ref<vl::Effect> effect = new vl::Effect; effect->shader()->enable(vl::EN_BLEND); sceneManager()->tree()->addActor(mText.get(), effect.get()); loadMolecule("/mol/molecule.mol2"); }
/* loads a MOL2 file when it is dropped in the window */ void fileDroppedEvent(const std::vector<vl::String>& files) { /*loads only the first .mol2 file if more are dropped*/ loadMolecule( files[0] ); }