Closed OkKakao closed 2 years ago
Hi @OkKakao,
Thanks for the detailed writeup!
The AmberTools package can provide AM1BCC charges without an OpenEye license - The problem with your code above is that the way that the packages are installed in your colab code doesn't make AmberTools accessible (if I look at the conda output, ambertools is installed, it just isn't found at runtime)
I'm not a total expert in colab, but one thing I keep hearing is to "use condacolab" to help get complex conda environments set up on colab. So, updating your example for condacolab gives me cells that look like this:
!pip install -q condacolab
import condacolab
condacolab.install()
(there's a bunch of scary looking output here, and colab says "the runtime crashed" or something, but that's condacolab working as intended)
import sys
print(sys.version)
#!wget https://repo.anaconda.com/miniconda/Miniconda3-py37_4.10.3-Linux-x86_64.sh
#!bash Miniconda3-py*.sh -bfp /usr/local
!conda config --set always_yes yes
!conda config --add channels conda-forge
!mamba install git jupyterlab numpy pandas scipy matplotlib ipympl rdkit openbabel openmm mdtraj pymbar pdbfixer parmed openff-toolkit openmoltools openmmforcefields openmmtools
#sys.path.append('/usr/local/envs/openmm/lib/python3.7/site-packages')
import openmm.testInstallation
openmm.testInstallation.main()
!wget https://github.com/openforcefield/openff-toolkit/files/8480803/BNZ4.zip
!unzip BNZ4.zip
from openmm.app import *
from openmm import *
from openmm.unit import *
from sys import stdout
from openff.toolkit.topology import Molecule
from openmmforcefields.generators import SMIRNOFFTemplateGenerator
# Create an OpenFF Molecule object for benzene from SMILES
molecule = Molecule.from_smiles('c1ccccc1')
# Create the SMIRNOFF template generator with the default installed force field (openff-1.0.0)
smirnoff = SMIRNOFFTemplateGenerator(molecules=molecule)
# Create an OpenMM ForceField object with AMBER ff14SB and TIP3P with compatible ions
forcefield = ForceField('amber14/protein.ff14SB.xml', 'amber14/tip3p.xml')
# Register the SMIRNOFF template generator
forcefield.registerTemplateGenerator(smirnoff.generator)
pdb = PDBFile('BNZ4.pdb')
system = forcefield.createSystem(pdb.topology, nonbondedMethod=NoCutoff, nonbondedCutoff=1*nanometer, constraints=HBonds)
integrator = LangevinMiddleIntegrator(300*kelvin, 1/picosecond, 0.004*picoseconds)
simulation = Simulation(pdb.topology, system, integrator)
simulation.context.setPositions(pdb.positions)
simulation.minimizeEnergy()
simulation.reporters.append(PDBReporter('output.pdb', 1000))
simulation.reporters.append(StateDataReporter(stdout, 1000, step=True,
potentialEnergy=True, temperature=True))
print(pdb.positions)
simulation.step(10000)
And then everything seems to run just fine :-)
Could you try this out and let me know if it resolves your issue?
It worked! I was really frustrated because of this problem. I truly appreciate for helping me. Thanks a lot!
I'm trying to simulate small molecule with openmm. Therefore, forcefield generation for those molecules is necessary. I found that it is possible with GAFF and SMINOFF, however, it was not working since RDkit was not compatible with am1bcc method.
I'm currently working on colab, and installed openmm with following command
Also, my code is the following.
If i execute it, the following error pops up
It seems like RDkit is not compatible with am1bcc charge generation method. I requested the license of openeye module, however, it takes several weeks to verify my qualification. How can I resolve this problem? It took me a couple of weeks but still not working... BNZ4.zip