I am not sure this actually makes sense to implement, partly because it would break lots of code that depends on SASMOL, but I wanted to mention the idea of defining a numpy type to store SasMol objects. Here is an example:
particle_dtype = numpy.dtype({'names':['x','y','z','mass','resid','atom','name'],
'formats':[numpy.double,
numpy.double,
numpy.double,
numpy.double,
numpy.int,
'U1',
'U4']})
# create a 10 atom CA backbone
mol = numpy.zeros(10, dtype=particle_dtype)
mol['name'] = 'CA'
mol['atom'] = 'C'
# mol['mass'] = mass_dict['CA'] # could have a dictionary with the mass values for different atom types
# etc ... (only initialized some of the values...)
print(mol)
As is, atom properties are not connected in the code, e.g., an atom's name and coordinates are elements of different data structures. This unifies them.
I am not sure this actually makes sense to implement, partly because it would break lots of code that depends on SASMOL, but I wanted to mention the idea of defining a numpy type to store SasMol objects. Here is an example:
with the output being
As is, atom properties are not connected in the code, e.g., an atom's name and coordinates are elements of different data structures. This unifies them.