Hi José, When the option is there, I recommend using the form of the function that takes a parameter object instead of using the one with the giant pile of keywords. It makes things easier.
The default behavior at the moment (if you call EmbedMolecule or EmbedMulipleConfs without any extra arguments) is to use ETKDGv1. -greg On Tue, Jan 29, 2019 at 12:05 AM Jose A. <sjojungf...@gmail.com> wrote: > Dear Greg, > > Thanks a lot for the help. Your example indeed helped!. > > I see that the problem came when I tried to pass coordMap and the > parameters set at the same time. From what I understood, EmbedMultipleConfs > can be called either via positional arguments: > > EmbedMultipleConfs((Mol)mol, (int)numConfs, (EmbedParameters)params) > > where the EmbedParameters are accepted as arguments, or via keyword > parameters, which allows to define coordMap. This latter syntax made the > trick: > > AllChem.EmbedMultipleConfs(m, num_confs, pruneRmsThresh=0.1, > coordMap=coord_dict) > > > The keyword definition doesn’t not accept the definition of the algorithm > to generate conformers. I have here a question. Which algorithm is used to > generate the conformer. If I recall properly, in the last UGM it was > mentioned that ETKDGv2 is the now the default. > > Thanks a lot for the help. > > Cheers, > > -- > José > > On 25. January 2019 at 17:50:46, Greg Landrum (greg.land...@gmail.com) > wrote: > > Dear José. > > What's going on here is that the conformers that come out are not aligned > to the template coordinates. So they reproduce the distances between the > points, but are (rigidly) shifted in space. You just need to align the > results. Here's a demo of how to do this: > https://gist.github.com/greglandrum/59935a9f3100cdfaba280816d417e0a1 > > I hope this helps, > -greg > > > On Fri, Jan 25, 2019 at 10:39 AM José A. <sjojungf...@gmail.com> wrote: > >> Dear RDKitters, >> >> I haven't still been able to solve the problem of generating conformers >> with EKDG while fixing some atoms. I feel that the syntax I'm using to call >> EmbedMultipleConfs is not appropriate: >> >> Chem.rdDistGeom.EmbedMultipleConfs(m, num_confs, pruneRmsThresh=0.1, >> coordMap=coord_dict, params=AllChem.ETKDGv2()) >> >> So defined, the coordMap parameter is not recognised. >> >> Could Greg or some other assist with the right syntax so that >> EmbedMultipleConfs recognises the coordMap parameter? Or could you tell me >> the file in the source code where this function is defined so I can look up >> the right syntax? >> >> I really appreciate your support. >> >> Thanks a lot for the help. >> >> Cheers, >> >> José >> >> >> >> On Thu, Nov 15, 2018 at 10:26 PM Jose A. <sjojungf...@gmail.com> wrote: >> >>> Dear Paolo, >>> >>> Thanks for your reply. I tried your suggestion and aligned the >>> conformers with either AlignMol and AlignMolConformers. However I got the >>> same results. I attach the test I performed on aspirin. The atoms I >>> actually freeze are the O of the ester function and the O of the OH of the >>> carboxylic acid. My program generates 4 conformers for aspirin. As you can >>> see, two conformers preserve the initial conformation but in the other two, >>> the OH of the carboxylic is rotated wrt the ester. >>> >>> I think the problem lies on the syntax of the coordMap definition and >>> that is not really read. I used the syntax: >>> >>> EmbedMultipleConfs( (Mol)mol, (int)numConfs, (EmbedParameters)params) -> >>> _vecti >>> >>> and defined the coordMap as a value of the EmbedParameters object: >>> >>> ps = AllChem.ETKDGv2() >>> ps.pruneRmsThresh = 0.1 # Disabling pruning by RMS, very little distorted >>> geometries >>> # wrt the first conformer are discarded >>> ps.numThreads = 0 >>> if fixed_atoms is None: >>> AllChem.EmbedMultipleConfs(m, num_confs, ps) >>> else: >>> coord_dict = dict() >>> for idx in fixed_atoms: >>> atom = idx - 1 >>> coord_dict[atom] = atomic_positions[atom] >>> ps.coordMap = coord_dict >>> print(ps) >>> print("Fixing coordinates of atoms:", coord_dict) >>> AllChem.EmbedMultipleConfs(m, num_confs, ps) >>> >>> Revising the documentation I found that this object lacks of coordMap. >>> Therefore my instruction ps.coordMap is not really interpreted. >>> >>> However, if I try to call EmbedMultipleConfs by: >>> >>> Chem.rdDistGeom.EmbedMultipleConfs(m, num_confs, pruneRmsThresh=0.1, >>> coordMap=coord_dict) >>> >>> I get the following error. >>> >>> Chem.rdDistGeom.EmbedMultipleConfs(m, num_confs, pruneRmsThresh=0.1, >>> coordMap=coord_dict) >>> TypeError: No registered converter was able to produce a C++ rvalue of >>> type RDGeom::Point3D from this Python object of type list >>> >>> If I try to pass an EmbedParameters object with: >>> >>> Chem.rdDistGeom.EmbedMultipleConfs(m, num_confs, pruneRmsThresh=0.1, >>> coordMap=coord_dict, params=AllChem.ETKDGv2()) >>> >>> I get the following error: >>> >>> Boost.Python.ArgumentError: Python argument types in >>> rdkit.Chem.rdDistGeom.EmbedMultipleConfs(Mol, int) >>> did not match C++ signature: >>> EmbedMultipleConfs(RDKit::ROMol {lvalue} mol, unsigned int numConfs, >>> RDKit::DGeomHelpers::EmbedParameters {lvalue} params) >>> EmbedMultipleConfs(RDKit::ROMol {lvalue} mol, unsigned int >>> numConfs=10, unsigned int maxAttempts=0, int randomSeed=-1, bool >>> clearConfs=True, bool useRandomCoords=False, double boxSizeMult=2.0, bool >>> randNegEig=True, unsigned int numZeroFail=1, double pruneRmsThresh=-1.0, >>> boost::python::dict {lvalue} coordMap={}, double forceTol=0.001, bool >>> ignoreSmoothingFailures=False, bool enforceChirality=True, int >>> numThreads=1, bool useExpTorsionAnglePrefs=False, bool >>> useBasicKnowledge=False, bool printExpTorsionAngles=False) >>> >>> Any further hints? >>> >>> Thanks for the help. >>> -- >>> José >>> >>> On 15. November 2018 at 00:05:31, Paolo Tosco ( >>> paolo.tosco.m...@gmail.com) wrote: >>> >>> Dear Jose, >>> >>> you need to AlignMol your conformers onto the original coordinates of >>> your constrained core using the mapped atoms as superimposition points. In >>> fact, the internal coordinates of the constrained core are preserved, but >>> the Cartesian coordinates may be different. An AlignMol() operation should >>> give you what you are looking for. >>> >>> Cheers, >>> p. >>> >>> On 11/14/18 21:37, Jose A. wrote: >>> >>> Dear RDKitters, >>> >>> I am writing a code to generate conformers of a given molecule >>> constraining some atoms to occupy fixed positions with the coordMap option. >>> However, the coordMap option does not see to work, as in the conformers >>> generated the constraint atoms are at very different positions in each >>> conformer. I use the following code: >>> >>> def gen_confs(mol, fixed_atoms = None, atomic_positions = None): >>> num_confs = 50 >>> print("%i initial configurations tried for the conformer search" % >>> num_confs) >>> ps = AllChem.ETKDG() >>> ps.pruneRmsThersh = 0.1 # Disabling pruning by RMS, very little >>> distorted geometries # wrt the first conformer are >>> discarded ps.numThreads = 0 if fixed_atoms is None: >>> AllChem.EmbedMultipleConfs(m, num_confs, ps) >>> else: >>> coord_dict = dict() >>> for idx in fixed_atoms: >>> atom = idx - 1 coord_dict[atom] = >>> atomic_positions[atom] >>> ps.coordMap = coord_dict >>> print("Fixing coordinates of atoms:", coord_dict) >>> AllChem.EmbedMultipleConfs(m, num_confs, ps) >>> >>> def cluster_confs(mol, rms): >>> dm = AllChem.GetConformerRMSMatrix(mol) >>> rms_clusters = Butina.ClusterData(dm, mol.GetNumConformers(), rms,\ >>> isDistData = True, reordering = True) >>> clustered_mol = Chem.Mol(mol) >>> clustered_mol.RemoveAllConformers() >>> centroid_ids = list() >>> >>> for cluster in rms_clusters: >>> centroid_ids.append(cluster[0]) >>> >>> cidx = 0 for idx in centroid_ids: >>> clustered_mol.AddConformer(mol.GetConformer(idx)) >>> Chem.Conformer.SetId(clustered_mol.GetConformer(idx), cidx) >>> cidx += 1 print('{:d} distinct conformers >>> generated'.format(clustered_mol.GetNumConformers())) >>> return clustered_mol >>> >>> smi = "CC(=O)Oc1c(C(=O)O)cccc1"fixed_atoms = [4, 8] >>> atomic_positions = [[0.9348789, 0.03381682, -0.838997], [-2.0378193, >>> 2.60057272, 0.27807491]] >>> >>> gen_confs(m, fixed_atoms = fixed_atoms, atomic_positions = atomic_positions) >>> rms_cluster = 1.clustered_mol = cluster_confs(m, rms_cluster) >>> >>> Is there something wrong with the code? Any suggestion is really >>> appreciated. >>> >>> Thanks a lot. >>> -- >>> José >>> >>> >>> >>> >>> _______________________________________________ >>> Rdkit-discuss mailing >>> listRdkit-discuss@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/rdkit-discuss >>> >>> >>> _______________________________________________ >> Rdkit-discuss mailing list >> Rdkit-discuss@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss >> >
_______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss