OK, this seems to work.... so here's a description of my patch. I edited "include/openbabel.forcefield.h", adding a simple function: "OBBitVec &GetFixedBitVec() { return _fixed; }"
I edited "src/forcefield.cpp", adding this line: rl.SetFixAtoms(_constraints.GetFixedBitVec()); to each of the following three functions, immediately preceding the call to "rl.Setup(_mol);": OBForceField::SystematicRotorSearchInitialize OBForceField::RandomRotorSearchInitialize OBForceField::WeightedRotorSearch And the conformer search routines now appear to respect fixed atom constraints. :) Hopefully this is an appropriate place to post such modifications. Let me know what you think. Cheers, Chris On Tue, Jun 29, 2010 at 12:14 PM, Christopher Wassman <cwass...@ics.uci.edu> wrote: > Here's a bit more info, perhaps useful... > > For whatever reason > > Inside of > OBRotorList::FindRotors > > The call to HasFixedAtoms() returns false, even though I've previously > specified constraints to the setup of the force field. > > So... it seem that _fix is empy (HasFixedAtoms() is declared in > include/openbabel/rotor.h) > > Seems _fix is not in sync with _constraints._fixed > > Anyway, it would seem that the rotor search codes should be calling > OBRotorList.SetFixAtoms(...) specifying the _fixed OBBitVec from > _constraints... but I can't find any where they are doing so. > > At least that's my naive take on it. I must admit my C++ is very > rusty and I've just started looking at this code base last week, so > take this with the appropriate caution. :) > > Cheers, > Chris. > > On Mon, Jun 28, 2010 at 7:43 AM, Noel O'Boyle <baoille...@gmail.com> wrote: >> I've never used OBConstraints, but just as general advice: when >> setting up the forcefield, you should ensure that (a) the atoms have >> 3D coordinates, (b) hydrogens have already been added, and (c) that >> calling the Setup function is successful. >> >> // We pass the constraints as argument for Setup() >> if (!pFF->Setup(mol, constraints)) { >> cerr << "ERROR: could not setup force field." << endl; >> } >> >> - Noel >> >> On 25 June 2010 01:03, Christopher Wassman <cwass...@ics.uci.edu> wrote: >>> Tried to implement fixing atoms as part of a conformational search.... >>> as a straightforward >>> modification of the 'obconformer' tool.... but perhaps I'm missing >>> something. I'm using the source from >>> openbabel-2.2.3 >>> >>> >>> I simply added this (in the "while(ifs.peek() != EOF && ifs.good())" loop): >>> >>> OBFFConstraints constraints; >>> int i = 0; >>> for (i=1; i<=3; i++) { >>> cout << " Fixing atom index " << i << "...\n"; >>> OBAtom *atom; >>> atom = mol.GetAtom(i); >>> if (!atom->IsHydrogen()) >>> { >>> constraints.AddAtomConstraint(i); >>> } >>> else >>> { >>> cerr << "Error! heavy atoms first !" << endl; >>> } >>> } >>> >>> pFF->Setup(mol,constraints); >>> pFF->WeightedRotorSearch(weightSteps, geomSteps); >>> ... >>> etc as in "tools/obconfomer.cpp" >>> >>> >>> and removed the old "pFF->Setup(mol);" statement >>> >>> I tried this on a simple butane molecule (defined in a pdb), where the >>> first atoms listed are the carbon backbone, in linear order. >>> >>> I'd expect this to "freeze" the first 3 carbon atoms, however, in the >>> output only 2 of the 4 carbon atoms are held in fixed position. (The >>> first and the last carbons moved.) >>> >>> Trying this approach to freeze all 4 of the carbon atoms, results in a >>> conformer where only 1 of the carbon atoms have moved. (The first >>> carbon moved.) >>> >>> Anyone able to shed some light on this for me? What am I missing? >>> >>> ------------------------------------------------------------------------------ >>> ThinkGeek and WIRED's GeekDad team up for the Ultimate >>> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the >>> lucky parental unit. See the prize list and enter to win: >>> http://p.sf.net/sfu/thinkgeek-promo >>> _______________________________________________ >>> OpenBabel-discuss mailing list >>> OpenBabel-discuss@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss >>> >> >> > ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ OpenBabel-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss