Skip to content

RDF calculation for MultiSystem #356

Answered by AnuragKr
AnuragKr asked this question in Q&A
Discussion options

You must be logged in to vote

Final Solution --
We need to take the weighted average. And weight will be - frame_no * atom_no
Code --

def get_systems(path):
    return [dpdata.LabeledSystem(os.path.join(path, s), fmt='deepmd/npy') for s in os.listdir(path)]

if __name__ == '__main__':
    import dpdata
    systems = get_systems('./data')
    weights = []
    rdf_list = []
    for sys in systems:
        coord_dim = sys['coords'].shape
        frame_num = coord_dim[0]
        atom_num = coord_dim[1]
        weights.append(frame_num*atom_num)
        xx,rdf_values,_ = rdf(sys, sel_type = [0,0], max_r = 6, nbins = 100)
        rdf_list.append(rdf_values)
    rdf = np.average(rdf_list, axis=0, weights=weights)
    res = np.

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
5 replies
@AnuragKr
Comment options

@wanghan-iapcm
Comment options

@AnuragKr
Comment options

@wanghan-iapcm
Comment options

@AnuragKr
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by AnuragKr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants