File: simple.cpp

package info (click to toggle)
rdkit 201203-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 37,840 kB
  • sloc: cpp: 93,902; python: 51,897; java: 5,192; ansic: 3,497; xml: 2,499; sql: 1,641; yacc: 1,518; lex: 1,076; makefile: 325; fortran: 183; sh: 153; cs: 51
file content (42 lines) | stat: -rw-r--r-- 1,081 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//  $Id: simple.cpp 1508 2010-09-15 04:18:59Z glandrum $
//
//  Copyright (C) 2004 Rational Discovery LLC
//   All Rights Reserved
//
#include "TemplEnum.h"
#include <GraphMol/FileParsers/FileParsers.h>

using namespace RDKit;
using namespace TemplateEnum;

#include <math.h>

bool feq(double v1,double v2,double tol=1e-4){
  return fabs(v1-v2)<=tol;
}
bool feq(RDGeom::Point3D p1,RDGeom::Point3D p2,double tol=1e-4){
  return feq(p1.x,p2.x,tol)&&feq(p1.y,p2.y,tol)&&feq(p1.z,p2.z,tol);
}


int main(int argc,const char *argv[]){
  if(argc<3){
    std::cerr << " Usage: simple.exe <template.mol> [attach1.sdf, attach2.sdf, ...]" << std::endl;
    exit(-1);
  }
  std::vector<const char *>fileNames;
  for(int i=2;i<argc;i++){
    fileNames.push_back( argv[i] );
  }
  RWMOL_SPTR_VECT library=enumFromFiles(argv[1],fileNames);

  std::cerr << "Created: " << library.size() << " compounds." << std::endl;
  for(int i=0;i<library.size();i++){
    RWMOL_SPTR mol = library[i];
    std::cout << MolToMolBlock(mol.get(),false);
    std::cout << "$$$$" << std::endl;
  }
  
  exit(0);

}