Acellera / htmd

HTMD: Programming Environment for Molecular Discovery
https://software.acellera.com/docs/latest/htmd/index.html
Other
253 stars 58 forks source link

Charmm file error on membrane build #1042

Closed shozebhaider closed 1 year ago

shozebhaider commented 1 year ago

Hello Support team,

I am trying to do a membrane build using the example

from htmd.membranebuilder.build_membrane import listLipids, buildMembrane

# List all available lipids
listLipids()
# Define the dimensions of the membrane in the x and y axis in units of Angstrom
dimensions = [170, 170]
# Define the upper and lower layer lipid composition and ratio
ratioupper = {'popc': 8,'chl1':2}
ratiolower = {'popc': 8,'chl1':2}
# Build the membrane
memb = buildMembrane(dimensions, ratioupper, ratiolower, waterbuff=20.0)
# Visualize the membrane
memb.view()

However, I get this charmm file error:

CharmmFileError: [Errno 2] No such file or directory: '/home/shozeb/miniconda3/envs/htmd/lib/python3.10/site-packages/htmd/share/membranebuilder/charmm-toppar/par_all36m_prot.prm'

This is incorrect as I have all the relevant files in this directory. Do I need to explicitly provide a path to my files?

Many thanks for your help.

Best wishes

Shozeb

stefdoerr commented 1 year ago

Hi Shozeb, this is weird, what version of HTMD are you using? conda list htmd

shozebhaider commented 1 year ago

Hi @stefdoerr I am using HTMD 2.2.0

stefdoerr commented 1 year ago

Can you post the whole error that it generated?

shozebhaider commented 1 year ago
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
File ~/miniconda3/envs/htmd/lib/python3.10/site-packages/openmm/app/internal/charmm/_charmmfile.py:62, in CharmmFile.__init__(self, fname, mode)
     61 try:
---> 62     self._handle = open(fname, mode, encoding='utf-8')
     63 except IOError as e:

FileNotFoundError: [Errno 2] No such file or directory: '/home/shozeb/miniconda3/envs/htmd/lib/python3.10/site-packages/htmd/share/membranebuilder/charmm-toppar/par_all36m_prot.prm'

During handling of the above exception, another exception occurred:

CharmmFileError                           Traceback (most recent call last)
File <timed exec>:11

File ~/miniconda3/envs/htmd/lib/python3.10/site-packages/htmd/membranebuilder/build_membrane.py:326, in buildMembrane(xysize, ratioupper, ratiolower, waterbuff, minimplatform, equilibrate, equilplatform, outdir, lipidf)
    324 outpdb = tempname(suffix=".pdb")
    325 charmmf = os.path.join(home(shareDir=True), "membranebuilder", "charmm-toppar")
--> 326 equilibrateSystem(
    327     os.path.join(outdir, "structure.pdb"),
    328     os.path.join(outdir, "structure.psf"),
    329     outpdb,
    330     charmmfolder=charmmf,
    331     equilplatform=equilplatform,
    332     minimplatform=minimplatform,
    333 )
    334 res = Molecule(outpdb)
    335 res.center()

File ~/miniconda3/envs/htmd/lib/python3.10/site-packages/htmd/membranebuilder/simulate_openmm.py:96, in equilibrateSystem(pdbfile, psffile, outpdb, numsteps, minimplatform, equilplatform, device, temp, minimize, minimizetol, charmmfolder)
     93 pdb = app.PDBFile(pdbfile)
     94 psf.setBox(celld[0], celld[1], celld[2])
---> 96 params = _readCharmmParameters(charmmfolder, defaultCharmmFiles)
     98 system = psf.createSystem(
     99     params,
    100     nonbondedMethod=app.PME,
    101     nonbondedCutoff=1 * unit.nanometer,
    102     constraints=app.HBonds,
    103 )
    104 system.addForce(mm.MonteCarloBarostat(1 * unit.atmospheres, temp * unit.kelvin, 25))

File ~/miniconda3/envs/htmd/lib/python3.10/site-packages/htmd/membranebuilder/simulate_openmm.py:55, in _readCharmmParameters(folder, listfile)
     53 elif isinstance(listfile, list):
     54     files = [os.path.join(folder, f) for f in listfile]
---> 55 return app.CharmmParameterSet(*files)

File ~/miniconda3/envs/htmd/lib/python3.10/site-packages/openmm/app/charmmparameterset.py:148, in CharmmParameterSet.__init__(self, *args, **kwargs)
    145     raise TypeError('Unrecognised named argument')
    147 for top in tops: self.readTopologyFile(top)
--> 148 for par in pars: self.readParameterFile(par, permissive=permissive)
    149 for strf in strs: self.readStreamFile(strf)

File ~/miniconda3/envs/htmd/lib/python3.10/site-packages/openmm/app/charmmparameterset.py:219, in CharmmParameterSet.readParameterFile(self, pfile, permissive)
    217 if isinstance(pfile, str):
    218     own_handle = True
--> 219     f = CharmmFile(pfile)
    220 else:
    221     own_handle = False

File ~/miniconda3/envs/htmd/lib/python3.10/site-packages/openmm/app/internal/charmm/_charmmfile.py:64, in CharmmFile.__init__(self, fname, mode)
     62     self._handle = open(fname, mode, encoding='utf-8')
     63 except IOError as e:
---> 64     raise CharmmFileError(str(e))
     65 self.closed = False
     66 self.line_number = 0

CharmmFileError: [Errno 2] No such file or directory: '/home/shozeb/miniconda3/envs/htmd/lib/python3.10/site-packages/htmd/share/membranebuilder/charmm-toppar/par_all36m_prot.prm'
stefdoerr commented 1 year ago

Indeed it's a mistake of mine. Can you unzip this file into: /home/shozeb/miniconda3/envs/htmd/lib/python3.10/site-packages/htmd/share/membranebuilder/charmm-toppar/ par_all36m_prot.zip

shozebhaider commented 1 year ago

Dear Stefan,

I shall indeed. However, I thought my miniconda might be broken, so I am reinstalling everything afresh. I shall update here as soon it the installation comes out of the infinite dependency searching mode.

stefdoerr commented 1 year ago

No everything was fine, I just forgot to add that file in some previous release to the folder. I will make a new release the following days which will have it but in the meanwhile add it manually to the path which the error points to

shozebhaider commented 1 year ago

Thanks @stefdoerr. Everything is working fine now.