File: simple.cpp

package info (click to toggle)
rdkit 201403-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 62,288 kB
  • ctags: 15,156
  • sloc: cpp: 125,376; python: 55,674; java: 4,831; ansic: 4,178; xml: 2,499; sql: 1,775; yacc: 1,551; lex: 1,051; makefile: 353; fortran: 183; sh: 148; cs: 93
file content (42 lines) | stat: -rw-r--r-- 1,033 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$
//
//  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);

}