Flip molecule vertically using JChem API

User 55ffa2f197

01-07-2015 18:23:41

Hi, I like to flip molecule vertically, and not sure how to define the transformation matrix, I would assume doing something like following:


CTransform3D flip=new CTransform();


flip.m00=-1;


flip.m22=-1


molecule.transform(flip).


 


Not sure if I set the element correctly. Can you let me know?


Thanks


Dong


 


 


 


 


 


 


 


 

ChemAxon a202a732bf

02-07-2015 10:58:17

Hi Dong,



For a vertical flip the following set is necessary:


CTransform3D flip=new CTransform();

 flip.m00=1;

flip.m11=-1;

flip.m22=-1 ; // If  you want the flip to have effect on the stereo of the bonds

molecule.transform(flip);


For horizontal flip the difference is:



flip.m00=-1;

flip.m11=1;




Regards,


Zsuzsa


 



User 55ffa2f197

05-07-2015 14:17:47

Hi Zsazabo,


It works great, I just need to add Cleaner.clean(mol,2) to make 2D depiction before applying flip as the molecule was generated through stitching the fragment smiles, it is 0 dim to begin with.


I may also need to orientate the molecule by a fixed group, as we always want to see the set of molecules generated oriented the same way relative to the fixed group. Will talk to you on that one later ...


Thanks


Dong