Open hgandhi2411 opened 4 years ago
Hi all. I'm working on a first pass at something like this, though it's not a deep network yet (but could become one). I'm posting a "working" example in the attached zip. I have a few different energy layers that are based on the TrainableLJ layer from the Force Matching Notebook, including LJ, bonds, angles and dihedrals. For the first pass I'm naively trying to directly fit the coefficients of these for the CG particles in a polymer system. For simplicity it's only using the LJ energy layer right now, but feel free to uncomment the others as you like.
The issue I'm having is that regardless of which layer or combo of layers I run, I always get
IndexError: list index out of range
when running the simulation. Some googling turned up that this can be an issue with the input dimensions for the TF model, but I thought the inputs were determined by HOOMD-TF, so I'm not sure what's wrong with them. Would love another pair of eyes or two to help out on this one.
To reproduce the error:
cd
into itconda update -f environment.yaml
on the env file from uli-initpip install -e .
in uli-initpython HTF_CG_MWE.py
Hey @RainierBarrett. What version of tensorflow were you using?
I also forgot to include the .py file! I'll attach here. TF Version: 2.4.0 HOOMD-blue version: 2.9.3 HTF_CG_MWE.py.txt
I'm guessing this is related to #285 which was merged in a few hours ago? Try updating to latest or downgrading TF to 2.3.2.
Great, that pull fixed the issue. Now I just have to make my dimensions match with the CG energies for training. I'll keep you posted.
Good news! I have a working CG model example which can be found in the script here. If you want to run it, the required files '1-length-4-peek-para-only.gsd' and '100-length-4-peek-para-only-production.gsd' can be generated with the following code (make sure to clone from my branch/fork):
import uli_init.simulate as simulate
import hoomd
system = simulate.System(molecule='PEEK', para_weight=1.0,
density=0.8, n_compounds=[100],
polymer_lengths=[4], forcefield='gaff',
assert_dihedrals=True, remove_hydrogens=True)
sim = simulate.Simulation(system, gsd_write=1000, mode='gpu', dt=0.0001)
sim.quench(kT=1., n_steps=1e4, shrink_steps=1e4)
... with n_compounds
set to 1 and 100, respectively, and renaming the resulting 'sim_traj.gsd' files accordingly. I'll also attach them for convenience.
The specific system used in my example doesn't really matter as much for this issue, and the uli-init code is only a wrapper for setting up polymer sims quickly. The relevant model-building code starts on line 131
I've been running this code from a docker container but this may not run on all machines. I had to compile TF from source and this image was compiled only for specific CUDA compute-capable devices (6.0 & 7.0).
All this to say, this should provide a scaffold to put together an example notebook with, if you guys want to slot this into your workflow instead!
Let's wait for TF 2.0 port for this one, as that will make it much easier. You could start though with creating layers