Re: Generate psf file in x-plor format

From: Vermaas, Joshua (Joshua.Vermaas_at_nrel.gov)
Date: Thu Nov 17 2016 - 18:56:55 CST

Ok, Nehad sent me the offending files, and its a psfgen problem. Solvate calls psfgen again, and when it tries to read the psf, here is where it runs into problems (in psf_file.c):

if (sscanf(atype, "%d", &i) > 0) {
    fprintf(stderr, "PSF file is in CHARMM format; XPLOR format required.\n");
    return -1;
}

For the uninitiated, sscanf will return something greater than 0 whenever a digit is the first character of what would otherwise be an alphanumeric string. Nehad has two atomtypes that qualify, 2C and 3C. To work around this, temporarily rename the atomtypes.

mol load psf xxxx.psf pdb xxxx.pdb
set allsel [atomselect top "all"]
$allsel moveby [vecscale -1 [measure center $allsel]]
set renamelist [list 2C 3C]
set counter 0
foreach t $renamelist {
set sel [atomselect top "type $t"]
$sel set type "tmp$counter"
incr counter
$sel delete
}
animate write psf tmp.psf
animate write pdb tmp.pdb

package require solvate
solvate tmp.psf tmp.pdb -minmax [list [list -40 -40 -40] [list 40 40 40]] -o tmp-wb

mol load psf tmp-wb.psf pdb tmp-wb.pdb
set counter 0
foreach t $renamelist {
set sel [atomselect top "type tmp$counter"]
$sel set type "$t"
incr counter
$sel delete
}
#Insertion codes don't seem to be handled very well, but your input pdb has atoms in the right place. Just update the positions from the loaded structure.
set opsel [atomselect 0 "all"]
set psel [atomselect top "not water"]
foreach el [list x y z] {
$psel set $el [$opsel get $el]
}
animate write psf xxxx-wb.psf
animate write pdb xxxx-wb.pdb

This would be almost correct, except that solvation in this case seems to handle insertion codes less-than-gracefully, and as a result, you have some waters that are going to be very close your insertion-coded protein pieces. Remove them with a within selection and be happy.

set keepsel [atomselect top "not (water and same residue as within 1.4 of protein)"]
$keepsel writepsf final.psf
$keepsel writepdb final.pdb

Note that you might also want to ionize before you rename the types again, since that will run you into the same problems with autoionize that you did with solvate, since they'll both call psfgen.

-Josh

On 11/17/2016 04:00 PM, Nehad Elsalamouny wrote:
Hi Josh,

The psf file is not truncated. I have just sent part of it as I couldn't send it all (file is too big). I reran the script and still getting that same error: PSF file is in CHARMM format; XPLOR format required.

And in VMD TkConsole I get:

Info) generating solute plus one replica of water...
psfgen) reading structure from psf file xxxx.psf
psfgen) error reading atoms from psf file

MOLECULE DESTROYED BY FATAL ERROR! Use resetpsf to start over.

Thanks,

Nehad

On 18 Nov 2016, at 7:56 AM, Vermaas, Joshua <Joshua.Vermaas_at_nrel.gov<mailto:Joshua.Vermaas_at_nrel.gov>> wrote:

Hi Nehad,

Take a look at the end of the psf file you sent. Its truncated midway through line 344. Your script to generate the psf looks solid, so I don't know how this happened. The truncation would be why solvate won't work on it. Did the psfgen script give you any errors? This is definitely weird, but might go away if you just rerun the generation script.
-Josh

On 11/17/2016 01:47 PM, Nehad Elsalamouny wrote:
  Hi Josh,

  Thanks for your email. I got the rtf file from http://mackerell.umaryland.edu/charmm_ff.shtml, downloaded toppar_c36_jul16.tgz<http://mackerell.umaryland.edu/download.php?filename=CHARMM_ff_params_files/toppar_c36_jul16.tgz> and used the parm14sb_all.rtf file in non-charmm folder.
  Atomtypes are alphanumeric. Part of the psf file is attached. I don't know what is the problem!

  Kind regards,

  Nehad

This archive was generated by hypermail 2.1.6 : Tue Dec 27 2016 - 23:22:37 CST