Hello,

Finally I've found the way to get 3D coordinates. I use ModelBuilder3D:

// get 3D cooords
mb3d = 
ModelBuilder3D.getInstance(TemplateHandler3D.getInstance(),"MMFF94");//"MMFF94"
IMolecule m = mb3d.generate3DCoordinates(molecule, true);

Of course you won't get the real 3D coordinates, since this is found in 
molecule's mol file, but you'll be able to paint a molecule in 3D.

Josep


En/na Rajarshi Guha ha escrit:
> Can somebody with more experience with the builder provide a code 
> example?
>
> Begin forwarded message:
>
>> From: Josep Cester Bofarull <[email protected]>
>> Date: December 19, 2008 3:26:29 AM EST
>> To: Rajarshi Guha <[email protected]>
>> Cc: CCL Subscribers <[email protected]>
>> Subject: Re: CCL: SMILES to VRML or X3D
>> Reply-To: [email protected]
>>
>> Thank you for your response Rajarshi,
>>
>> as I did with JOELib2, I've succeeded in build a CML file from an 
>> SMILES with CDK with this simple code:
>>
>> ####
>> SmilesParser sp = new 
>> SmilesParser(DefaultChemObjectBuilder.getInstance());
>>            IMolecule m = sp.parseSmiles("C(=O)(N)N");
>>            StringWriter output = new StringWriter (  ) ;            
>> CMLWriter cmlwriter = new CMLWriter ( output ) ;            try  
>> {                      cmlwriter.write ( m ) ;
>>                cmlwriter.close (  ) ;            }            catch ( 
>> Exception e )   {  System.out.println ( e ) ;  }            
>> System.out.println("CML: " + output.toString (  ) );
>> ####
>>
>> The problem I have is that I don't know how to specify 3d coordinates 
>> in this CML. Could you give me some example of how to do this?
>>
>> Thank you.
>>
>> Josep
>>
>> En/na Rajarshi Guha ha escrit:
>>>
>>> On Dec 18, 2008, at 8:58 AM, Josep Cester josep.cester]![urv.cat wrote:
>>>
>>>>
>>>> Sent to CCL by: "Josep  Cester" [josep.cester===urv.cat]
>>>> Hello,
>>>>
>>>> I need to convert SMILES to VRML or X3D in a java application.  
>>>> Does exists any java library to do it?
>>>>
>>>> The only way I've found to get an X3D file from an SMILES is 
>>>> converting SMILES to CML (with OpenBabel) and then apply an XSL 
>>>> stylesheet to convert CML to X3D. The problem I have is that 
>>>> OpenBabel is not written in java. I have also tried JOELib2 to 
>>>> convert SMILES to CML, but the CML I get has not got 3D coordinates.
>>>
>>> You can use the CDK to go from SMILES to CML
>>>
>>> -------------------------------------------------------------------
>>> Rajarshi Guha  <[email protected]>
>>> GPG Fingerprint: D070 5427 CC5B 7938 929C  DD13 66A1 922C 51E7 9E84
>>> -------------------------------------------------------------------
>>> "I'd love to go out with you, but my favorite commercial is on TV."
>>>
>>>
>>>
>>
>> -- 
>> Josep Cester Bofarull
>> FeT - DEQ
>> Universitat Rovira i Virgili
>
> -------------------------------------------------------------------
> Rajarshi Guha  <[email protected]>
> GPG Fingerprint: D070 5427 CC5B 7938 929C  DD13 66A1 922C 51E7 9E84
> -------------------------------------------------------------------
> My Ethicator machine must have had a built-in moral
> compromise spectral phantasmatron! I'm a genius."
>                 -Calvin
>
>
>

-- 
Josep Cester Bofarull
FeT - DEQ
Universitat Rovira i Virgili 


------------------------------------------------------------------------------
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to