James Irving wrote: > Apologies for my previous post, it was a bit premature - I've answered > my own question, after finding the 'cdpt' member of the python model > class (in model.py). It's is a pointer to the mod_coordinates struct in > C containing the coordinate information, so I've been able to write a > quick C++ function, called from python using the my_model.cdpt pointer, > that reads and changes x,y,z coordinates. Provided changes are made > sensibly and consistently, is this safe to do? I'm assuming any > manipulations at this level would be equivalent to calling model.read() > in the presence of existing coordinate data?
Yes, that should be fine. Both mod_model and mod_structure (the latter is a template structure in an alignment) contain a mod_coordinates structure that contains the atom coordinates. As you discovered, the Python interface maintains a pointer to this structure internally. There are a couple of points to be aware of though. 1- the arrays are all Fortran pointer arrays, but I guess you already discovered the accessor methods to get to these from C code (e.g. mod_float1_pt, mod_float1_get, mod_float1_set). 2- there are currently no methods available to redimension the model structure, so you can't for example add additional residues or atoms. But you can certainly change the xyz coordinates without worrying about ill effects. Do you have a specific goal in mind? I may be able to suggest additional places to look.
Ben Webb, Modeller Caretaker