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

Attachment: out_03.xyz
Description: Binary data

Attachment: out_02.xyz
Description: Binary data

Attachment: out_01.xyz
Description: Binary data

Attachment: out_00.xyz
Description: Binary data

Attachment: initial.xyz
Description: Binary data

_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to