Giter VIP home page Giter VIP logo

hoomd-tf's People

Contributors

dilnoza92 avatar geemi725 avatar hgandhi2411 avatar mchakra2 avatar mehradans92 avatar oktak avatar rainierbarrett avatar saraezzatali avatar whitead avatar ziyueyang37 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

hoomd-tf's Issues

Change c++ local variable syntax

hoomd requires local variables to be prefixed with m_ instead of _ for certain macros to function. We should change over all the local variables to match this syntax.

Add changelog

Create a changelog file with release goals and notes.

Logging output

Currently, hoomd-tf logs quite a bit. It would make sense to only output the TF items to the tf_manager.log and also respect the log-level set in hoomd. We should also go through to make sure the correct log level is being used, especially warnings.

Add support for applying only for groups

One idea is to use masks, but that will not work if particles are sorted or number of particles changes. Perhaps we can trigger an update to masks? Could this be affected by Issue #7?

re: GPU

How did you guys install GPU support for hoomd?

I know this is unrelated to your project, but I figured you must have ran into this issue.

I tried compiling it and get this at the end:

HOOMD-blue v2.8.1-26-gef08be936 CUDA (10.2) DOUBLE HPMC_MIXED MPI SSE SSE2 SSE3 SSE4_1 SSE4_2 AVX AVX2 
Compiled: 11/26/2019
Copyright (c) 2009-2019 The Regents of the University of Michigan.
-----

system has unsupported display driver / cuda driver combination
HOOMD-blue is running on the CPU
<hoomd.context.SimulationContext object at 0x7f2334d383c8>

Standardize Name

Need to consistently choose among hoomd-tf, HOOMD-TF, hoomd_tf, and tensorflow_plugin in all places.

Tutorial Notebooks

Now that we have the ability to create/run models in a single python script, we should make a folder with some example jupyter notebooks. A great start would be the quickstart from the README.

Add Keras README Examples

Add some examples to README about how to use Keras with hoomd-tf, including note that model.compile and model.fit do not work.

Possibility to use forces directly with hoomd-tf

I am new to hoomd-blue and hoomd-tf, and I am learning both at the same time,
I have a tensorflow mdoel that I want to turn into a graphe. My model gets the position of atoms within a cut-off and give back the forces and not the potential. Is it possible to do this with hoomd-tf? For example a modification like below works or not?
Let's say the force is defined as r/norm(r)2, r is the vector between atom i and j,
f_vec = norm(f) * e_r, norm(f) = 1/norm(r)

graph = htf.graph_builder(64) # max neighbors = 64
rinv = graph.nlist_rinv
f = my_tf_model(rinv)
forces = tf.reduce_sum( tf.multiply(f *r, rinv ), axis=-1)# there is mismatch between shape but lets say we solve it, (r is a vector )
graph.save('my_model', forces)

Integrate with conda install

Test out installing hoomd-blue with conda, tensorflow with pip, and see if plugin can be made without compiling hoomd-blue.

Test for reverse_mol_index failing

test_reverse_mol_index in test_utils.py is failing with the following error:

__________________________________ test_mol_batching.test_reverse_mol_index ___________________________________

self = <test_tensorflow.test_mol_batching testMethod=test_reverse_mol_index>

    def test_reverse_mol_index(self):
        # need this for logging
        hoomd.context.initialize()
        mi = [[1, 2, 0, 0, 0], [3, 0, 0, 0, 0], [4, 5, 7, 8, 9]]
        rmi = hoomd.htf._make_reverse_indices(mi)
        # should be
        rmi_ref = [
            [0, 0],
            [0, 1],
            [1, 0],
            [2, 0],
            [2, 1],
            [-1, -1],
            [2, 2],
            [2, 3],
            [2, 4]
        ]
>       self.assertEqual(rmi, rmi_ref)
E       AssertionError: Lists differ: [[0, 0], [0, 1], [1, 0], [2, 0], [2, 1], [-1, -1], [2, 2], [2, 3], [2, 4], []] != [[0, 0], [0, 1], [1, 0], [2, 0], [2, 1], [-1, -1], [2, 2], [2, 3], [2, 4]]
E       
E       First list contains 1 additional elements.
E       First extra element 9:
E       []
E       
E       - [[0, 0], [0, 1], [1, 0], [2, 0], [2, 1], [-1, -1], [2, 2], [2, 3], [2, 4], []]
E       ?                                                                          --- -
E       
E       + [[0, 0], [0, 1], [1, 0], [2, 0], [2, 1], [-1, -1], [2, 2], [2, 3], [2, 4]]

test-py/test_tensorflow.py:527: AssertionError
-------------------------------------------- Captured stdout call ---------------------------------------------
Not all of your atoms are in a molecule

Add example use of eds_bias method

The eds_bias method in utils.py is not used anywhere in the example_models dir โ€“ it appears to be manually implemented instead. The EDS example model directory should show an example use case of this method.

Fix Code Examples

The example code is not very convenient to use, as it expects, for example /scratch/rbarret8/. Some of them use outdated syntax, such as feed_func instead of feed_dict. Update so they all take the directory to save/load from as input.

Fix bug that causes hanging depending on out_nodes list order

If you give a printer node to the out_nodes arg in tensorflow_plugin.graph_builder.graph.save() after the optimizer node, the model will build, but it hangs on the first step of training. Change the code so that it doesn't hang depending on the order of elements in out_nodes.

You can replicate this by running the attached build_test_model.py file with printer after optimizer in the out_nodes list on the last line, then running run_train.py.

build_test_model.py

import tensorflow as tf
import hoomd.tensorflow_plugin as htf

NN = 63
graph = htf.graph_builder(NN, output_forces=False)
r_inv = graph.nlist_rinv
input_tensor = tf.reshape(r_inv, shape=(-1,1), name='r_inv')
weight = tf.Variable([1.0])
nn_energies = tf.identity(r_inv) * weight
calculated_energies = tf.reduce_sum(nn_energies, axis=1, name='calculated_energies')
calculated_forces = graph.compute_forces(calculated_energies)
cost = tf.losses.mean_squared_error(calculated_forces, graph.forces)
printer = tf.Print(cost, [cost], message='cost is: ')
optimizer = tf.train.AdamOptimizer(0.001).minimize(cost)
#change your model_directory as needed
graph.save(model_directory='/scratch/rbarret8/test_model/', out_nodes=[printer, optimizer])

run_train.py

import hoomd, hoomd.md, hoomd.dump, hoomd.group, hoomd.benchmark
import numpy as np
from hoomd.tensorflow_plugin import tfcompute
import tensorflow as tf
from math import sqrt
from sys import argv as argv
import time

if(len(argv) != 2):
    print('Usage: basic_ann_ff.py [N_PARTICLES]')
    exit(0)

N = int(argv[1])


model_dir = '/scratch/rbarret8/test_model/'#change this as needed

np.random.seed(42)


with hoomd.tensorflow_plugin.tfcompute(model_dir, _mock_mode=False, write_tensorboard=True) as tfcompute:
    hoomd.context.initialize('--mode=gpu')
    rcut = 3.0
    sqrt_N = int(sqrt(N))#Make sure N is a perfect square
    
    system = hoomd.init.create_lattice(unitcell=hoomd.lattice.sq(a=2.0),
                                       n=[sqrt_N, sqrt_N])
    nlist = hoomd.md.nlist.cell(check_period = 1)
    lj = hoomd.md.pair.lj(rcut, nlist)#basic LJ forces from HOOMD
    lj.pair_coeff.set('A', 'A', epsilon=1.0, sigma=1.0)
    hoomd.md.integrate.mode_standard(dt=0.005)
    hoomd.md.integrate.langevin(group=hoomd.group.all(), kT=1.0, seed=42)
    #equilibrate for 4k steps first
    hoomd.run(4000)
    #now attach the trainable model
    tfcompute.attach(nlist, r_cut=rcut, save_period=10, period=100)
    #train on 5k timesteps
    hoomd.run(5000)

MPI CG Issue

The current way which coarse-grain mapping is done is by relying on the exact atom ordering. This is an issue when doing domain decomposition since atoms can leave and enter the simulation domain. This also is an issue if the particle sorter is not disabled. Might be related to Issue #6

Cache mol index

Because we transfer the mol index each step to tfmanager, it doesn't know if it can cache mol index or not. We should also pass a flag, to prevent triggering recomputing all the graph opsthat rely on mol index.

Improve unit testing

  • Add C++ tests
  • Add coverage analysis
  • Add timing tests for assessing regression in performance

Checkpoint Convienence

If not all variables are set when bootstrapping, tensorflow fails. Let's make it so you can load some and initialize others.

compute_pairwise_potential improvements

We should add documentation about compute_pairwise_potential to the README in the utilities section. The method should also be improved to return energy and forces, rather than just energy. This could be used to write-out learned potentials into tabular form for use in subsequent simulations.

Cuda requirements

I am using cuda 10 on a cluster, and I get the following error, how can I remove it,

Could NOT find CUDA: Found unsuitable version "9.2", but required is exact
version "9.0" (found /usr/local/cuda-9.2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.