Previous Thread
Next Thread
Print Thread
Joined: Feb 2009
Posts: 83
B
blubbi Offline OP
Forum Member
OP Offline
Forum Member
B
Joined: Feb 2009
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

Joined: Sep 2003
Posts: 8,658
Likes: 26
rmv Online Content
Forum Member
Online Content
Forum Member
Joined: Sep 2003
Posts: 8,658
Likes: 26
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

Joined: Sep 2003
Posts: 8,658
Likes: 26
rmv Online Content
Forum Member
Online Content
Forum Member
Joined: Sep 2003
Posts: 8,658
Likes: 26
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

Joined: Feb 2009
Posts: 83
B
blubbi Offline OP
Forum Member
OP Offline
Forum Member
B
Joined: Feb 2009
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

Last edited by blubbi; 08/09/10 09:54 AM.
Joined: Sep 2003
Posts: 8,658
Likes: 26
rmv Online Content
Forum Member
Online Content
Forum Member
Joined: Sep 2003
Posts: 8,658
Likes: 26
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

Joined: Sep 2003
Posts: 8,658
Likes: 26
rmv Online Content
Forum Member
Online Content
Forum Member
Joined: Sep 2003
Posts: 8,658
Likes: 26
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

Joined: Feb 2009
Posts: 83
B
blubbi Offline OP
Forum Member
OP Offline
Forum Member
B
Joined: Feb 2009
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

Last edited by blubbi; 08/26/10 09:46 AM.

Moderated by  lennart, rmv 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.5
(Release build 20201027)
Responsive Width:

PHP: 7.3.31-1~deb10u5 Page Time: 0.017s Queries: 28 (0.012s) Memory: 0.7619 MB (Peak: 0.8282 MB) Data Comp: Off Server Time: 2023-09-30 03:32:26 UTC
Valid HTML 5 and Valid CSS