On 02/06/2010 23:22, horgerj wrote: > > I've got a question for you experts about a problem I'm having working with > HyperChem (.hin) files. > > If you're unfamiliar with the format, a .hin file is set up like so: > > forcefield mm+ > sys 0 > view 40 1 55 15 1 0 0 0 1 0 0 0 1 0 0 -55 > box 15.631 16.244 32.635 > mol 1 > atom 4 C62 C ** - 0 4.85811 -5.05185 9.15738 1 2 s > atom 2 C63 C ** - 0 4.77371 -4.35986 7.92378 3 3 s 1 s 4 s > atom 3 C64 C ** - 0 4.38762 -3.00350 7.88788 1 2 s > atom 1 C69 C ** - 0 5.12540 -5.05835 6.74239 1 2 s > endmol 1 > mol 2 > [more atoms] > endmol 2 > > ... and so on, where each mol-endmol block corresponds to disconnected > fragments. > > I'm working in Visual Basic, and when I try to do a simple hin -> PDB > conversion, I seem to only get output for the first molecule defined in the > hin file. Here's the code I'm using: > > Dim OBConv As New OBConversion() > Dim Mol As New OBMol() > > OBConv.SetInFormat("hin") > OBConv.SetOutFormat("pdb") > > OBConv.ReadString(Mol, Input.Text) > Output.Text = Output.Text + OBConv.WriteString(Mol, False) > > I'm sure I'm missing something simple - how do I load all of the separate > fragments from the .hin file? Also, once I've done that, is the information > about which fragment contains which atoms retained anywhere? > OBConversion::ReadString() works on single molecules. To convert multiple molecules, read and write in a loop until ReadString returns false.
If you just wanted to convert between file formats the command line or GUI is easier: babel infile.hin outfile.pdb Chris ------------------------------------------------------------------------------ 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