How to get coordinates from a 3D conformer?

User 677b9c22ff

15-11-2008 05:04:46

Hi,


there was a post some years ago from Ödön Farkas about the QuatFit


algorithm in the ChemAxon forum. The JAVA code points to package chemaxon.marvin.modelling.linalg;


So I included that and try to use that method, but I am getting stuck at the 3D coordinates.





Should I use the ConformerPlugin? I actually though that the 3D-Generator is useful for that.





Here is the code, which doesn't compile at double rms = myQuatFit.quatfit(A, B, C);


Actually I thought I have to support molecule coordinates. Shouldn't be that difficult, but somehow it is difficult.





Thanks


Tobias





Code:



package examples;


/* SuperPose Mols with QuatFit V0.9 (Tobias Kind)


 *


 * Quatfit example from Ödön Farkas see ml


 * Download JQuatFit.java from the ChemAxon forum


 * http://www.chemaxon.com/forum/viewpost7828.htm


 */





import chemaxon.formats.MolFormatException;


import chemaxon.formats.MolImporter;


import chemaxon.marvin.calculations.GeometryPlugin;


import chemaxon.marvin.modelling.linalg.JQuatFit;


import chemaxon.marvin.plugin.PluginException;


import chemaxon.struc.Molecule;


import chemaxon.util.MolHandler;





public class superposemol {





   


public static void generate3D( Molecule mol1 )   {





   try {


      //    API example Zsolt Mohacsi


      //    create plugin


       GeometryPlugin plugin = new GeometryPlugin();





       // set target molecule


       plugin.setMolecule(mol1);


      


       // set parameters for calculation


       //        * "if2D" - if molecule is in 2D


       //      * "never" - never, always use the input molecule for calculations


       //      * "always" - always calculate with the lowest energy conformer


       plugin.setCalculateForLEConformer("if2D");


       plugin.setCalculateEnergy(false); // sets the energy calculation


       plugin.setCalculateMoleculeProjections(false); // sets the calculation of molecule projections


      


       //timelimit can be set via the conformerplugin if needed (not implemented yet here)


      


       // plugin.getLowestEnergyConformer();


       // run the calculation


       plugin.run();





       // get results


   /*


       double energy = plugin.getDreidingEnergy();


       double distance = plugin.getDistance(2,4);


       double angle = plugin.getAngle(4,2,6);


       int[] atoms = { 2, 1, 4, 6 };


       double dihedral = plugin.getDihedral(atoms);


       double hindrance = plugin.getStericHindrance(5); // steric hindrance of 5th atom


       double minimalProjectionArea = plugin.getMinimalProjectionArea();


       double maximalProjectionArea = plugin.getMaximalProjectionArea();


       double minimalProjectionRadius = plugin.getMinimalProjectionRadius();


       double maximalProjectionRadius = plugin.getMaximalProjectionRadius();


   */


    }


    catch ( PluginException me ) {


        me.printStackTrace();


        // normally this should be rethrown here


    }


}


   


   public static  void main(String[] args) throws PluginException


   {


      System.out.println("SuperPose Mols with QuatFit V0.09");


   


      try {


          MolImporter importer = new MolImporter();


          Molecule mol1 = importer.importMol("OC[C@@H]1O[C@@H](O[C@]2(CO)O[C@@H](CO)[C@H](O)[C@@H]2O)[C@@H](O)[C@@H](O)[C@H]1O");


          Molecule mol2 = importer.importMol("OC[C@@H]1O[C@H](O[C@]2(CO)O[C@H](CO)[C@@H](O)[C@@H]2O)[C@H](O)[C@@H](O)[C@@H]1O");


         


          generate3D(mol1);


          generate3D(mol2);


           mol1.getPoints();


          mol2.getPoints();


         


          JQuatFit myQuatFit = new JQuatFit(null);


         


          // quatfit(double[][], int[][])


          // public double quatfit(double[][] fitCoordinates, double[] weightFrom0, int[][] pairs)


          double rms = myQuatFit.quatfit(A, B, C);


          System.out.println("RMS of molecules : "+rms);


         


      } catch (Exception e) {


          // TODO Auto-generated catch block


          e.printStackTrace();


      }   


   }


}


User 677b9c22ff

17-11-2008 20:19:00

Hi,


I just received word (from the other Marvin forum) that the


code is public but not supported. So if somebody has some tips


how to get the coordinates and feed them into that double


array I would really appreciate. I have two other (ugly)


options, calling the 3D generator and molconvert and feeding


the molecules as XYZ or PDB either into QUATFIT.exe (CCL) or


SUPERPOSE (Tinker). Bot ways work, but require external and


IO disk dependent processes, hence are not that elegant.





Cheers


Tobias

ChemAxon 1b9e90b2e7

18-11-2008 10:42:07

Hi Tobias,


yes, indeed the code is truly not supported, however I submit an example code of usage of JQuatFit. Please note that you need to supply atom-atom mappings for the alignment algorithm.


Regards,


Adrian

User 677b9c22ff

20-11-2008 04:22:07

Hello Adrian,


thanks alot. I works like a charm. I really appreciate your help.


My idea was to take any given isomer, calculate all possible stereoisomers,


generate all lowest energy conformers, do a RMS calculation on those, for


instance remove overlapping ones and/or refine for other jobs.


The whole system on a larger number of structures from a SMILES file.





The code you provided is not universal, I need to look into that,


"select manually the atomic sequence numbers starting from 0"


how to actually select those coordinates and which cases make sense and


which cases make no sense and where to start is still a miracle to me.


Obviously this includes much more trickery :-) But I will find that out.





I compared the results with the original C code and got similar results


with small difference, need to check that. Or furthermore if it is allowed


with the current selection to compare the results at all. Because the C


code said for option -p none:





"If this option is not specified, pairs and weights are taken from


stdin. If file name "none" is used (i.e. -p none), atoms of the


fitted molecule are fitted to atoms of the reference


molecule with the same number, and all weights are assumed 1.0.


If molecules do not have the same number of atoms, the


smaller number of atoms is fitted."








Code:
SuperPose Mols with QuatFit V0.091


RMSD of the seleced coordinates: 2.043734685985737











Code:



~/quafit


$ ./quatfit -r mol1.xyz  -f mol2.xyz -p none


23





         O   3.236205   3.816042  -1.545352


         C   2.437808   2.764373  -2.084046


         C   1.665223   1.997807  -0.973681


         O   1.037708   0.787784  -1.464374


         C  -0.179696   0.910529  -2.237769


         O   0.109954   1.324884  -3.598617


         C   0.074685   0.340504  -4.673552


         C   0.114323   1.150494  -6.001299


         O  -0.916657   2.133983  -6.022408


         O  -1.179752  -0.373064  -4.653549


         C  -0.927985  -1.787454  -4.704426


         C  -2.047166  -2.539608  -3.946043


         O  -1.882668  -3.947543  -4.070631


         C   0.483660  -1.992448  -4.112008


         O   1.116842  -3.191363  -4.555399


         C   1.207921  -0.731684  -4.603629


         O   2.293561  -0.388543  -3.749861


         C  -1.232959   1.832127  -1.554599


         O  -2.300835   2.106182  -2.459601


         C  -0.622541   3.152949  -1.009998


         O  -1.585045   3.845417  -0.211551


         C   0.640549   2.847789  -0.162597


         O   1.213562   4.054843   0.336291





Distances and weighted distances between fitted atoms


Ref.At. Fit.At.  Distance  Dist*sqrt(weight)  weight


    1      1     4.538711      4.538711       1.000000


    2      2     3.957986      3.957986       1.000000


    3      3     1.626179      1.626179       1.000000


    4      4     0.596380      0.596380       1.000000


    5      5     1.825942      1.825942       1.000000


    6      6     0.546505      0.546505       1.000000


    7      7     0.705885      0.705885       1.000000


    8      8     2.471755      2.471755       1.000000


    9      9     3.043575      3.043575       1.000000


   10     10     1.441735      1.441735       1.000000


   11     11     1.576303      1.576303       1.000000


   12     12     1.375417      1.375417       1.000000


   13     13     1.670682      1.670682       1.000000


   14     14     0.983780      0.983780       1.000000


   15     15     2.457176      2.457176       1.000000


   16     16     1.330956      1.330956       1.000000


   17     17     2.863531      2.863531       1.000000


   18     18     3.276443      3.276443       1.000000


   19     19     4.395887      4.395887       1.000000


   20     20     1.488883      1.488883       1.000000


   21     21     2.208615      2.208615       1.000000


   22     22     0.444136      0.444136       1.000000


   23     23     1.846468      1.846468       1.000000








Weighted root mean square=  2.338273











Center of reference molecule fitted atoms


Xc =    0.119857 Yc =    0.787565 Zc =   -2.959074








Center of fitted molecule fitted atoms


Xc =    0.948917 Yc =   -0.355952 Zc =   -2.037413








Left rotation matrix


    0.079474     0.821376    -0.564824


   -0.125512     0.570352     0.811754


    0.988904     0.006379     0.148421


~/quafit


$








Thanks again


Have a nice week


Tobias

ChemAxon 1b9e90b2e7

20-11-2008 08:20:39

Hi Tobias,


If you wish to align two conformation of the same molecule (regardless of the stereoisomerism) the mapping is not a big issue. Here the first atom of the first molecule corresponds to the first atom of the second molecule, ... and last to the last.


You simlply need to generate an int array: a=[0, 1, 2 ... atomcount]


and map[0]=a, and map[1]=a;


The -p option of the original code might do the similar. I haven`t check it.





FYI: Rigid alignment, like JQuatFit, and Flexible alignment, that can rotates the flexible bonds also, will be available soon with supported API.


Cheers


Adrian

User 677b9c22ff

21-11-2008 02:54:57

Cool. Thanks.


Tobias