|
From: Noel O'B. <bao...@gm...> - 2007-02-05 15:47:11
|
I think I know the problem. When the SWIG wrappers are generated, the
following error appears (copied by hand):
"""
data.h: Overloaded Translate(std::string const &) is shadowed by
Translate(std::string &, std::string const &) at line 245.
"""
I'll have to read up a bit on this, but the bottom line is that you
only have one of the above two functions as Swig thinks they are too
similar to include both. This explains why you're getting the wrong
return value as you're actually calling the wrong function. There's
sure to be a way around this. I'll look into it, if Geoff doesn't get
there first.
Noel
On 05/02/07, Kieron Taylor <kr...@so...> wrote:
> Noel O'Boyle wrote:
> > It might be unrelated to your problem, but have you set the
> > environment variable BABEL_DATADIR to the 'data' directory?
>
> Nice try but no banana. The error is still forthcoming. I hasten to add
> that the atom types are actually assigned and serialised, in spite of
> the error. This means that it is finding the appropriate data files (I
> hope).
>
> Thanks anyway.
>
> Kieron
>
> >
> > On 05/02/07, Kieron Taylor <kr...@so...> wrote:
> >
> >> I've written some working code for assigning atom types for the various
> >> forcefields by Perl API. It's pretty simple, but there are differences
> >> from the v2.02 API.
> >>
> >> I get the following error with each atom, even though it performs the
> >> appropriate transformation. I am uncertain what it is trying to do that
> >> fails. Error:
> >> ==============================
> >> *** Open Babel Warning in Translate
> >> Cannot perform atom type translation: table cannot find requested
> >> types.
> >>
> >> I have a feeling I may be trying to get it to do the translation twice.
> >>
> >> Line 23 of my code $newtype = $atom_typer->Translate($type); does not
> >> match the API documentation which claims to return Boolean from the
> >> Translate call, rather than the new atom type.
> >>
> >> Here's the code:
> >> ---------------
> >> #!/usr/bin/perl
> >>
> >> use strict;
> >> use Chemistry::OpenBabel;
> >>
> >> my $obMol = new Chemistry::OpenBabel::OBMol;
> >> my $obConverter = new Chemistry::OpenBabel::OBConversion;
> >>
> >> $obConverter->SetInAndOutFormats("xyz","mol2");
> >> $obConverter->ReadFile($obMol,"file.xyz");
> >>
> >> my $atom_typer = new Chemistry::OpenBabel::OBTypeTable;
> >>
> >> $atom_typer->SetFromType("INT");
> >> $atom_typer->SetToType("DRE");
> >> # DRE = Dreiding, INT = internal, others found in
> >> # OpenBabel/data/types.txt
> >>
> >> for (1..$obMol->NumAtoms() )
> >> {
> >> my $atom = $obMol->GetAtom($_);
> >> my $type = $atom->GetType();
> >> my $newtype = $atom_typer->Translate($type);
> >> $atom->SetType($newtype);
> >> }
> >> $obConverter->WriteFile($obMol, "typed_molecule.mol2") ;
> >>
> >> ----end-of-Perl---------
> >>
> >> Any ideas what I'm missing here?
> >>
> >> Thanks,
> >>
> >> Kieron
> >>
> >
>
>
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier.
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> OpenBabel-scripting mailing list
> Ope...@li...
> https://lists.sourceforge.net/lists/listinfo/openbabel-scripting
>
|