Repository 'mmpbsa_mmgbsa'
hg clone https://toolshed.g2.bx.psu.edu/repos/chemteam/mmpbsa_mmgbsa

Changeset 4:879662481176 (2021-03-12)
Previous changeset 3:cf2be7b90ea5 (2021-02-16) Next changeset 5:2c62c4422f7a (2021-06-09)
Commit message:
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit cc13bd32ef2d80b01dc197a3ca120a4ff9f0dacc"
modified:
template_parmconv.j2
added:
parmconv.py
b
diff -r cf2be7b90ea5 -r 879662481176 parmconv.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/parmconv.py Fri Mar 12 12:32:51 2021 +0000
[
@@ -0,0 +1,82 @@
+import argparse
+import io
+import sys
+from contextlib import redirect_stdout
+
+import parmed
+from parmed import amber, gromacs
+from parmed.tools.changeradii import ChRad
+
+
+def parse_command_line(argv):
+    parser = argparse.ArgumentParser()
+    parser.add_argument('--istr', help='input structure', required=True)
+    parser.add_argument('--itop', help='input topology file', required=True)
+    parser.add_argument('--istripmask', help='stripmask')
+    parser.add_argument('--iradii', required=True, help='parmed radii are \
+                        GB_RADII amber6,bondi, mbondi, mbondi2, mbondi3')
+    parser.add_argument('--removedihe', action='store_true',
+                        default=False, help='remove dihedrals with zero \
+                        periodicity')
+    parser.add_argument('--removebox', action='store_true',
+                        default=False, help='remove periodic box info')
+    parser.add_argument('--o_prmtop', help='AMBER output topology',
+                        required=True)
+    return parser.parse_args()
+
+
+def get_ids(dihedrals):
+    """
+    goes through dihedrals and looks for any with per=0.
+    returns a reverse sorted list of ids to be removed.
+    """
+    indices = []
+    for k, v in enumerate(dihedrals):
+        f = io.StringIO()
+        with redirect_stdout(f):
+            print(v)
+        if f.getvalue().find("per=0") != -1:
+            indices.append(k)
+    indices.sort(reverse=True)
+    return indices
+
+
+args = parse_command_line(sys.argv)
+
+gmx_top = gromacs.GromacsTopologyFile(args.itop)
+gmx_gro = gromacs.GromacsGroFile.parse(args.istr)
+
+if not args.removebox:
+    # keep box info
+    gmx_top.box = gmx_gro.box
+    gmx_top.positions = gmx_gro.positions
+
+
+if args.removedihe:
+    ids_to_remove = get_ids(gmx_top.dihedrals)
+    print("Original number of dihedrals %i" % len(gmx_top.dihedrals))
+    for i in ids_to_remove:
+        gmx_top.dihedrals.pop(i)
+    print("Update number of dihedrals %i" % len(gmx_top.dihedrals))
+
+if args.istripmask is not None:
+    if args.istripmask == "":
+        pass
+    else:
+        gmx_top.strip(args.istripmask)
+
+radii = str(args.iradii)
+parmed.tools.changeRadii(gmx_top, radii)
+amb_prm = amber.AmberParm.from_structure(gmx_top)
+parmed.tools.changeRadii(amb_prm, radii)
+
+if args.removebox:
+    amb_prm.pointers['IFBOX'] = 0
+
+ChRad(amb_prm, radii)
+for i, atom in enumerate(amb_prm.atoms):
+    amb_prm.parm_data['RADII'][i] = atom.solvent_radius
+    amb_prm.parm_data['SCREEN'][i] = atom.screen
+
+
+amb_prm.write_parm(args.o_prmtop)
b
diff -r cf2be7b90ea5 -r 879662481176 template_parmconv.j2
--- a/template_parmconv.j2 Tue Feb 16 21:57:02 2021 +0000
+++ b/template_parmconv.j2 Fri Mar 12 12:32:51 2021 +0000
b
@@ -2,9 +2,9 @@
 {% if fmt == 'AMBER' %}
 parm {{ top_in }}
 {% elif fmt == 'GROMACS' %}
-gromber {{ top_in }} {{gro_in}}
+gromber {{ top_in }} {{str_in}}
 {% elif fmt == 'CHARMM' %}
-chamber {{ top_in }} {{gro_in}}
+chamber {{ top_in }} {{str_in}}
 {% else %}
 parm {{ top_in }}
 {% endif %}