{"id":8914,"date":"2023-03-01T11:23:38","date_gmt":"2023-03-01T11:23:38","guid":{"rendered":"https:\/\/www.blopig.com\/blog\/?p=8914"},"modified":"2023-03-03T14:37:23","modified_gmt":"2023-03-03T14:37:23","slug":"writing-vector-trajectories-with-cpptraj","status":"publish","type":"post","link":"https:\/\/www.blopig.com\/blog\/2023\/03\/writing-vector-trajectories-with-cpptraj\/","title":{"rendered":"Writing &#8220;vector trajectories&#8221; with cpptraj"},"content":{"rendered":"\n<p>The program cpptraj, written by Daniel Roe (https:\/\/github.com\/Amber-MD\/cpptraj) and distributed Open Source with the AmberTools package (https:\/\/ambermd.org\/AmberTools.php), is a powerful tool for analysis of molecular dynamics simulations. In addition to all of the expected analyses like Root Mean Square Deviation and native contacts, cpptraj also includes a suite of vector algebra functions. <\/p>\n\n\n\n<p>While this vector algebra functionality is fairly well known and easy to find in the documentation, I think it is less well known that cpptraj can write trajectories of the computed vectors. These trajectories can then be loaded into Visual Molecular Dynamics (VMD) alongside the analysed trajectory and played as a movie. This functionality is a valuable tool for debugging your vector calculations to make sure they are doing precisely what you intend. It may also prove useful for generating visualizations of vectors alongside molecular structures for publications. <\/p>\n\n\n\n<p>The cpptraj script below reads in an Amber parameter file and coordinate file and then calculates the angle between two planes. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>parm 7bbg_fixed.prmtop\r\ntrajin 7bbg_fixed.rst7\r\nvector v1 mask :65@NH1 :65@NH2\r\nvector v2 mask :65@NH1 :65@NE\r\nvector v3 mask :64@CA :66@CA\r\nvector v4 mask :66@CA :68@CA\r\nvectormath vec1 v1 vec2 v2 crossproduct name n1\r\nvectormath vec1 v3 vec2 v4 crossproduct name n2\r\nvectormath vec1 n1 vec2 n2 dotangle out 7bbg_ref_plane_angle.dat\r<\/code><\/pre>\n\n\n\n<p>The first plane is defined by two vectors in the plane of the guanidino group of a R65 residue (v1 and v2); the second plane is defined by two vectors between CA atoms of amino acids in the alpha helix containing R65 (v3 and v4). The first two vectormath calls determine the normal vectors to the planes and the final vectormath line computes the angle between the normal vectors. Taken together, these commands compute the angle between the arginine side chain and a plane passing through the CA atoms of the alpha helix. Let&#8217;s check that the vectors {v1, v2, v3, v4} are being computed correctly. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>parm 7bbg_fixed.prmtop\r\ntrajin 7bbg_fixed.rst7\r\nvector v1 mask :65@NH1 :65@NH2\r\nvector v2 mask :65@NH1 :65@NE\r\nvector v3 mask :64@CA :66@CA\r\nvector v4 mask :66@CA :68@CA\r\nrun\r\nwritedata vectors.mol2 v1 v2 v3 v4 vectraj trajfmt mol2\r<\/code><\/pre>\n\n\n\n<p>The resulting vector trajectory vectors.mol2 can be loaded directly into VMD without a topology. Note that in this case we only analyzed a single frame, but you can run this same procedure on DCD files, too. This is what I get when I load the vectors into VMD alongside the structure:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2023\/03\/vector_figure.png?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"625\" height=\"236\" loading=\"lazy\" src=\"https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2023\/03\/vector_figure.png?resize=625%2C236&#038;ssl=1\" alt=\"\" class=\"wp-image-9365\" srcset=\"https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2023\/03\/vector_figure.png?resize=1024%2C387&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2023\/03\/vector_figure.png?resize=300%2C113&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2023\/03\/vector_figure.png?resize=768%2C290&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2023\/03\/vector_figure.png?resize=624%2C236&amp;ssl=1 624w, https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2023\/03\/vector_figure.png?w=1112&amp;ssl=1 1112w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/a><figcaption class=\"wp-element-caption\">The vectors are shown as red\/pink line segments. The right structure is identical to the left but with the alpha helix cartoon model removed. The blue spheres indicate the locations of the CA atoms used to define the plane of the helix.<\/figcaption><\/figure>\n\n\n\n<p>I hope this vector trajectory functionality will be helpful to a few people who like to neurotically check their analyses like I do. You can download the example prmtop and rst7 files below. Note that you should rename them to remove the extra &#8220;.txt&#8221; file extension before attempting to use them for anything. <\/p>\n\n\n\n<p>The information in this blog post is adapted from an Amber Archive post from Daniel Roe, dated 30-Oct-2018: http:\/\/archive.ambermd.org\/201811\/0058.html<\/p>\n\n\n\n<p>Files for the example: <\/p>\n\n\n\n<div class=\"wp-block-file\"><a id=\"wp-block-file--media-6fd6a641-b06a-4d1f-a87b-37e21774e786\" href=\"https:\/\/www.blopig.com\/blog\/wp-content\/uploads\/2023\/03\/7bbg_fixed.rst7_.txt\">7bbg_fixed.rst7_<\/a><a href=\"https:\/\/www.blopig.com\/blog\/wp-content\/uploads\/2023\/03\/7bbg_fixed.rst7_.txt\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-6fd6a641-b06a-4d1f-a87b-37e21774e786\">Download<\/a><\/div>\n\n\n\n<div class=\"wp-block-file\"><a id=\"wp-block-file--media-1bb39690-4d34-456b-bc37-090354f11d9e\" href=\"https:\/\/www.blopig.com\/blog\/wp-content\/uploads\/2023\/03\/7bbg_fixed.prmtop.txt\">7bbg_fixed.prmtop<\/a><a href=\"https:\/\/www.blopig.com\/blog\/wp-content\/uploads\/2023\/03\/7bbg_fixed.prmtop.txt\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-1bb39690-4d34-456b-bc37-090354f11d9e\">Download<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The program cpptraj, written by Daniel Roe (https:\/\/github.com\/Amber-MD\/cpptraj) and distributed Open Source with the AmberTools package (https:\/\/ambermd.org\/AmberTools.php), is a powerful tool for analysis of molecular dynamics simulations. In addition to all of the expected analyses like Root Mean Square Deviation and native contacts, cpptraj also includes a suite of vector algebra functions. While this vector [&hellip;]<\/p>\n","protected":false},"author":69,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","wikipediapreview_detectlinks":true,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"ngg_post_thumbnail":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[647],"tags":[705,139,706,707,708],"ppma_author":[542],"class_list":["post-8914","post","type-post","status-publish","format-standard","hentry","category-molecular-dynamics","tag-analysis","tag-molecular-dynamics","tag-trajectory","tag-vector","tag-vector-trajectory"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"authors":[{"term_id":542,"user_id":69,"is_guest":0,"slug":"dan","display_name":"Daniel Nissley","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/fd064a72579f11063ca36621317b744b6bc9df79116bc01af9b57f531bf10662?s=96&d=mm&r=g","0":null,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/posts\/8914","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/users\/69"}],"replies":[{"embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/comments?post=8914"}],"version-history":[{"count":5,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/posts\/8914\/revisions"}],"predecessor-version":[{"id":9373,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/posts\/8914\/revisions\/9373"}],"wp:attachment":[{"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/media?parent=8914"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/categories?post=8914"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/tags?post=8914"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=8914"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}