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.
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.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
for i, atom in enumerate(entry.molecule.components.atoms):
atom.coordinates = (-mol2.atoms[i].coordinates+2*pseudo_inv, -mol2.atoms[i].coordinates+2*pseudo_inv, -mol2.atoms[i].coordinates+2*pseudo_inv) #this is the point I want to specify slightly different atomic coordinates for component 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?
Code sample from the terminal:
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
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.
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.label gives me the label etc., but mymolecule.atoms.occupancy returns error.
Additional question: How to understand from stereochemistry point of view atom chirality flag valued 'Mixed'?
Thanks in advance,