User 8ef5099b33
30-06-2009 22:29:13
Hi,
I have a simple question:
I want to convert a smiles string to a 3d mol file.
What is the appropriate opt settings that I can use? --> mol -3:S{fast}
Can it only read in a file or can I send it a molecule object?
MolConverter.Options opts = new MolConverter.Options();
opts.addInput("input.smiles", "");
opts.setOutput("out.mol", "mol");
opts.setOutputFlags(MolExporter.TEXT);
MolConverter mc = new MolConverter(opts);
while(mc.convert());
mc.close();
Thanks,
Guy
ChemAxon 9c0afc9aaf
30-06-2009 22:34:00
I have moved the topic to the proper forum, the relevant asnwers will answer soon.
Best regards,
Szilard
ChemAxon 8b644e6bf4
02-07-2009 08:22:30
Dear Guy,
What is the appropriate opt settings that I can use? --> mol -3:S{fast}
I would recommend to use the default setting: mol -3
Can it only read in a file or can I send it a molecule object?
According to the API docs (see http://chemaxon.com/marvin/help/developer/beans/api/chemaxon/formats/MolConverter.html ) it processes streams or files, however it can be launched from command line:
molconvert mol -3 input.smiles > output.mol
In this case using the Molecule.clean() API method may be more convenient:
Molecule m = MolImporter.importMol("CCCCC");
m.clean(3,"");
System.out.print( m.toFormat("mol") );
If you have any further questions, please do not hesitate to ask them
Regards,
Gabor
User 8ef5099b33
02-07-2009 17:36:36
Hi Gimre,
Thanks for the tip. The clean method worked great. I didn't realize that I could use clean to generate the 3d mol file.
But for future edification, how would I set the opts in the jchem molconvert api to go from a 2d sdf file to a 3d mol file?
I tried the following but it threw an error.
opts.addInput("input.sdf", "sdf");
opts.setOutput("out.mol", "mol -3");
Please note: I know how to do this with the command line molconvert but I am missing something in the API.
Thanks for the help.
Regards,
Guy
ChemAxon 8b644e6bf4
06-07-2009 12:28:49
Dear Guy,
Please note: I know how to do this with the command line molconvert.
You can use MolConverter.mainWithoutExit() in this case:
import chemaxon.formats.MolConverter;
public class MolConverterExample {
public static void main(String[] args) throws Exception {
try {
MolConverter.mainWithoutExit(
new String [] { "mol", "input.sdf", "-3", "-o", "output.mol" } );
} catch ( RuntimeException e ) {
if ( e.getMessage().startsWith("molconvert exit:") ) {
// molconvert exited
} else {
throw e;
}
}
}
}
But for future edification, how would I set the opts in the jchem molconvert api to go from a 2d sdf file to a 3d mol file?
I will assign this question to the developer responsible for MolConverter.
Regards,
Gabor
ChemAxon 8b644e6bf4
07-07-2009 11:49:50
Dear Guy,
Currently 3D coordinate generation functionality in MolConverter API is only available through the main()/mainWithoutExit() methods.
Regards,
Gabor
User ef5e605ae6
07-07-2009 14:06:45
Created MolConverter.Builder.clean methods. The following should work, starting from Marvin 5.2.4:
MolConverter.Builder opts = new MolConverter.Builder();
opts.addInput("input", "sdf");
opts.setOutput("out.mol", "mol");
opts.clean(3);
MolConverter mc = opts.build();