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

PDB animations? #267

Closed
thomashrabe opened this issue Jan 24, 2017 · 4 comments
Closed

PDB animations? #267

thomashrabe opened this issue Jan 24, 2017 · 4 comments

Comments

@thomashrabe
Copy link

Looking into 3DMol to replace our JSMol visualization.
Does 3DMol display animations as we do here?

http://pdbflex.org/cluster.html#!/4hn4A/20981/1a50A

If yes, I would switch immediately.

@dkoes
Copy link
Contributor

dkoes commented Jan 24, 2017

Sure, if you have multiple frames you can animate like this:
http://3dmol.csb.pitt.edu/tests/auto/generate_test.cgi?test=test39
or if you have vibration vectors you can animate like this:
http://3dmol.csb.pitt.edu/tests/auto/generate_test.cgi?test=test36
(view source to see the implementation).

@dkoes dkoes closed this as completed Jan 24, 2017
@Jack-XHP
Copy link

Hello, want to ask some additional question about animations. I have a look at the source code and find the multiple frames are from a single downloaded file. Right now I have a list of mol2 files. How can I add them manually as each frame? I try to use addModelsAsFrames call for each file. Yet it only results in overlapping all molecules together into one frame instead of an animation. BTW I use py3Dmol.

for i in range(10):
    if os.path.isfile('{}.mol2'.format(i)):
        with open('{}.mol2'.format(i), 'r') as content_file:
            mol = content_file.read()
        view.addModelsAsFrames(mol, 'mol2')
view.animate({'loop': 'forward'})
view.setStyle({'stick':{}})
view.setStyle({'model':0},{'stick':{'colorscheme':'cyanCarbon'}})
view.zoomTo()
view.show()```

@dkoes
Copy link
Contributor

dkoes commented Jan 23, 2020

I would put all your data into a single string and addModelsAsFrames with that. You'll probably have to pass multimodel:true as an option (can't test it right now - let me know if it works).

@Jack-XHP
Copy link

Thanks for you help, It works perfectly by simply concat all mol2 file together and put them in one addModelsAsFrames

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

3 participants