#!/bin/bash #FN="/home/shared/1,4-bis(butylamino)anthracene-9,10-dione.mol" #FN="/home/shared/naphthalene.mol" echo "// OpenSCAD script" echo "// Molecular model" echo "" echo "\$SC=4; // scaling factor for the molecule, mm/angstrom" echo "\$SR=0.6; // scaling factor for the atom diameter, 1 for real vdW radius, 0.5 for less cramped" echo "" echo "// Resolution (increase for better, decrease for faster)" #echo "\$fa=4;\$fs=2;" echo "\$fn=24;" echo "" echo "\$SD=\$SC*2*\$SR;" echo "" echo "// Atomic radii from https://en.wikipedia.org/wiki/Atomic_radii_of_the_elements_(data_page)" for x in H=1.2 C=1.7 N=1.55 O=1.52 F=1.47 Si=2.1 P=1.8 S=1.8 Cl=1.75 Ge=2.11 As=1.85 Se=1.9 Br=1.85 I=1.98 \ Hg=1.55 Pb=2.02 Tl=1.96 U=1.86 Cd=1.58 In=1.93 Sn=2.17 Sb=2.06 Te=2.06 Pt=1.75 Au=1.66 Bi=2.07 \ Ni=1.63 Cu=1.4 Zn=1.39 Ga=1.87 Ge=2.11 Pd=1.63 Ag=1.72; do echo "\$vdw$x;" done echo "" echo "module molecule(){" cat | while read x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 xrest; do if [ "$x12" = "" ]; then continue; fi #echo "translate([$x1*\$SC,$x2*\$SC,$x3*\$SC])sphere(d=\$vdw$x4*\$SD);" echo " translate([$x1*\$SC,$x2*\$SC,$x3*\$SC])sphere(d=\$vdw$x4*\$SD);" done echo "}" echo "" echo "rotate([0,0,0])" echo "rotate([0,0,0])" echo "molecule();" echo ""