HEX
Server: Apache
System: Linux b:u:newjapaneti:1 3.10.0-1160.31.1.el7.x86_64 #1 SMP Thu Jun 10 13:32:12 UTC 2021 x86_64
User: newjapaneti (381717)
PHP: 5.6.30
Disabled: apache_get_modules, apache_get_version, apache_reset_timeout, apache_getenv, apache_note, apache_setenv
Upload Files
File: //usr/share/groff/1.22.2/pic/chem.pic
# macros for chem
	
# Source file position: <groff-source>/contrib/chem/chem.pic
# Installed position: <prefix>/share/groff/<version>/pic

# Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc.
# Written by Brian Kernighan <http://cm.bell-labs.com/cm/cs/who/bwk>,
# modified by Bernd Warken <groff-bernd.warken-72@web.de>.

# This file is part of `chem', which is part of `groff'.

# `groff' is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# `groff' is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

########################################################################

pi = 3.141592654
deg = 57.29578
# cr = 0.08		# radius of invis circle at ring vertices (see cr[vh])
# crh = 0.16; crw = 0.12 # ht & wid of invis ellipse around atoms at ring vertices
# dav = 0.015		# vertical shift up for atoms in atom macro

# atom(text, wid, ht, carbon position, crh, crw, dav)
define atom { [
	T: $1 wid $2 ht $3-2*$7
	C: ellipse invis ht $5 wid $6 at T.w + ($4,$7)
	L: ellipse invis ht $5 wid $6 at T.w + (cwid/2,$7)
	R: ellipse invis ht $5 wid $6 at T.e + (-cwid/2,$7)
] }

# bond(length, angle in degrees, whatever)
define bond {
	line $3 by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg)
}

# fancy bonds:  r, theta, from/at
define doublebond {
	line $3 invis by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg)
	V1: last line.start; V2: last line.end; dx = V2.x-V1.x; dy = V2.y-V1.y
	norm = sqrt(dx*dx + dy*dy)
	ny = dx * .02 / norm
	nx = -dy * .02 / norm
	line from V1 + (nx,ny) to V2 + (nx,ny)
	line from V1 - (nx,ny) to V2 - (nx,ny)
	move to V2
}
define triplebond {
	line $3 invis by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg)
	V1: last line.start; V2: last line.end; dx = V2.x-V1.x; dy = V2.y-V1.y
	norm = sqrt(dx*dx + dy*dy)
	ny = dx * .025 / norm
	nx = -dy * .025 / norm
	line from V1 + (nx,ny) to V2 + (nx,ny)
	line from V1 - (nx,ny) to V2 - (nx,ny)
	line from V1 to V2
	move to V2
}
define backbond {
	line $3 invis by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg)
	V1: last line.start; V2: last line.end; dx = V2.x-V1.x; dy = V2.y-V1.y
	norm = sqrt(dx*dx + dy*dy)
	n = norm / .025
	ny = dx * .02 / norm
	nx = -dy * .02 / norm
	for i = 1 to n-1 do {
		XZ: i/n <V1,V2>
		line from XZ + (nx,ny) to XZ - (nx,ny)
	}
	move to V2
}
define frontbond {
	line $3 invis by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg)
	V1: last line.start; V2: last line.end; dx = V2.x-V1.x; dy = V2.y-V1.y
	ah = arrowht; aw = arrowwid; ahead = arrowhead
	arrowht = sqrt(dx*dx + dy*dy)
	arrowwid = 0.05
	arrowhead = 7
	line <- from V1 to V2
	arrowht = ah; arrowwid = aw; arrowhead = ahead
}
### Emacs settings
# Local Variables:
# mode: Nroff
# End: