def _write_angle_information(xml_file, structure, ref_energy):
    """Write the angles in the system.

    Parameters
    ----------
    xml_file : file object
        The file object of the hoomdxml file being written
    structure : parmed.Structure
        Parmed structure object
    ref_energy : float, default=1.0
        Reference energy for conversion to reduced units

    """

    unique_angle_types = set()
    xml_file.write('<angle>\n')
    for angle in structure.angles:
        t1, t2, t3 = angle.atom1.type, angle.atom2.type, angle.atom3.type
        t1, t3 = sorted([t1, t3])
        angle_type = ('-'.join((t1, t2, t3)), angle.type.k, angle.type.theteq)
        unique_angle_types.add(angle_type)
        xml_file.write('{} {} {} {}\n'.format(
            angle_type[0], angle.atom1.idx, angle.atom2.idx, angle.atom3.idx))
    xml_file.write('</angle>\n')
    xml_file.write('<angle_coeffs>\n')
    xml_file.write('<!-- type k theta_eq -->\n')
    for angle_type, k, teq in unique_angle_types:
        xml_file.write('{} {} {}\n'.format(angle_type,
            k * 2.0 / ref_energy, radians(teq)))
    xml_file.write('</angle_coeffs>\n')
def _write_angle_information ( xml_file , structure , ref_energy ) : unique_angle_types = set ( ) xml_file . write ( '<angle>\n' ) for angle in structure . angles : t1 , t2 , t3 = angle . atom1 . type , angle . atom2 . type , angle . atom3 . type t1 , t3 = sorted ( [ t1 , t3 ] ) angle_type = ( '-' . join ( ( t1 , t2 , t3 ) ) , angle . type . k , angle . type . theteq ) unique_angle_types . add ( angle_type ) xml_file . write ( '{} {} {} {}\n' . format ( angle_type [ 0 ] , angle . atom1 . idx , angle . atom2 . idx , angle . atom3 . idx ) ) xml_file . write ( '</angle>\n' ) xml_file . write ( '<angle_coeffs>\n' ) xml_file . write ( '<!-- type k theta_eq -->\n' ) for angle_type , k , teq in unique_angle_types : xml_file . write ( '{} {} {}\n' . format ( angle_type , k * 2.0 / ref_energy , radians ( teq ) ) ) xml_file . write ( '</angle_coeffs>\n' )
Write the angles in the system.

    Parameters
    ----------
    xml_file : file object
        The file object of the hoomdxml file being written
    structure : parmed.Structure
        Parmed structure object
    ref_energy : float, default=1.0
        Reference energy for conversion to reduced units