Re: [AMBER] how to remove/delete bonds w/ cpptraj or parmed in pytraj ??

From: Daniel Roe via AMBER <amber.ambermd.org>
Date: Wed, 12 Jul 2023 09:40:45 -0400

Hi,

If you need to stay in the python universe, maybe you could use parmed
to write out the modified topology and then load that into pytraj? I
put the 'change' command into cpptraj mostly for my own convenience -
I'm not sure how well that functionality is supported in pytraj.

-Dan

On Mon, Jul 10, 2023 at 3:35 PM Thomas C. Bishop via AMBER
<amber.ambermd.org> wrote:
>
> Dear Amber,
> I want to delete bonds in my topology file and then run some analysis
> using pytraj but can't figure out how to do it.
>
> Can you help me?
> See below
> Thanks
> Tom
>
>
> This CPPTRAJ script works!
>
> cpptraj sys.parm7
> change removebonds :358.O3' :1.P
> change removebonds :716.O3' :359.P
> parmwrite out new.sys.parm7
> quit
>
>
> BUT trying to do something similar in pytraj does not work
>
> nano 195% python3
> Python 3.6.15 (default, Sep 23 2021, 15:41:43) [GCC] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import numpy as np
> >>> import pytraj as pt
> >>> import pandas as pd
> >>> import glob
> >>> ######################
> ... top = pt.load_topology('sys.parm7')
> >>> top
> <Topology: 54271 atoms, 2664 residues, 18 mols, non-PBC>
> >>> cpptrajtext = '''
> ... change removebonds :358.O3' :1.P
> ... change removebonds :716.O3' :359.P
> ... '''
> >>> pt.io.load(cpptrajtext)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/lib64/python3.6/site-packages/pytraj/io.py", line 124, in load
> traj = load_traj(filename, top, stride=stride)
> File "/usr/lib64/python3.6/site-packages/pytraj/io.py", line 242, in
> load_traj
> top = load_topology(filename)
> File "/usr/lib64/python3.6/site-packages/pytraj/io.py", line 527, in
> load_topology
> 'n_atoms = 0: make sure to load correct Topology filename '
> RuntimeError: n_atoms = 0: make sure to load correct Topology filename
> or load supported topology (pdb, amber parm, psf, ...)
> >>> parmedtext='''
> ... deleteBond :716.O3' :359.P
> ... deleteBond :358.O3' :1.P
> ... '''
> >>> pt.io.load_parmed(parmedtext)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File
> "/usr/lib64/python3.6/site-packages/pytraj/externals/load_other_packages.py",
> line 22, in load_parmed
> from parmed.amber import AmberParm
> File "/usr/lib64/python3.6/site-packages/parmed/__init__.py", line 21,
> in <module>
> from . import unit, utils
> File "/usr/lib64/python3.6/site-packages/parmed/utils/__init__.py",
> line 4, in <module>
> from ..topologyobjects import Atom
> File "/usr/lib64/python3.6/site-packages/parmed/topologyobjects.py",
> line 9, in <module>
> from functools import cached_property
> ImportError: cannot import name 'cached_property'
> >>>
>
> _______________________________________________
> AMBER mailing list
> AMBER.ambermd.org
> http://lists.ambermd.org/mailman/listinfo/amber

_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Wed Jul 12 2023 - 07:00:02 PDT
Custom Search