Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update clustenm for openmm 8 #1971

Open
jamesmkrieger opened this issue Oct 9, 2024 · 0 comments
Open

update clustenm for openmm 8 #1971

jamesmkrieger opened this issue Oct 9, 2024 · 0 comments

Comments

@jamesmkrieger
Copy link
Contributor

I spotted when trying to integrate ANMD that ClustENM is having problems with openmm 8.1.2, so we should stick to openmm 7.6 for now

The first problem is that we can't give platform properties is platform is none:

clustenm.run(n_modes=2, n_confs=5, n_gens=2, maxclust=2)
@> Kirchhoff was built in 0.03s.
@> Generation 0 ...
@> Minimization, heating-up & simulation in generation 0 ...
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[26], line 1
----> 1 clustenm.run(n_modes=2, n_confs=5, n_gens=2, maxclust=2)

File ~/software/scipion3/software/em/prody-github/ProDy/prody/dynamics/clustenm.py:1186, in ClustENM.run(self, cutoff, n_modes, gamma, n_confs, rmsd, n_gens, maxclust, threshold, solvent, sim, force_field, temp, t_steps_i, t_steps_g, outlier, mzscore, **kwargs)
   1184     LOGGER.info('Minimization in generation 0 ...')
   1185 LOGGER.timeit('_clustenm_min')
-> 1186 potential, conformer = self._min_sim(self._atoms.getCoords())
   1187 if np.isnan(potential):
   1188     raise ValueError('Initial structure could not be minimized. Try again and/or check your structure.')

File ~/software/scipion3/software/em/prody-github/ProDy/prody/dynamics/clustenm.py:320, in ClustENM._min_sim(self, coords)
    317 except ImportError:
    318     raise ImportError('Please install PDBFixer and OpenMM 7.6 in order to use ClustENM.')
--> 320 simulation = self._prep_sim(coords=coords)
    322 # automatic conversion into nanometer will be carried out.
    323 # simulation.context.setPositions(coords * angstrom)
    325 try:

File ~/software/scipion3/software/em/prody-github/ProDy/prody/dynamics/clustenm.py:303, in ClustENM._prep_sim(self, coords, external_forces)
    300 elif self._platform in ['CUDA', 'OpenCL']:
    301     properties = {'Precision': 'single'}
--> 303 simulation = Simulation(modeller.topology, system, integrator,
    304                         platform, properties)
    306 simulation.context.setPositions(modeller.positions)
    308 return simulation

File ~/software/miniconda/envs/prody-github/lib/python3.9/site-packages/openmm/app/simulation.py:100, in Simulation.__init__(self, topology, system, integrator, platform, platformProperties, state)
     98 if platform is None:
     99     if platformProperties is not None:
--> 100         raise ValueError('Cannot specify platform-specific properties, because the Platform is not specified')
    101     ## The Context containing the current state of the simulation
    102     self.context = mm.Context(self.system, self.integrator)

ValueError: Cannot specify platform-specific properties, because the Platform is not specified

Fixing that, I then get a problem with units so minimisation still fails:

In [3]: from prody import parsePDB

In [4]: atoms = parsePDB('1ewkB_modeller.pdb')
@> 3785 atoms and 1 coordinate set(s) were parsed in 0.03s.

In [5]: num_modes=2

In [6]: max_rmsd=4.5

In [7]: tolerance=10.

In [8]: dir_name=None

In [9]: solvent='imp'; force_field=None

    ...:             raise ValueError('force_field tuple should have 2 elements')
    ...:         if not isinstance(force_field[0], str) or not isinstance(force_field[1], str):
    ...:             raise TypeError('force_field tuple entries should be strings')
    ...: 
    ...:     pdb_name=atoms.getTitle().replace(' ', '_')
    ...: 
    ...:     if dir_name is None:
    ...:         dir_name=pdb_name+'_alt_conf_rmsd'+str(max_rmsd)+'_tolerance'+str(tolerance)
    ...: 
    ...:     dir_name2=pdb_name+'_nomin_alt_conf_rmsd'+str(max_rmsd)+'_tolerance'+str(tolerance)
    ...: 
    ...:     clustenm=ClustENM()
    ...:     clustenm.setAtoms(atoms) # includes fixing missing side chain and hydrogen atoms
Warning: importing 'simtk.openmm' is deprecated.  Import 'openmm' instead.
@> Fixing the structure ...
@> 7479 atoms and 1 coordinate set(s) were parsed in 0.05s.
@> The structure was fixed in 3.91s.

In [11]:     clustenm._sol = solvent if clustenm._nuc is None else 'exp'
    ...:     if clustenm._sol == 'imp':
    ...:         clustenm._force_field = ('amber99sbildn.xml',
    ...:                                  'amber99_obc.xml') if force_field is None else force_field
    ...:     if clustenm._sol == 'exp':
    ...:         clustenm._force_field = ('amber14-all.xml',
    ...:                                  'amber14/tip3pfb.xml') if force_field is None else force_field
    ...: 
    ...:     potential, conformer = clustenm._min_sim(clustenm._atoms.getCoords())
@> WARNING OpenMM exception: Unit "kilojoule/mole" is not compatible with Unit "kilojoule/(nanometer*mole)". so the corresponding conformer will be discarded!

This gives potential = nan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant