{"action":"closed","issue":{"url":"https://api.github.com/repos/pytraj/pytraj/issues/523","labels_url":"https://api.github.com/repos/pytraj/pytraj/issues/523/labels{/name}","comments_url":"https://api.github.com/repos/pytraj/pytraj/issues/523/comments","events_url":"https://api.github.com/repos/pytraj/pytraj/issues/523/events","html_url":"https://github.com/pytraj/pytraj/issues/523","id":93973255,"number":523,"title":"what's new","user":{"login":"hainm","id":4451957,"avatar_url":"https://avatars.githubusercontent.com/u/4451957?v=3","gravatar_id":"","url":"https://api.github.com/users/hainm","html_url":"https://github.com/hainm","followers_url":"https://api.github.com/users/hainm/followers","following_url":"https://api.github.com/users/hainm/following{/other_user}","gists_url":"https://api.github.com/users/hainm/gists{/gist_id}","starred_url":"https://api.github.com/users/hainm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hainm/subscriptions","organizations_url":"https://api.github.com/users/hainm/orgs","repos_url":"https://api.github.com/users/hainm/repos","events_url":"https://api.github.com/users/hainm/events{/privacy}","received_events_url":"https://api.github.com/users/hainm/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-07-09T06:58:05Z","updated_at":"2015-07-12T23:42:27Z","closed_at":"2015-07-12T23:42:27Z","body":"### support string mask and array-mask for most of pytraj calculation.\r\n`(07-09-2015)`\r\n\r\n* calc_jcoupling\r\n```python\r\nIn [8]: pt.calc_jcoupling(traj, ':3-7')[0]\r\nOut[8]:\r\n<pytraj.array.DataArray: size=10, key=THR:3_HA-CA-CB-HB, dtype=float32, ndim=1>\r\nvalues:\r\n[ 2.23212647  0.74871767  9.29722214  9.31067276  9.12228203  9.2781868\r\n  7.73652697  9.33726883  7.81325817  8.82886505]\r\n\r\nIn [9]: indices\r\nOut[9]: array([ 37,  38,  39, ..., 108, 109, 110])\r\n\r\nIn [10]: pt.calc_jcoupling(traj, indices)[0]\r\nOut[10]:\r\n<pytraj.array.DataArray: size=10, key=THR:3_HA-CA-CB-HB, dtype=float32, ndim=1>\r\nvalues:\r\n[ 2.23212647  0.74871767  9.29722214  9.31067276  9.12228203  9.2781868\r\n  7.73652697  9.33726883  7.81325817  8.82886505]\r\n```\r\n\r\nwhere `indices` is similar to `atom_indices` in `mdtraj`.\r\n\r\n* rmsd\r\n```python\r\nIn [13]: pt.rmsd(traj, mask=[0, 5, 8])\r\nOut[13]:\r\narray([  1.04477021e-04,   1.47252858e-01,   5.10274623e-02,\r\n         3.93252889e-02,   4.26393624e-02,   5.11736383e-02,\r\n         2.02085530e-02,   1.57345439e-02,   6.51517868e-02,\r\n         3.08103397e-02])\r\n\r\nIn [14]: pt.rmsd(traj, mask=\"@1,6,9\")\r\nOut[14]:\r\narray([  1.04477021e-04,   1.47252858e-01,   5.10274623e-02,\r\n         3.93252889e-02,   4.26393624e-02,   5.11736383e-02,\r\n         2.02085530e-02,   1.57345439e-02,   6.51517868e-02,\r\n         3.08103397e-02])\r\n```\r\n\r\n* distance\r\n```python\r\nIn [33]: pt.distance(traj, '@2 @3')\r\nOut[33]:\r\narray([ 1.5654015 ,  1.64738735,  1.57970842,  1.58422811,  1.62185271,\r\n        1.70217518,  1.68401503,  1.67934319,  1.6281608 ,  1.69595361])\r\n\r\nIn [34]: pt.distance(traj, [1, 2])\r\nOut[34]:\r\narray([[ 1.5654015 ],\r\n       [ 1.64738735],\r\n       [ 1.57970842],\r\n       [ 1.58422811],\r\n       [ 1.62185271],\r\n       [ 1.70217518],\r\n       [ 1.68401503],\r\n       [ 1.67934319],\r\n       [ 1.6281608 ],\r\n       [ 1.69595361]])\r\n\r\nIn [35]: pt.distance(traj, [[1, 2], [8,9]])\r\nOut[35]:\r\narray([[ 1.5654015 ,  2.03200257],\r\n       [ 1.64738735,  2.03791449],\r\n       [ 1.57970842,  2.03800926],\r\n       ...,\r\n       [ 1.67934319,  1.99721433],\r\n       [ 1.6281608 ,  1.98635603],\r\n       [ 1.69595361,  2.11291366]])\r\n```\r\n\r\nMy motivation for this is amber mask is too long for simple mask, such as '@1 @2' vs [1, 2]. And too much `@` makes script look not very pretty. However, amber mask is very powerful for complicated mask, such as ':1 :2'. So I implement both mask types.\r\n\r\nPS: I also want to give credit to `mdtraj` since I find it convenient to use array-mask for simple case when playing with it. \r\n\r\n**TODO** add mask = an array of strings too.\r\n```python\r\nIn [38]: pt.distance(traj, [':2 :3', '@4 @7'])\r\nOut[38]:\r\narray([[ 6.17554905,  6.32215072,  6.29471347, ...,  6.27913704,\r\n         6.36268277,  6.28279934],\r\n       [ 2.78077699,  2.49659225,  2.8758351 , ...,  2.92945951,\r\n         2.6963403 ,  2.75728637]])\r\n```"}}