• RE: Altering crystal structures

    Thank you! It works. If anybody else at some point looks this up - instead of: new_molecule = molecule.Molecule(original_molecule.identifier) this should be: new_molecule = Molecule(original_molecule.identifier) and of course from ccdc.molecule import Molecule at the top of the script.

  • Altering crystal structures

    Dear experts,

    I am trying to slightly modify crystal structures programmatically. For example, to alter conformation of one component in Z'>1 structures and after that use some features like generating packing shells around that slightly altered molecule etc. I am confused of how to implement my calculated new atomic positions for a specific component. What I am trying is something like this:

    csd = io.EntryReader('CSD')
    entry = csd.entry(some_ref_code)

    print len(entry.molecule.components[0].atoms)
    entry.molecule.components[0].assign_bond_types()
    entry.molecule.components[0].add_hydrogens()
    entry.molecule.components[0].normalise_atom_order()
    entry.molecule.components[0].remove_hydrogens()
    print len(entry.molecule.components[0].atoms) #here it shows the same number as above, so the hydrogens are not being removed? 

    # here mol2 is defined as molecule with all non-hydrogen atoms of entry.molecule.components[0]

    for i, atom in enumerate(entry.molecule.components[0].atoms):
              atom.coordinates = (-mol2.atoms[i].coordinates[0]+2*pseudo_inv[0], -mol2.atoms[i].coordinates[1]+2*pseudo_inv[1], -mol2.atoms[i].coordinates[2]+2*pseudo_inv[2]) #this is the point I want to specify slightly different atomic coordinates for component[0] and after use all packing-based features (search for hydrogen bonds, contacts, etc.)

    What could I do? Should I instead initialize a new Crystal instance with all the essential parameters (unit cell, symmetry) copied from my entry.crystal and then create a molecule object and atom objects with desired coordinates within this new Crystal instance?

  • RE: Python: cannot access atom.occupancy/ General: what is atom.chirality = 'Mixed'?

    Code sample from the terminal:

    >>> entry.molecule.atoms[0].label
    u'S1'
    >>> entry.molecule.atoms[0].occupancy
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    AttributeError: 'Atom' object has no attribute 'occupancy'

    I am using the following:

    LSB Version: n/a
    Distributor ID: ManjaroLinux
    Description: Manjaro Linux
    Release: 18.0.2
    Codename: Illyria

     

    Best regards,

    Toms

  • RE: Python: cannot access atom.occupancy/ General: what is atom.chirality = 'Mixed'?

    Thanks!

    I keep getting the same error using the code specified above, but it should be system-related issue then. I am running everything on Arch Linux (Manjaro) for which the product has not been tested. I should switch to another distribution. Interesting, however, that .occupancy seems to be the only one not being recognized, as every other attribute tested returns the corresponding value without any problem.

  • Python: cannot access atom.occupancy/ General: what is atom.chirality = 'Mixed'?

    I am using Python to access the database. So far I have come across an issue I cannot solve:

    Occupancy of an atom is not accessible. Whenever I try to access it, I get the following error: AttributeError: 'Atom' object has no attribute 'occupancy'. However, this attribute has been specified in Molecule API documentation. Everything works well for other attributes, e.g. mymolecule.atoms[0].label gives me the label etc., but mymolecule.atoms[0].occupancy returns error.

    Additional question: How to understand from stereochemistry point of view atom chirality flag valued 'Mixed'? 

     

    Thanks in advance,

    T.