// File: Luthaf[P]zeopp/sphere_approx.cc
// Function: AtomCluster::replaceAtomByCluster(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, double)
void AtomCluster::replaceAtomByCluster(string cluster_type, double large_atom_radius){
	double shift = large_atom_radius - smallSphereRadius;

//Type: OCC: Octahedron + cube (15 spheres)
        if (cluster_type == "OCC"){
                for (int i = 0; i<15; i++){
                        atom_vector.push_back(center);
                }
                translate_cube(shift, 0);
                plusMinus_axes(shift, 8);
        }

//Type: FCC = 4 cubes (33 spheres) 
	if (cluster_type == "FCC" || cluster_type == "ACC"){

		//fills vector with spheres positioned at origin
		for (int i = 0; i<32; i++){
			atom_vector.push_back(center);
		}

		//Translate cube vertices for all 4 cubes
		translate_cube(shift, 0);
		rotate_xy_cube(shift, 8);
		rotate_xz_cube(shift, 16);
		rotate_yz_cube(shift, 24);

//Type: ACC = 4 cubes w/ axis spheres (39 spheres)
		if (cluster_type == "ACC"){
			vector <ATOM> axes;
			for (int i = 0; i<6; i++){
				atom_vector.push_back(center);
			}
			plusMinus_axes(shift, 32);
		}
		atom_vector.push_back(center);
	}

//Type: AQC = Axes, quadrants, cube (27 spheres)
//	Spheres along +- axes, 45 degrees from xy, xz, yz axes,
//	and cube with edges aligned to axes 
	else if (cluster_type == "AQC"){
		for (int i = 0; i<27; i++){
			atom_vector.push_back(center);
		}
		translate_axes(shift, 0);
		translate_cube(shift, 18);
	}

//Type: DDH = Dodecahedron (21 spheres); pentagonal faces
	else if (cluster_type == "DDH" || cluster_type == "TIH"){
		for (int i = 0; i<20; i++){
			atom_vector.push_back(center);
		}
		translate_dodecahedron(shift, 0);
//Type: TIH = Truncated icosahedron (33 spheres)
//	dodecahedron w/ center of faces filled w/ spheres
		if (cluster_type == "TIH"){
			vector <ATOM> ico;
			for (int i = 0; i<12; i++){
				atom_vector.push_back(center);
			}
			rotate_icosahedron(shift, 20);
		}
		atom_vector.push_back(center);
	}

//Type: ICH = Icosidodecahedron (31 spheres)
// Quasiregular polyhedron. pentagonal/triangular faces
	else if (cluster_type == "ICH" || cluster_type == "ICC"){
		for (int i = 0; i<30; i++){
			atom_vector.push_back(center);
		}
		translate_icosidodecahedron(shift, 0);
//Type: ICC = Icosidodecahedron w/ center face spheres (43 spheres)
		if (cluster_type == "ICC"){
	//		vector <ATOM> center_spheres;
		//	for (int i = 0; i<atom_vector.size(); i++){
		//		center_spheres.push_back(atom_vector.at(i));
		//	}
			calc_centerSpheres(shift, 0);
		}
		atom_vector.push_back(center);
	}

//Type: RIH = Rhombicosidodecahedron (61 spheres)
// Semiregular polyhedron. Square, pentagonal, triangular faces
	else if (cluster_type == "RIH"){
		for (int i = 0; i<61; i++){
			atom_vector.push_back(center);
		}

		translate_rhombi(shift, 0);
	}
//Type: S4 = 4 spheres in a spiral
        else if (cluster_type == "S4"){
                sphere_spiral(4, shift);
        }
//Type: S10 = 10 spheres in a spiral
        else if (cluster_type == "S10"){
                sphere_spiral(10, shift);
        }
//Type: S20 = 20 spheres in a spiral
        else if (cluster_type == "S20"){
                sphere_spiral(20, shift);
        }
//Type: S30 = 30 spheres in a spiral
        else if (cluster_type == "S30"){
                sphere_spiral(30, shift);
        }
//Type: S40 = 40 spheres in a spiral
        else if (cluster_type == "S40"){
                sphere_spiral(40, shift);
        }
//Type: S50 = 50 spheres in a spiral
        else if (cluster_type == "S50"){
                sphere_spiral(50, shift);
        }
//Type: S100 = 100 spheres in a spiral
        else if (cluster_type == "S100"){
                sphere_spiral(100, shift);
        }
//Type: S500 = 500 spheres in a spiral
        else if (cluster_type == "S500"){
                sphere_spiral(500, shift);
        }
//Type: S1000 = 1000 spheres in a spiral
        else if (cluster_type == "S1000"){
                sphere_spiral(1000, shift);
        }
//Type: S1000 = 1000 spheres in a spiral
        else if (cluster_type == "S10000"){
                sphere_spiral(10000, shift);
        }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rsi, -0xa0(%rbp)
movq %rdi, %rax
movq -0xa0(%rbp), %rdi
movq %rdi, -0x98(%rbp)
movq %rax, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movsd %xmm0, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x90(%rbp)
movsd -0x18(%rbp), %xmm0
subsd (%rax), %xmm0
movsd %xmm0, -0x20(%rbp)
leaq 0x104660(%rip), %rsi    # 0x1fc940
callq 0x845d0
testb $0x1, %al
jne 0xf82eb
jmp 0xf8349
movl $0x0, -0x24(%rbp)
cmpl $0xf, -0x24(%rbp)
jge 0xf8320
movq -0x90(%rbp), %rsi
movq %rsi, %rdi
addq $0x138, %rdi            # imm = 0x138
addq $0xa0, %rsi
callq 0xf190
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xf82f2
movq -0x90(%rbp), %rdi
movsd -0x20(%rbp), %xmm0
xorl %esi, %esi
callq 0xf8a00
movq -0x90(%rbp), %rdi
movsd -0x20(%rbp), %xmm0
movl $0x8, %esi
callq 0xf8a70
movq -0x98(%rbp), %rdi
leaq 0x1045ed(%rip), %rsi    # 0x1fc944
callq 0x845d0
testb $0x1, %al
jne 0xf837c
movq -0x98(%rbp), %rdi
leaq 0x1045da(%rip), %rsi    # 0x1fc948
callq 0x845d0
testb $0x1, %al
jne 0xf837c
jmp 0xf84be
movl $0x0, -0x28(%rbp)
cmpl $0x20, -0x28(%rbp)
jge 0xf83b1
movq -0x90(%rbp), %rsi
movq %rsi, %rdi
addq $0x138, %rdi            # imm = 0x138
addq $0xa0, %rsi
callq 0xf190
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xf8383
movq -0x90(%rbp), %rdi
movsd -0x20(%rbp), %xmm0
xorl %esi, %esi
callq 0xf8a00
movq -0x90(%rbp), %rdi
movsd -0x20(%rbp), %xmm0
movl $0x8, %esi
callq 0xf9080
movq -0x90(%rbp), %rdi
movsd -0x20(%rbp), %xmm0
movl $0x10, %esi
callq 0xf9130
movq -0x90(%rbp), %rdi
movsd -0x20(%rbp), %xmm0
movl $0x18, %esi
callq 0xf91e0
movq -0x98(%rbp), %rdi
leaq 0x104534(%rip), %rsi    # 0x1fc948
callq 0x845d0
testb $0x1, %al
jne 0xf841f
jmp 0xf849c
leaq -0x40(%rbp), %rdi
callq 0x59bd0
movl $0x0, -0x44(%rbp)
cmpl $0x6, -0x44(%rbp)
jge 0xf847b
movq -0x90(%rbp), %rsi
movq %rsi, %rdi
addq $0x138, %rdi            # imm = 0x138
addq $0xa0, %rsi
callq 0xf190
jmp 0xf8454
jmp 0xf8456
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xf842f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x12310
jmp 0xf89e8
movq -0x90(%rbp), %rdi
movsd -0x20(%rbp), %xmm0
movl $0x20, %esi
callq 0xf8a70
jmp 0xf8493
leaq -0x40(%rbp), %rdi
callq 0x12310
movq -0x90(%rbp), %rsi
movq %rsi, %rdi
addq $0x138, %rdi            # imm = 0x138
addq $0xa0, %rsi
callq 0xf190
jmp 0xf89df
movq -0x98(%rbp), %rdi
leaq 0x104480(%rip), %rsi    # 0x1fc94c
callq 0x845d0
testb $0x1, %al
jne 0xf84d7
jmp 0xf853a
movl $0x0, -0x58(%rbp)
cmpl $0x1b, -0x58(%rbp)
jge 0xf850c
movq -0x90(%rbp), %rsi
movq %rsi, %rdi
addq $0x138, %rdi            # imm = 0x138
addq $0xa0, %rsi
callq 0xf190
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0xf84de
movq -0x90(%rbp), %rdi
movsd -0x20(%rbp), %xmm0
xorl %esi, %esi
callq 0xf9290
movq -0x90(%rbp), %rdi
movsd -0x20(%rbp), %xmm0
movl $0x12, %esi
callq 0xf8a00
jmp 0xf89dd
movq -0x98(%rbp), %rdi
leaq 0x104408(%rip), %rsi    # 0x1fc950
callq 0x845d0
testb $0x1, %al
jne 0xf856d
movq -0x98(%rbp), %rdi
leaq 0x1043f5(%rip), %rsi    # 0x1fc954
callq 0x845d0
testb $0x1, %al
jne 0xf856d
jmp 0xf866d
movl $0x0, -0x5c(%rbp)
cmpl $0x14, -0x5c(%rbp)
jge 0xf85a2
movq -0x90(%rbp), %rsi
movq %rsi, %rdi
addq $0x138, %rdi            # imm = 0x138
addq $0xa0, %rsi
callq 0xf190
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0xf8574
movq -0x90(%rbp), %rdi
movsd -0x20(%rbp), %xmm0
xorl %esi, %esi
callq 0xf9340
movq -0x98(%rbp), %rdi
leaq 0x104391(%rip), %rsi    # 0x1fc954
callq 0x845d0
testb $0x1, %al
jne 0xf85ce
jmp 0xf864b
leaq -0x78(%rbp), %rdi
callq 0x59bd0
movl $0x0, -0x7c(%rbp)
cmpl $0xc, -0x7c(%rbp)
jge 0xf862a
movq -0x90(%rbp), %rsi
movq %rsi, %rdi
addq $0x138, %rdi            # imm = 0x138
addq $0xa0, %rsi
callq 0xf190
jmp 0xf8603
jmp 0xf8605
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0xf85de
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x12310
jmp 0xf89e8
movq -0x90(%rbp), %rdi
movsd -0x20(%rbp), %xmm0
movl $0x14, %esi
callq 0xf94b0
jmp 0xf8642
leaq -0x78(%rbp), %rdi
callq 0x12310
movq -0x90(%rbp), %rsi
movq %rsi, %rdi
addq $0x138, %rdi            # imm = 0x138
addq $0xa0, %rsi
callq 0xf190
jmp 0xf89db
movq -0x98(%rbp), %rdi
leaq 0x1042dd(%rip), %rsi    # 0x1fc958
callq 0x845d0
testb $0x1, %al
jne 0xf86a0
movq -0x98(%rbp), %rdi
leaq 0x1042ca(%rip), %rsi    # 0x1fc95c
callq 0x845d0
testb $0x1, %al
jne 0xf86a0
jmp 0xf8736
movl $0x0, -0x80(%rbp)
cmpl $0x1e, -0x80(%rbp)
jge 0xf86d5
movq -0x90(%rbp), %rsi
movq %rsi, %rdi
addq $0x138, %rdi            # imm = 0x138
addq $0xa0, %rsi
callq 0xf190
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0xf86a7
movq -0x90(%rbp), %rdi
movsd -0x20(%rbp), %xmm0
xorl %esi, %esi
callq 0xf9580
movq -0x98(%rbp), %rdi
leaq 0x104266(%rip), %rsi    # 0x1fc95c
callq 0x845d0
testb $0x1, %al
jne 0xf8701
jmp 0xf8714
movq -0x90(%rbp), %rdi
movsd -0x20(%rbp), %xmm0
xorl %esi, %esi
callq 0xf96d0
movq -0x90(%rbp), %rsi
movq %rsi, %rdi
addq $0x138, %rdi            # imm = 0x138
addq $0xa0, %rsi
callq 0xf190
jmp 0xf89d9
movq -0x98(%rbp), %rdi
leaq 0x10421c(%rip), %rsi    # 0x1fc960
callq 0x845d0
testb $0x1, %al
jne 0xf874f
jmp 0xf87a8
movl $0x0, -0x84(%rbp)
cmpl $0x3d, -0x84(%rbp)
jge 0xf8790
movq -0x90(%rbp), %rsi
movq %rsi, %rdi
addq $0x138, %rdi            # imm = 0x138
addq $0xa0, %rsi
callq 0xf190
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0xf8759
movq -0x90(%rbp), %rdi
movsd -0x20(%rbp), %xmm0
xorl %esi, %esi
callq 0xfa170
jmp 0xf89d7
movq -0x98(%rbp), %rdi
leaq 0x1041ae(%rip), %rsi    # 0x1fc964
callq 0x845d0
testb $0x1, %al
jne 0xf87c1
jmp 0xf87df
movq -0x90(%rbp), %rdi
movsd -0x20(%rbp), %xmm1
movsd 0xfde53(%rip), %xmm0    # 0x1f6628
callq 0xfa380
jmp 0xf89d5
movq -0x98(%rbp), %rdi
leaq 0x10417a(%rip), %rsi    # 0x1fc967
callq 0x845d0
testb $0x1, %al
jne 0xf87f8
jmp 0xf8816
movq -0x90(%rbp), %rdi
movsd -0x20(%rbp), %xmm1
movsd 0xfde14(%rip), %xmm0    # 0x1f6620
callq 0xfa380
jmp 0xf89d3
movq -0x98(%rbp), %rdi
leaq 0x104147(%rip), %rsi    # 0x1fc96b
callq 0x845d0
testb $0x1, %al
jne 0xf882f
jmp 0xf884d
movq -0x90(%rbp), %rdi
movsd -0x20(%rbp), %xmm1
movsd 0xfeb6d(%rip), %xmm0    # 0x1f73b0
callq 0xfa380
jmp 0xf89d1
movq -0x98(%rbp), %rdi
leaq 0x104114(%rip), %rsi    # 0x1fc96f
callq 0x845d0
testb $0x1, %al
jne 0xf8866
jmp 0xf8884
movq -0x90(%rbp), %rdi
movsd -0x20(%rbp), %xmm1
movsd 0x1040a6(%rip), %xmm0   # 0x1fc920
callq 0xfa380
jmp 0xf89cf
movq -0x98(%rbp), %rdi
leaq 0x1040e1(%rip), %rsi    # 0x1fc973
callq 0x845d0
testb $0x1, %al
jne 0xf889d
jmp 0xf88bb
movq -0x90(%rbp), %rdi
movsd -0x20(%rbp), %xmm1
movsd 0x104067(%rip), %xmm0   # 0x1fc918
callq 0xfa380
jmp 0xf89cd
movq -0x98(%rbp), %rdi
leaq 0x1040ae(%rip), %rsi    # 0x1fc977
callq 0x845d0
testb $0x1, %al
jne 0xf88d4
jmp 0xf88f2
movq -0x90(%rbp), %rdi
movsd -0x20(%rbp), %xmm1
movsd 0x104028(%rip), %xmm0   # 0x1fc910
callq 0xfa380
jmp 0xf89cb
movq -0x98(%rbp), %rdi
leaq 0x10407b(%rip), %rsi    # 0x1fc97b
callq 0x845d0
testb $0x1, %al
jne 0xf890b
jmp 0xf8929
movq -0x90(%rbp), %rdi
movsd -0x20(%rbp), %xmm1
movsd 0xf9721(%rip), %xmm0    # 0x1f2040
callq 0xfa380
jmp 0xf89c9
movq -0x98(%rbp), %rdi
leaq 0x104049(%rip), %rsi    # 0x1fc980
callq 0x845d0
testb $0x1, %al
jne 0xf8942
jmp 0xf895d
movq -0x90(%rbp), %rdi
movsd -0x20(%rbp), %xmm1
movsd 0x102f82(%rip), %xmm0   # 0x1fb8d8
callq 0xfa380
jmp 0xf89c7
movq -0x98(%rbp), %rdi
leaq 0x10401a(%rip), %rsi    # 0x1fc985
callq 0x845d0
testb $0x1, %al
jne 0xf8976
jmp 0xf8991
movq -0x90(%rbp), %rdi
movsd -0x20(%rbp), %xmm1
movsd 0xfef1e(%rip), %xmm0    # 0x1f78a8
callq 0xfa380
jmp 0xf89c5
movq -0x98(%rbp), %rdi
leaq 0x103fec(%rip), %rsi    # 0x1fc98b
callq 0x845d0
testb $0x1, %al
jne 0xf89aa
jmp 0xf89c3
movq -0x90(%rbp), %rdi
movsd -0x20(%rbp), %xmm1
movsd 0x103a6a(%rip), %xmm0   # 0x1fc428
callq 0xfa380
jmp 0xf89c5
jmp 0xf89c7
jmp 0xf89c9
jmp 0xf89cb
jmp 0xf89cd
jmp 0xf89cf
jmp 0xf89d1
jmp 0xf89d3
jmp 0xf89d5
jmp 0xf89d7
jmp 0xf89d9
jmp 0xf89db
jmp 0xf89dd
jmp 0xf89df
addq $0xa0, %rsp
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x58f0
nopw %cs:(%rax,%rax)