{"action":"created","issue":{"url":"https://api.github.com/repos/MDAnalysis/mdanalysis/issues/763","repository_url":"https://api.github.com/repos/MDAnalysis/mdanalysis","labels_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/issues/763/labels{/name}","comments_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/issues/763/comments","events_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/issues/763/events","html_url":"https://github.com/MDAnalysis/mdanalysis/issues/763","id":140211713,"number":763,"title":"LAMMPS.DATAWriter and bond types etc.","user":{"login":"khuston","id":4020899,"avatar_url":"https://avatars.githubusercontent.com/u/4020899?v=3","gravatar_id":"","url":"https://api.github.com/users/khuston","html_url":"https://github.com/khuston","followers_url":"https://api.github.com/users/khuston/followers","following_url":"https://api.github.com/users/khuston/following{/other_user}","gists_url":"https://api.github.com/users/khuston/gists{/gist_id}","starred_url":"https://api.github.com/users/khuston/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khuston/subscriptions","organizations_url":"https://api.github.com/users/khuston/orgs","repos_url":"https://api.github.com/users/khuston/repos","events_url":"https://api.github.com/users/khuston/events{/privacy}","received_events_url":"https://api.github.com/users/khuston/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-11T15:25:34Z","updated_at":"2016-03-11T16:22:14Z","closed_at":null,"body":"I would like to write a `LAMMPS.DATAWriter`. Here is a use case:\r\n\r\n    u = mda.Universe('polymer.data', 'coil.dcd')\r\n    for ts in u.trajectory:\r\n        ... analyze the trajectory, decide which frame I'd like to write out as a data file ...\r\n        if save_this_frame:\r\n            with mda.Writer('configuration_xx.data') as W:\r\n                W.write(u.atoms)\r\n\r\nThere are a few concerns I can think of:\r\n\r\n1. I would need to parse bond, angle, dihedral, and improper types with `DATAParser`.\r\n2. Would these types be stored as `Bondtypes`, `Angletypes`, `Dihedraltypes`, `Impropertypes`?\r\n3. Would the current `bond.type` etc. that returns an array of the constituent atom types be overridden? Or would these be some separate attribute of bonds, angles, dihedrals, and impropers?\r\n3. LAMMPS data files can also have numerous coefficients sections. In principle someone might want to read that information and write it again to the DATA file later. Personally, I don't use those sections and would happily ignore them.\r\n4. If someone tries to write a LAMMPS data file based on a topology which doesn't have `Bondtypes`, `Angletypes`, `Dihedraltypes`, `Impropertypes`, should an error result?\r\n\r\nI've tried to catch up with the issue-363 discussion, but I've probably missed a lot, so I apologize if this is misguided."},"comment":{"url":"https://api.github.com/repos/MDAnalysis/mdanalysis/issues/comments/195437572","html_url":"https://github.com/MDAnalysis/mdanalysis/issues/763#issuecomment-195437572","issue_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/issues/763","id":195437572,"user":{"login":"richardjgowers","id":9249543,"avatar_url":"https://avatars.githubusercontent.com/u/9249543?v=3","gravatar_id":"","url":"https://api.github.com/users/richardjgowers","html_url":"https://github.com/richardjgowers","followers_url":"https://api.github.com/users/richardjgowers/followers","following_url":"https://api.github.com/users/richardjgowers/following{/other_user}","gists_url":"https://api.github.com/users/richardjgowers/gists{/gist_id}","starred_url":"https://api.github.com/users/richardjgowers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richardjgowers/subscriptions","organizations_url":"https://api.github.com/users/richardjgowers/orgs","repos_url":"https://api.github.com/users/richardjgowers/repos","events_url":"https://api.github.com/users/richardjgowers/events{/privacy}","received_events_url":"https://api.github.com/users/richardjgowers/received_events","type":"User","site_admin":false},"created_at":"2016-03-11T16:22:14Z","updated_at":"2016-03-11T16:22:14Z","body":"Hey Kyle\r\n\r\nThis would be awesome.  \r\n\r\nI think you're right that you'll need to override the current `.type` behaviour somehow.\r\n\r\nThe current 363 behaviour for atoms is something like sticking whatever we find in a topology file to atoms.  It would be nice to extend this philosophy to bonds too.. but I'll have to think about what this would mean in total.\r\n\r\nIn the short term, you should be able to read the bond types into a dictionary of `{(atom indices): bond type}`, and then write a Writer which accepts this.  I think once we've got a prototype Writer it'll be much clearer what we need to make it work seamlessly.\r\n\r\nSo tl;dr\r\n1 - yes, but you can do a hack job in the short term\r\n2 - ideally in the long run stuck to the bond objects\r\n3 - same as above\r\n4 - eventually it'd be nice to squeeze everything, but lets just get this working\r\n5 - should error if the resulting file doesn't work (`NoDataError: No bond types specified, specify them by ...`)\r\n\r\nMaybe hack together a Writer and we'll see what needs doing"}}