Skip to content

Commit

Permalink
Add test_refmoleclist.ipynb
Browse files Browse the repository at this point in the history
  • Loading branch information
choglass committed Feb 29, 2024
1 parent baf947d commit e5bafa2
Showing 1 changed file with 338 additions and 0 deletions.
338 changes: 338 additions & 0 deletions cell2mol/test/test_refmoleclist.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,338 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import cell2mol\n",
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"ref_cell = np.load(\"BACZUB/Ref_Cell_BACZUB.cell\", allow_pickle=True)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"---------------------------------------------------\n",
" >>> Cell2mol CELL Object >>> \n",
"---------------------------------------------------\n",
" Version = 0.1\n",
" Type = cell\n",
" Name (Refcode) = BACZUB\n",
" Num Atoms = 52\n",
" Cell Parameters a:c = [7.378, 9.749, 10.942]\n",
" Cell Parameters al:ga = [91.34, 96.05, 107.23]\n",
"---------------------------------------------------\n",
" # of Ref Molecules: = 3\n",
" With Formulae: \n",
" 0: H9-C10-Cl-Fe-Hg \n",
" 1: H9-C10-Cl-Fe-Hg \n",
" 2: Cl6-Hg2 "
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ref_cell"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"===== REFERENCE MOLECULE =====\n",
"H9-C10-Cl-Fe-Hg specie molecule\n",
"['Hg', 'Fe', 'Cl', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H']\n",
"[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]\n",
"===== METALS =====\n",
"Hg atom metal 0\n",
"PARENT:\t: H9-C10-Cl-Fe-Hg specie molecule\n",
"Fe atom metal 1\n",
"PARENT:\t: H9-C10-Cl-Fe-Hg specie molecule\n",
"===== LIGAND 0 =====\n",
"H5-C5 specie ligand\n",
"['C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H']\n",
"[3, 4, 5, 6, 7, 8, 9, 10, 11, 12]\n",
"PARENT:\t: H9-C10-Cl-Fe-Hg specie molecule\n",
"===== GROUP 0 =====\n",
"C5 specie group\n",
"['C', 'C', 'C', 'C', 'C']\n",
"[0, 2, 4, 6, 8]\n",
"PARENT:\t: H5-C5 specie ligand\n",
"===== ATOMS =====\n",
"C atom metal [1.088207063968434, 4.309352587547709, 1.5686258268701916] 0\n",
"PARENT:\t: H5-C5 specie ligand\n",
"C atom metal [1.0397715909633676, 3.638400052685908, 0.36499880736037693] 2\n",
"PARENT:\t: H5-C5 specie ligand\n",
"C atom metal [1.6288999872619745, 2.4157695326489255, 0.5757421663720231] 4\n",
"PARENT:\t: H5-C5 specie ligand\n",
"C atom metal [2.047083955789577, 2.334447308344994, 1.9879399329449103] 6\n",
"PARENT:\t: H5-C5 specie ligand\n",
"C atom metal [1.6834475642260016, 3.552077268693482, 2.559336875419786] 8\n",
"PARENT:\t: H5-C5 specie ligand\n",
"===== LIGAND 1 =====\n",
"H4-C5 specie ligand\n",
"['C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H']\n",
"[13, 14, 15, 16, 17, 18, 19, 20, 21]\n",
"PARENT:\t: H9-C10-Cl-Fe-Hg specie molecule\n",
"===== GROUP 0 =====\n",
"C5 specie group\n",
"['C', 'C', 'C', 'C', 'C']\n",
"[0, 1, 3, 5, 7]\n",
"PARENT:\t: H4-C5 specie ligand\n",
"===== ATOMS =====\n",
"C atom metal [-1.2757991550702044, 2.060766775585443, 3.361030684443471] 0\n",
"PARENT:\t: H4-C5 specie ligand\n",
"C atom metal [-1.867597191548076, 3.011023862021328, 2.5441285917797702] 1\n",
"PARENT:\t: H4-C5 specie ligand\n",
"C atom metal [-2.009598694552083, 2.51376054758525, 1.2025407135355277] 3\n",
"PARENT:\t: H4-C5 specie ligand\n",
"C atom metal [-1.478218441311459, 1.2250348551990857, 1.2351298927641328] 5\n",
"PARENT:\t: H4-C5 specie ligand\n",
"C atom metal [-1.012973100540437, 0.9240043790765426, 2.5495601216512047] 7\n",
"PARENT:\t: H4-C5 specie ligand\n",
"===== LIGAND 2 =====\n",
"Cl specie ligand\n",
"['Cl']\n",
"[2]\n",
"PARENT:\t: H9-C10-Cl-Fe-Hg specie molecule\n",
"===== GROUP 0 =====\n",
"Cl specie group\n",
"['Cl']\n",
"[0]\n",
"PARENT:\t: Cl specie ligand\n",
"===== ATOMS =====\n",
"Cl atom metal [-0.3928769966037601, 2.3016163714687834, 7.603055514033566] 0\n",
"PARENT:\t: Cl specie ligand\n",
"\n",
"===== REFERENCE MOLECULE =====\n",
"H9-C10-Cl-Fe-Hg specie molecule\n",
"['Hg', 'Fe', 'Cl', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H']\n",
"[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]\n",
"===== METALS =====\n",
"Hg atom metal 0\n",
"PARENT:\t: H9-C10-Cl-Fe-Hg specie molecule\n",
"Fe atom metal 1\n",
"PARENT:\t: H9-C10-Cl-Fe-Hg specie molecule\n",
"===== LIGAND 0 =====\n",
"H5-C5 specie ligand\n",
"['C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H']\n",
"[3, 4, 5, 6, 7, 8, 9, 10, 11, 12]\n",
"PARENT:\t: H9-C10-Cl-Fe-Hg specie molecule\n",
"===== GROUP 0 =====\n",
"C5 specie group\n",
"['C', 'C', 'C', 'C', 'C']\n",
"[0, 2, 4, 6, 8]\n",
"PARENT:\t: H5-C5 specie ligand\n",
"===== ATOMS =====\n",
"C atom metal [2.2488128756294996, 4.376589855872433, 9.294433915998171] 0\n",
"PARENT:\t: H5-C5 specie ligand\n",
"C atom metal [2.2972483486345654, 5.047542390734234, 10.498060935507986] 2\n",
"PARENT:\t: H5-C5 specie ligand\n",
"C atom metal [1.7081199523359591, 6.270172910771218, 10.287317576496338] 4\n",
"PARENT:\t: H5-C5 specie ligand\n",
"C atom metal [1.2899359838083557, 6.351495135075149, 8.87511980992345] 6\n",
"PARENT:\t: H5-C5 specie ligand\n",
"C atom metal [1.6535723753719318, 5.133865174726661, 8.303722867448576] 8\n",
"PARENT:\t: H5-C5 specie ligand\n",
"===== LIGAND 1 =====\n",
"H4-C5 specie ligand\n",
"['C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H']\n",
"[13, 14, 15, 16, 17, 18, 19, 20, 21]\n",
"PARENT:\t: H9-C10-Cl-Fe-Hg specie molecule\n",
"===== GROUP 0 =====\n",
"C5 specie group\n",
"['C', 'C', 'C', 'C', 'C']\n",
"[0, 1, 3, 5, 7]\n",
"PARENT:\t: H4-C5 specie ligand\n",
"===== ATOMS =====\n",
"C atom metal [4.612819094668138, 6.625175667834701, 7.502029058424891] 0\n",
"PARENT:\t: H4-C5 specie ligand\n",
"C atom metal [5.20461713114601, 5.674918581398816, 8.318931151088591] 1\n",
"PARENT:\t: H4-C5 specie ligand\n",
"C atom metal [5.346618634150017, 6.172181895834893, 9.660519029332834] 3\n",
"PARENT:\t: H4-C5 specie ligand\n",
"C atom metal [4.815238380909393, 7.460907588221057, 9.627929850104229] 5\n",
"PARENT:\t: H4-C5 specie ligand\n",
"C atom metal [4.34999304013837, 7.7619380643436005, 8.313499621217158] 7\n",
"PARENT:\t: H4-C5 specie ligand\n",
"===== LIGAND 2 =====\n",
"Cl specie ligand\n",
"['Cl']\n",
"[2]\n",
"PARENT:\t: H9-C10-Cl-Fe-Hg specie molecule\n",
"===== GROUP 0 =====\n",
"Cl specie group\n",
"['Cl']\n",
"[0]\n",
"PARENT:\t: Cl specie ligand\n",
"===== ATOMS =====\n",
"Cl atom metal [3.729896936201694, 6.38432607195136, 3.2600042288347955] 0\n",
"PARENT:\t: Cl specie ligand\n",
"\n",
"===== REFERENCE MOLECULE =====\n",
"Cl6-Hg2 specie molecule\n",
"['Hg', 'Cl', 'Cl', 'Cl', 'Hg', 'Cl', 'Cl', 'Cl']\n",
"[0, 1, 2, 3, 4, 5, 6, 7]\n",
"===== METALS =====\n",
"Hg atom metal 0\n",
"PARENT:\t: Cl6-Hg2 specie molecule\n",
"Hg atom metal 4\n",
"PARENT:\t: Cl6-Hg2 specie molecule\n",
"===== LIGAND 0 =====\n",
"Cl specie ligand\n",
"['Cl']\n",
"[7]\n",
"PARENT:\t: Cl6-Hg2 specie molecule\n",
"===== GROUP 0 =====\n",
"Cl specie group\n",
"['Cl']\n",
"[0]\n",
"PARENT:\t: Cl specie ligand\n",
"===== ATOMS =====\n",
"Cl atom metal [3.467119889580811, 3.2061438651914775, 5.753076439823084] 0\n",
"PARENT:\t: Cl specie ligand\n",
"===== LIGAND 1 =====\n",
"Cl specie ligand\n",
"['Cl']\n",
"[6]\n",
"PARENT:\t: Cl6-Hg2 specie molecule\n",
"===== GROUP 0 =====\n",
"Cl specie group\n",
"['Cl']\n",
"[0]\n",
"PARENT:\t: Cl specie ligand\n",
"===== ATOMS =====\n",
"Cl atom metal [2.9351152741778943, 0.5309238179055397, 9.052187683732207] 0\n",
"PARENT:\t: Cl specie ligand\n",
"===== LIGAND 2 =====\n",
"Cl specie ligand\n",
"['Cl']\n",
"[5]\n",
"PARENT:\t: Cl6-Hg2 specie molecule\n",
"===== GROUP 0 =====\n",
"Cl specie group\n",
"['Cl']\n",
"[0]\n",
"PARENT:\t: Cl specie ligand\n",
"===== ATOMS =====\n",
"Cl atom metal [1.3562607787141432, -0.06389919010860623, 5.119760056813859] 0\n",
"PARENT:\t: Cl specie ligand\n",
"===== LIGAND 3 =====\n",
"Cl specie ligand\n",
"['Cl']\n",
"[3]\n",
"PARENT:\t: Cl6-Hg2 specie molecule\n",
"===== GROUP 0 =====\n",
"Cl specie group\n",
"['Cl']\n",
"[0]\n",
"PARENT:\t: Cl specie ligand\n",
"===== ATOMS =====\n",
"Cl atom metal [2.7576337144776764, -3.8316994367601804, 5.1099833030452775] 0\n",
"PARENT:\t: Cl specie ligand\n",
"===== LIGAND 4 =====\n",
"Cl specie ligand\n",
"['Cl']\n",
"[2]\n",
"PARENT:\t: Cl6-Hg2 specie molecule\n",
"===== GROUP 0 =====\n",
"Cl specie group\n",
"['Cl']\n",
"[0]\n",
"PARENT:\t: Cl specie ligand\n",
"===== ATOMS =====\n",
"Cl atom metal [3.2896383298805927, -1.1564793894742424, 1.8108720591361558] 0\n",
"PARENT:\t: Cl specie ligand\n",
"===== LIGAND 5 =====\n",
"Cl specie ligand\n",
"['Cl']\n",
"[1]\n",
"PARENT:\t: Cl6-Hg2 specie molecule\n",
"===== GROUP 0 =====\n",
"Cl specie group\n",
"['Cl']\n",
"[0]\n",
"PARENT:\t: Cl specie ligand\n",
"===== ATOMS =====\n",
"Cl atom metal [4.868492825344344, -0.5616563814600966, 5.7432996860545025] 0\n",
"PARENT:\t: Cl specie ligand\n",
"\n"
]
}
],
"source": [
"for ref in ref_cell.refmoleclist:\n",
" print(\"===== REFERENCE MOLECULE =====\")\n",
" print(ref.formula, ref.type, ref.subtype)\n",
" print(ref.labels)\n",
" print(ref.parent_indices)\n",
" if ref.iscomplex:\n",
" print(\"===== METALS =====\")\n",
" for metal in ref.metals:\n",
" print(metal.label, metal.type, metal.subtype, metal.parent_index)\n",
" print(\"PARENT:\\t:\", metal.parent.formula, metal.parent.type, metal.parent.subtype)\n",
" for ligand_idx, ligand in enumerate(ref.ligands):\n",
" print(f\"===== LIGAND {ligand_idx} =====\")\n",
" print(ligand.formula, ligand.type, ligand.subtype)\n",
" print(ligand.labels)\n",
" print(ligand.parent_indices)\n",
" print(\"PARENT:\\t:\", ligand.parent.formula, ligand.parent.type, ligand.parent.subtype)\n",
" for group_idx, group in enumerate(ligand.groups):\n",
" print(f\"===== GROUP {group_idx} =====\")\n",
" print(group.formula, group.type, group.subtype)\n",
" print(group.labels)\n",
" print(group.parent_indices)\n",
" print(\"PARENT:\\t:\", group.parent.formula, group.parent.type, group.parent.subtype)\n",
" print(\"===== ATOMS =====\")\n",
" for atom in group.atoms:\n",
" print(atom.label, atom.type, atom.subtype, atom.coord, atom.parent_index)\n",
" print(\"PARENT:\\t:\", atom.parent.formula, atom.parent.type, atom.parent.subtype)\n",
" print(\"\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "cell2mol",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

0 comments on commit e5bafa2

Please sign in to comment.