Re: [AMBER] setangle in parmed API

From: <hannes.loeffler.stfc.ac.uk>
Date: Wed, 26 Mar 2014 16:24:47 +0000

I think what I am trying to create is AngleType(99.9, 99.9, -1) and this one doesn't exist yet in my parmtop. The 'if not exists' check in class setangle is true, so the new type should be in parm.angle_type_list. But apparently it is not, at least not when the new parm is written out.

________________________________________
From: Jason Swails [jason.swails.gmail.com]
Sent: 26 March 2014 16:00
To: amber.ambermd.org
Subject: Re: [AMBER] setangle in parmed API

On Wed, 2014-03-26 at 15:01 +0000, hannes.loeffler.stfc.ac.uk wrote:
> Hi,
>
> I keep wondering why in the attached code the setbond class creates a
> new bond type (with proper linkage) as expected but the same doesn't
> seem to work for setangle. The output parm mod.parm7 appears to have
> effectively the same angle entries.

setAngle and setBond are not guaranteed to create new types. New
bond/angle types are only created if the type you try to add is
different from every other type already in the topology file.

You can use the "printAngles" and "printBonds" command in ParmEd to take
a look at the bond and angle definitions that are present for a given
mask selection. These should be able to tell you whether or not the
desired bonds and/or angles were added.
>
> Many thanks,
> Hannes.
>
>
> from chemistry.amber.readparm import AmberParm
> import ParmedTools.ParmedActions as pact
>
>
> parm = AmberParm('test.parm7')
> atom_name = parm.parm_data['ATOM_NAME']
>
> for atom in parm.atom_list:
> idx = atom.starting_index
>
> if atom_name[idx].startswith('DU'):

Just an FYI: atom instances have an "atname" and "attype" attribute that
can be used here rather than doing lookups in the ATOM_NAME array. I
wish now that those attributes were "name" and "type" instead, but what
can you do...

> for bond in atom.bonds:
> idx1 = bond.atom1.starting_index + 1
> idx2 = bond.atom2.starting_index + 1
>
> act = pact.setbond(parm, '.%i .%i %f %f' % (idx1, idx2, 99.9, 0.999) )
> act.execute()
>
> if atom_name[idx].startswith('DU'):
> for ang in atom.angles:
> idx1 = ang.atom1.starting_index + 1
> idx2 = ang.atom2.starting_index + 1
> idx3 = ang.atom3.starting_index + 1
>
> act = pact.setangle(parm, '.%i .%i .%i %f %f' % (idx1, idx2, idx3,
> 99.9, 99.9) )
> act.execute()
>
> parm.overwrite = True
> parm.writeParm('mod.parm7')

Comments and suggestions about the ParmEd API are welcome (and
appreciated).

Thanks!
Jason

--
Jason M. Swails
BioMaPS,
Rutgers University
Postdoctoral Researcher
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
-- 
Scanned by iCritical.
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Wed Mar 26 2014 - 10:00:02 PDT
Custom Search