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