Skip to content

How to get forces (and other quantities) for a set of tags #1707

Answered by joaander
trvsst asked this question in Support
Discussion options

You must be logged in to vote

The filter attribute of GSD applies to the particles section of the GSD file. GSD writes all logger provided quantities exactly as they are provided. To log a subset of particle energies, provide the expected array to the logger:

import copy

class LogSubset:
    def __init__(self, lj, tags):
        self.lj = lj
        self.tags = copy.copy(tags)
    
     @property
     def energies(self):
        return self.lj.energies[self.tags]


log_subset = LogSubset(lj, [0, 1, 2])
logger[('energies')] = (log_subset, 'energies', 'sequence')

Replies: 5 comments 8 replies

Comment options

You must be logged in to vote
3 replies
@trvsst
Comment options

@trvsst
Comment options

@joaander
Comment options

Comment options

You must be logged in to vote
3 replies
@joaander
Comment options

@trvsst
Comment options

@joaander
Comment options

Comment options

You must be logged in to vote
1 reply
@joaander
Comment options

Comment options

You must be logged in to vote
1 reply
@trvsst
Comment options

Answer selected by joaander
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Support
Labels
None yet
2 participants