Accessing calculation data directly from python

70 views
Skip to first unread message

Jens

unread,
Mar 1, 2014, 5:51:33 PM3/1/14
to hoomd...@googlegroups.com
Hi,

Is it possible to access calculated properties (e.g. the potential energy of a group of particles) directly from python?

I can create a compute thermo and get the data I want printed to a log file with code like the below:

b1 = group.tag_list(name='b1', tags=[0,1,2,3,4,5,6,7,8,9] )
c1 = compute.thermo(group=b1)
analyze.log(filename='mylog.log',
                   quantities=['pair_lj_energy',
                                      'pair_lj_energy',
                                      'potential_energy',
                                      'potential_energy_b1'],
                    period=10, header_prefix='#')

However what I would really like to do is to access (e.g.) the potential energy for the whole system and group b1 after the simulation has finished directly from python - something like c1.getPotentialEnergy().

Is there any way to do this?

Many thanks,

Jens

Jens Glaser

unread,
Mar 1, 2014, 5:59:25 PM3/1/14
to hoomd...@googlegroups.com
Hi Jens

what you are looking for is described here:


basically you want to do

#setup logger
logger=analyze.log(filename='mylog.log', quantities=['pair_lj_energy','pair_lj_energy','potential_energy','potential_energy_b1'],period=10, header_prefix='#')

#run simulation
run(100)

# query potential energy
pe_c1 = logger.query('potential_energy_b1')
pe = logger.query('potential_energy')

best
Jens

Is there any way to do this?

Many thanks,

Jens

--
You received this message because you are subscribed to the Google Groups "hoomd-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hoomd-users...@googlegroups.com.
To post to this group, send email to hoomd...@googlegroups.com.
Visit this group at http://groups.google.com/group/hoomd-users.
For more options, visit https://groups.google.com/groups/opt_out.

Jens

unread,
Mar 2, 2014, 6:30:49 AM3/2/14
to hoomd...@googlegroups.com
Hi Jens,

Thanks - that's just what I was after!

Best wishes,

Jens
Reply all
Reply to author
Forward
0 new messages