[lammps-users] angle_write?

Dear LAMMPS users,

Is there a function to write on a file the energy vs angle data for an angular potential?

What I’m looking for is something like an “angle_write” function analogous to the existing “pair_write” and “bond_write”.

Best regards,

Valerio

Nope.

You could emulate this with a loop using displace_atoms and run 0

for future reference, e.g. if somebody googles this topic. here is a simple demonstration that will output the data in a convenient to use yaml file:

atom_style angle
region box block -10 10 -10 10 -10 10

create_box 1 box angle/types 1 extra/angle/per/atom 1 extra/special/per/atom 2

create_atoms 1 single -1.0 0.0 0.0
create_atoms 1 single 0.0 0.0 0.0
create_atoms 1 single 1.0 0.0 0.0
create_bonds single/angle 1 1 2 3

mass 1 1.0
pair_style none
bond_style none
angle_style harmonic
angle_coeff 1 100 120.0

variable maxloop index 1000
variable i loop 0 ${maxloop}
variable angle equal (180.0*v_i/v_maxloop)
variable xval atom cos(PI/180.0*v_angle)
variable yval atom sin(PI/180.0*v_angle)
variable file string angle_scan.yaml

run 0 post no
shell rm -f ${file}
print "---" screen no file ${file}

label scan
set atom 1 x v_xval y v_yval
run 0 post no
print """
- step: ${i}
angle: ${angle}
energy: $(eangle)""" screen no append ${file}
next i
jump SELF scan

to read this file in python one simply can do:

import yaml

with open("angle_scan.yaml") as f:
data = yaml.load(f,Loader=yaml.FullLoader)

# show data from some step
print(data[20])

Dear Axel,

Thank you very much for the reply.

Would it be simple to implement an “angle_write” by adapting the script for bond_write or pair_write, or is there some complication I haven’t considered?
If it’s not too complicated, I may try to do it as soon as I have some time.

Best regards,

Valerio

Dear Axel,

Thank you very much for the reply.

Would it be simple to implement an “angle_write” by adapting the script for bond_write or pair_write, or is there some complication I haven’t considered?

the Angle::single() function does not compute a force and thus you cannot do things the same way as for pair and bond.