Topic Options
#25065 - 08/08/10 02:11 PM Transit from all27ff to all36ff and adjust MASS ID
blubbi Offline
Forum Member

Registered: 02/19/09
Posts: 83
Hi all,

I hacked together this little python script, which converts from all27ff to all36ff without invoking CHARMM.

Another task it can do for you is to adjust the MASS IDs in the PSF to the topology (rtf) file you provide. This comes in handy if you merged some topology files and the MASS IDs have changed and you need to adjust them.

All the script needs is a RTF and your PSF and optionally the according CRD file.

It reads the RTF file and replaces current values in your PSF/CRD with those read from the RTF. So it also takes care of changes in the RTF additionally to renaming PC residues to the new naming scheme. The renaming can be omitted with the "-s" switch if you only want to adept your PSF to a modified RTF.

Well, so much in theory. It works for my test files.
Please use it careful and report back if it breaks something.

Furthermore I didn't test the "Extended" PSF format and since I had to reassemble the column layout from the Fortran source, there might be glitches.

As said, it worked for my files.

So please give it a shot and report back so I can fix the remaining glitches.

The file can be downloaded from here:
http://olausson.de/scriptarchive/16-modeling/75-psfftpy
(Scroll to the bottom of the page to download the src file)


Code:
Usage: psfft.py [options]

Options:
  -h, --help  show this help message and exit
  -p FILE     Old PSF file. [REQUIRED]
  -c FILE     CRD (human readable) file. [OPTIONAL]
  -r FILE     Path to RTF file. [REQUIRED]
  -a FILE     Supplementary rtf or toppar stream file. Can be used more then once. [OPTIONAL]
  -o FILE     Name of the new PSF and/or CRD file [REQUIRED]
  -s          Skip conversion from c27ff to c36ff. Usefull for merged FFs
              where the MASS ID changed. [OPTIONAL]



Cheers
Bjoern

Top
#25066 - 08/08/10 03:36 PM Re: Transit from all27ff to all36ff and adjust MASS ID [Re: blubbi]
rmv Online   content

Forum Member

Registered: 09/17/03
Posts: 8373
Loc: 39 03 48 N, 77 06 54 W
It should be noted that this appears to be specifically targeted toward the new "all36_lipid" parameters (presumably what is meant by "all36ff"), and the renaming of alpha chain atoms for POPC and DOPC to conform to other PC lipids. When changing to a new RTF/PARAM file pair, making a new PSF is the recommended pathway, in case there are other changes which impact the PSF, as there are in this case. In most cases, manipulation of the PSF directly is highly discouraged.
_________________________
Rick Venable
computational chemist


Top
#25067 - 08/08/10 06:04 PM Re: Transit from all27ff to all36ff and adjust MASS ID [Re: rmv]
rmv Online   content

Forum Member

Registered: 09/17/03
Posts: 8373
Loc: 39 03 48 N, 77 06 54 W
The one thing I'm aware of that is definitely a problem are the "all36_lipid" charge changes, which I believe are mostly confined to the carboxyl ester groups. Since charges are stored in the PSF, one converted with the above Python script will be missing a significant change.
_________________________
Rick Venable
computational chemist


Top
#25070 - 08/09/10 05:50 AM Re: Transit from all27ff to all36ff and adjust MASS ID [Re: rmv]
blubbi Offline
Forum Member

Registered: 02/19/09
Posts: 83
RMV, in reply to your two previous posts:

Maybe i wasn't clear enough or I misunderstand you now.
My script parses all info from the RTF file, including charges and masses, and replaces them in the old PSF. Without applying the parameters of the provided RTF the conversion would not be complete.

The steps:
1) Read old PSF
2) Rename *PC residues to new naming convention
3) Get parameters for all atoms (including the renamed one's) from the provided RTF file
4) Do step 2 and 3 with CRD file if provided
5) Write PSF and CRD if provided

I converted one PSF from all27_lipid to all36_lipid with CHARMM (convert_lipid_c27_c36_xopc.str) and one with the script and they are (except for some float representations) identical.

So CHARGE and MASS are taken from RTF an replaced in the PSF so everything is up to date.

Only if someone made changes to the MASS or CHARGE in the PSF, it will be reverted to those values from the RTF.

By the way, you can give it any RTF ans skip the conversion to the new *PC naming scheme.

Cheers
Bjoern


Edited by blubbi (08/09/10 05:54 AM)

Top
#25073 - 08/09/10 02:31 PM Re: Transit from all27ff to all36ff and adjust MASS ID [Re: blubbi]
rmv Online   content

Forum Member

Registered: 09/17/03
Posts: 8373
Loc: 39 03 48 N, 77 06 54 W
I seem to have misread that part of the original post, and I don't have any Python experience; my apologies for that. I still think the best course of action when switching to a new RTF/PARAM file pair is to make a new PSF, whether it's with CHARMM or a NAMD related tool. For POPC and/or DOPC some atom names must be changed when adopting all36_lipid, but a simple 'sed' script based on the CHARMM stream file should suffice for most coordinate formats. Change the atom names in a coord file, make a new PSF, and the conversion is complete.
_________________________
Rick Venable
computational chemist


Top
#25104 - 08/11/10 03:28 PM Re: Transit from all27ff to all36ff and adjust MASS ID [Re: rmv]
rmv Online   content

Forum Member

Registered: 09/17/03
Posts: 8373
Loc: 39 03 48 N, 77 06 54 W
I've posted a 'sed' script for the DOPC/POPC alpha chain rename here in the Script Archive.

Also, I believe patch processing may be a weakness of the above Python script; charges are often changed in patches, e.g. taking the charge from atom SG of cysteine would be wrong if the DISUlfide patch has been applied. The problem is that there is no direct record in the PSF of any patches that have been used. I'm also aware of a situation where a PRES in a new parameter release added an improper torsion which had been omitted; the Python script does not appear to check for these types of changes at all.

Consequently, I still recommend the simple two step process of converting the names in the coordinate file, then making a new PSF for that coordinate file.
_________________________
Rick Venable
computational chemist


Top
#25184 - 08/26/10 05:45 AM Re: Transit from all27ff to all36ff and adjust MASS ID [Re: rmv]
blubbi Offline
Forum Member

Registered: 02/19/09
Posts: 83
Originally Posted By: rmv

[...]
Also, I believe patch processing may be a weakness of the above Python script; charges are often changed in patches, e.g. taking the charge from atom SG of cysteine would be wrong if the DISUlfide patch has been applied. The problem is that there is no direct record in the PSF of any patches that have been used. I'm also aware of a situation where a PRES in a new parameter release added an improper torsion which had been omitted; the Python script does not appear to check for these types of changes at all.
[...]


Aiii right.

Since I never stumbled upon these cases I totally neglected them.

But as you said, since there is no record for a patch in the PSF this most likely can't be catched by my script :-(

Thanks,
Bjoern


Edited by blubbi (08/26/10 05:46 AM)

Top

Moderator:  chmgr, John Legato, petrella