Closed jandom closed 12 years ago
I made ITPdata.data a managed attribute (reading ITPdata.data) because I wanted to shield it from accidental changes and I wanted to parse/cache the records lazily. Of course you can change individual elements by accessing data[:] but you cannot grow/reassign the recarray as you want to.
You could simply add a method
set_data(self, data):
self.__data = data
(or add a fset
method to the property). The ITPdata.set_data
method would have the advantage that it makes explicit that you're doing something rather hack-ish here.
I can't think of a easy way to create an empty ITP structure with, say a fixed number of atoms, bonds, dihedrals etc. The code was not designed with this in mind, sorry. But if you come up with a sensible rewrite then I am very happy to add it.
Let's go with the set_data then, that looks reasonable.
Ok.
Hi Oli,
I'm attempting to recreate a tool that everybody has - a topolgy merging script. Such script could be used to construct a complete phospholipid lipid topology from tail and head-group topologies, or to attach a lipid anchor to a protein topology.
I've figured out how to change the atoms/bonds/angles and other fields, to ensure a working topology when "n" itp files are merged; however, i'm stuck trying to write out an existing molecule:
Sure, 'data' is an attribute. I don't think this should be changed; I'd rather create an in-memory topology file from scratch. How could one instantiate such a dummy object and fill it with the atom/bond/angles/etc sections created by user?