How to use decrement method in autotest

Best Python code snippet using autotest_python

atomtype.py

Source:atomtype.py Github

copy

Full Screen

1#!/usr/bin/env python2# encoding: utf-83################################################################################4#5# RMG - Reaction Mechanism Generator6#7# Copyright (c) 2002-2017 Prof. William H. Green (whgreen@mit.edu), 8# Prof. Richard H. West (r.west@neu.edu) and the RMG Team (rmg_dev@mit.edu)9#10# Permission is hereby granted, free of charge, to any person obtaining a11# copy of this software and associated documentation files (the 'Software'),12# to deal in the Software without restriction, including without limitation13# the rights to use, copy, modify, merge, publish, distribute, sublicense,14# and/or sell copies of the Software, and to permit persons to whom the15# Software is furnished to do so, subject to the following conditions:16#17# The above copyright notice and this permission notice shall be included in18# all copies or substantial portions of the Software.19#20# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR21# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,22# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE23# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER24# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING25# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER26# DEALINGS IN THE SOFTWARE.27#28################################################################################29"""30This module defines the atom types that are available for representing31molecular functional groups and substructure patterns. Each available atom type32is defined as an instance of the :class:`AtomType` class. The atom types 33themselves are available in the ``atomTypes`` module-level variable, or as34the return value from the :meth:`getAtomType()` method.35If you want to change which atom types are available in RMG and/or what they36represent, this should be the only module you need to change to do so.37"""38import cython39from rmgpy.exceptions import AtomTypeError40################################################################################41class AtomType:42 """43 A class for internal representation of atom types. Using unique objects44 rather than strings allows us to use fast pointer comparisons instead of45 slow string comparisons, as well as store extra metadata. In particular,46 we store metadata describing the atom type's hierarchy with regard to other47 atom types, and the atom types that can result when various actions48 involving this atom type are taken. The attributes are:49 =================== =================== ====================================50 Attribute Type Description51 =================== =================== ====================================52 `label` ``str`` A unique label for the atom type53 `generic` ``list`` The atom types that are more generic than this one54 `specific` ``list`` The atom types that are more specific than this one55 `incrementBond` ``list`` The atom type(s) that result when an adjacent bond's order is incremented56 `decrementBond` ``list`` The atom type(s) that result when an adjacent bond's order is decremented57 `formBond` ``list`` The atom type(s) that result when a new single bond is formed to this atom type58 `breakBond` ``list`` The atom type(s) that result when an existing single bond to this atom type is broken59 `incrementRadical` ``list`` The atom type(s) that result when the number of radical electrons is incremented60 `decrementRadical` ``list`` The atom type(s) that result when the number of radical electrons is decremented61 `incrementLonePair` ``list`` The atom type(s) that result when the number of lone electron pairs is incremented62 `decrementLonePair` ``list`` The atom type(s) that result when the number of lone electron pairs is decremented63 The following features are what are required in a given atomtype. Any int in the list is acceptable.64 An empty list is a wildcard65 'single' ''list'' The total number of single bonds on the atom66 'allDouble' ''list'' The total number of double bonds on the atom67 'rDouble' ''list'' The number of double bonds to any non-oxygen, nonsulfur68 'oDouble' ''list'' The number of double bonds to oxygen69 'sDouble' ''list'' The number of double bonds to sulfur70 'triple' ''list'' The total number of triple bonds on the atom71 'benzene' ''list'' The total number of benzene bonds on the atom72 'lonePairs' ''list'' The number of lone pairs on the atom73 =================== =================== ====================================74 """75 76 def __init__(self, label='', generic=None, specific=None,77 single=None,78 allDouble=None,79 rDouble=None,80 oDouble=None,81 sDouble=None,82 triple=None,83 benzene=None,84 lonePairs=None,):85 self.label = label86 self.generic = generic or []87 self.specific = specific or []88 self.incrementBond = []89 self.decrementBond = []90 self.formBond = []91 self.breakBond = []92 self.incrementRadical = []93 self.decrementRadical = []94 self.incrementLonePair = []95 self.decrementLonePair = []96 self.single = single or []97 self.allDouble = allDouble or []98 self.rDouble = rDouble or []99 self.oDouble = oDouble or []100 self.sDouble = sDouble or []101 self.triple = triple or []102 self.benzene = benzene or []103 self.lonePairs = lonePairs or []104 def __repr__(self):105 return '<AtomType "%s">' % self.label106 def __reduce__(self):107 """108 A helper function used when pickling an AtomType object.109 """110 d = {111 'label': self.label,112 'generic': self.generic,113 'specific': self.specific,114 'incrementBond': self.incrementBond,115 'decrementBond': self.decrementBond,116 'formBond': self.formBond,117 'breakBond': self.breakBond,118 'incrementRadical': self.incrementRadical,119 'decrementRadical': self.decrementRadical,120 'incrementLonePair': self.incrementLonePair,121 'decrementLonePair': self.decrementLonePair,122 'single': self.single,123 'allDouble': self.allDouble,124 'rDouble': self.rDouble,125 'oDouble': self.oDouble,126 'sDouble': self.sDouble,127 'triple': self.triple,128 'benzene': self.benzene,129 'lonePairs': self.lonePairs130 }131 return (AtomType, (), d)132 def __setstate__(self, d):133 """134 A helper function used when unpickling an AtomType object.135 """136 self.label = d['label']137 self.generic = d['generic']138 self.specific = d['specific']139 self.incrementBond = d['incrementBond']140 self.decrementBond = d['decrementBond']141 self.formBond = d['formBond']142 self.breakBond = d['breakBond']143 self.incrementRadical = d['incrementRadical']144 self.decrementRadical = d['decrementRadical']145 self.incrementLonePair = d['incrementLonePair']146 self.decrementLonePair = d['decrementLonePair']147 self.single = d['single']148 self.allDouble = d['allDouble']149 self.rDouble = d['rDouble']150 self.oDouble = d['oDouble']151 self.sDouble = d['sDouble']152 self.triple = d['triple']153 self.benzene = d['benzene']154 self.lonePairs = d['lonePairs']155 def setActions(self, incrementBond, decrementBond, formBond, breakBond, incrementRadical, decrementRadical, incrementLonePair, decrementLonePair):156 self.incrementBond = incrementBond157 self.decrementBond = decrementBond158 self.formBond = formBond159 self.breakBond = breakBond160 self.incrementRadical = incrementRadical161 self.decrementRadical = decrementRadical162 self.incrementLonePair = incrementLonePair163 self.decrementLonePair = decrementLonePair164 def equivalent(self, other):165 """166 Returns ``True`` if two atom types `atomType1` and `atomType2` are167 equivalent or ``False`` otherwise. This function respects wildcards,168 e.g. ``R!H`` is equivalent to ``C``.169 """170 return self is other or self in other.specific or other in self.specific171 def isSpecificCaseOf(self, other):172 """173 Returns ``True`` if atom type `atomType1` is a specific case of174 atom type `atomType2` or ``False`` otherwise.175 """176 return self is other or self in other.specific177 178 def getFeatures(self):179 """180 Returns a list of the features that are checked to determine atomtype181 """182 features=[self.single,183 self.allDouble,184 self.rDouble,185 self.oDouble,186 self.sDouble,187 self.triple,188 self.benzene,189 self.lonePairs,]190 return features191################################################################################192"""193Note: function to read adjacency lists assumes that all atom types begin194with a capital letter [A-Z]195For making sample atoms, we use the first atomtype under specific,196therefore the first one in the list should always be an element.197"""198atomTypes = {}199atomTypes['R'] = AtomType(label='R', generic=[], specific=[200 'H',201 'R!H',202 'Val4','Val5','Val6','Val7', 203 'He',204 'C','Cs','Cd','Cdd','Ct','CO','Cb','Cbf','CS',205 'N','N1sc','N1s','N1d','N2s','N3s','N3d','N3t','N3b','N5s','N5d','N5dd','N5t','N5b',206 'O','Os','Od','Oa','Ot',207 'Ne',208 'Si','Sis','Sid','Sidd','Sit','SiO','Sib','Sibf',209 'S','Ss','Sd','Sa','St',210 'Cl','Ar']211)212atomTypes['R!H'] = AtomType(label='R!H', generic=['R'], specific=[213 'He',214 'Val4','Val5','Val6','Val7',215 'C', 'Cs','Cd','Cdd','Ct','CO','Cb','Cbf','CS',216 'N','N1sc','N1s','N1d','N2s','N3s','N3d','N3t','N3b','N5s','N5d','N5dd','N5t','N5b',217 'O','Os','Od','Oa','Ot',218 'Ne',219 'Si','Sis','Sid','Sidd','Sit','SiO','Sib','Sibf',220 'S','Ss','Sd','Sa','St',221 'Cl','Ar'])222atomTypes['Val4'] = AtomType(label='Val4', generic=['R','R!H'], specific=[223 'C','Cs','Cd','Cdd','Ct','CO','Cb','Cbf','CS',224 'Si','Sis','Sid','Sidd','Sit','SiO','Sib','Sibf'])225atomTypes['Val5'] = AtomType(label='Val5', generic=['R','R!H'], specific=[226 'N','N1sc','N1s','N1d','N2s','N3s','N3d','N3t','N3b','N5s','N5d','N5dd','N5t','N5b'])227atomTypes['Val6'] = AtomType(label='Val6', generic=['R','R!H'], specific=[228 'O','Os','Od','Oa','Ot',229 'S','Ss','Sd','Sa', 'St'])230atomTypes['Val7'] = AtomType(label='Val7', generic=['R','R!H'], specific=[231 'Cl'])232atomTypes['H' ] = AtomType('H', generic=['R'], specific=[])233atomTypes['He' ] = AtomType('He', generic=['R','R!H'], specific=[])234atomTypes['C' ] = AtomType('C', generic=['R','R!H','Val4'], specific=['Cs','Cd','Cdd','Ct','CO','Cb','Cbf','CS'],235 single=[], allDouble=[], rDouble=[], oDouble=[], sDouble=[], triple=[], benzene=[],)236atomTypes['Cs' ] = AtomType('Cs', generic=['R','R!H','C','Val4'], specific=[],237 single=[], allDouble=[0], rDouble=[], oDouble=[], sDouble=[], triple=[0], benzene=[0],)238atomTypes['Cd' ] = AtomType('Cd', generic=['R','R!H','C','Val4'], specific=[],239 single=[], allDouble=[1], rDouble=[1], oDouble=[0], sDouble=[0], triple=[0], benzene=[0])240atomTypes['Cdd' ] = AtomType('Cdd', generic=['R','R!H','C','Val4'], specific=[],241 single=[0], allDouble=[2], rDouble=[0,1,2], oDouble=[0,1,2], sDouble=[0,1,2], triple=[0], benzene=[0])242atomTypes['Ct' ] = AtomType('Ct', generic=['R','R!H','C','Val4'], specific=[],243 single=[], allDouble=[0], rDouble=[], oDouble=[], sDouble=[], triple=[1], benzene=[0])244atomTypes['CO' ] = AtomType('CO', generic=['R','R!H','C','Val4'], specific=[],245 single=[], allDouble=[1], rDouble=[0], oDouble=[1], sDouble=[0], triple=[0], benzene=[0])246atomTypes['Cb' ] = AtomType('Cb', generic=['R','R!H','C','Val4'], specific=[],247 single=[], allDouble=[0], rDouble=[], oDouble=[], sDouble=[0], triple=[0], benzene=[1,2])248atomTypes['Cbf' ] = AtomType('Cbf', generic=['R','R!H','C','Val4'], specific=[],249 single=[], allDouble=[0], rDouble=[], oDouble=[], sDouble=[], triple=[0], benzene=[3])250atomTypes['CS' ] = AtomType('CS', generic=['R','R!H','C','Val4'], specific=[],251 single=[], allDouble=[1], rDouble=[0], oDouble=[0], sDouble=[1], triple=[0], benzene=[0])252atomTypes['N' ] = AtomType('N', generic=['R','R!H','Val5'], specific=['N1sc','N1s','N1d','N2s','N3s','N3d','N3t','N3b','N5s','N5d','N5dd','N5t','N5b'],253 single=[], allDouble=[], rDouble=[], oDouble=[], sDouble=[], triple=[], benzene=[])254atomTypes['N1sc'] = AtomType('N1sc', generic=['R','R!H','N','Val5'], specific=[],255 single=[0,1], allDouble=[0], rDouble=[0], oDouble=[0], sDouble=[0], triple=[0], benzene=[0], lonePairs=[3])256 #examples for N1sc: [NH+]#[N+][N-2] with adjList 1 N u0 p0 c+1 {2,S} {3,T}; 2 H u0 p0 c0 {1,S}; 3 N u0 p0 c+1 {1,T} {4,S}; 4 N u0 p3 c-2 {3,S}257atomTypes['N1s' ] = AtomType('N1s', generic=['R','R!H','N','Val5'], specific=[],258 single=[0,1], allDouble=[0], rDouble=[0], oDouble=[0], sDouble=[0], triple=[0], benzene=[0], lonePairs=[2])259 #examples for N1s: closed shell N-N, closed shell NH260atomTypes['N1d' ] = AtomType('N1d', generic=['R','R!H','N','Val5'], specific=[],261 single=[0], allDouble=[1], rDouble=[], oDouble=[], sDouble=[], triple=[0], benzene=[0], lonePairs=[2])262 #examples for N1d: [N-]=[N+]=N terminal nitrogen on azide (two lone pairs), [N-]=[NH+]263atomTypes['N2s' ] = AtomType('N2s', generic=['R','R!H','N','Val5'], specific=[],264 single=[1,2], allDouble=[0], rDouble=[], oDouble=[], sDouble=[], triple=[0], benzene=[0], lonePairs=[2])265 #examples for N2s: [NH-][S+]=C, [NH-][N+]#C266atomTypes['N3s' ] = AtomType('N3s', generic=['R','R!H','N','Val5'], specific=[],267 single=[0,1,2,3], allDouble=[0], rDouble=[0], oDouble=[0], sDouble=[0], triple=[0], benzene=[0], lonePairs=[1])268 #examples for N3s: NH3, NH2, NH, N, C[NH]...269atomTypes['N3d' ] = AtomType('N3d', generic=['R','R!H','N','Val5'], specific=[],270 single=[0,1], allDouble=[1], rDouble=[], oDouble=[], sDouble=[], triple=[0], benzene=[0], lonePairs=[1])271 #examples for N3d: N=O, N=N, C=N, [O]N=O, [N]=O, [N]=C272atomTypes['N3t' ] = AtomType('N3t', generic=['R','R!H','N','Val5'], specific=[],273 single=[0], allDouble=[0], rDouble=[0], oDouble=[0], sDouble=[0], triple=[1], benzene=[0], lonePairs=[1])274 #examples for N3t: N2, N#C, N#[C], N#CC275atomTypes['N3b' ] = AtomType('N3b', generic=['R','R!H','N','Val5'], specific=[],276 single=[0], allDouble=[0], rDouble=[0], oDouble=[0], sDouble=[0], triple=[0], benzene=[2], lonePairs=[1])277 #examples for N3b: Oxazole, Pyradine, Pyrazine, 1,3,5-Triazine, Benzimidazole, Purine278atomTypes['N5s' ] = AtomType('N5s', generic=['R','R!H','N','Val5'], specific=[],279 single=[0,1,2,3,4], allDouble=[0], rDouble=[0], oDouble=[0], sDouble=[0], triple=[0], benzene=[0], lonePairs=[0])280 #examples for N5s: [NH4+], [NH2+][O-] {N has u1 p0}, [NH3+][O-]281atomTypes['N5d' ] = AtomType('N5d', generic=['R','R!H','N','Val5'], specific=[],282 single=[0,1,2], allDouble=[1], rDouble=[], oDouble=[], sDouble=[], triple=[0], benzene=[0], lonePairs=[0])283 #examples for N5d: O[N+](=O)(O-) nitrate group, [N+](=O)(O)[O-], O=[N+][O-], [N+](=O)(O[N+](=O)[O-])[O-]284atomTypes['N5dd'] = AtomType('N5dd', generic=['R','R!H','N','Val5'], specific=[],285 single=[0], allDouble=[2], rDouble=[], oDouble=[], sDouble=[], triple=[0], benzene=[0], lonePairs=[0])286 #examples for N5dd: N=[N+]=[N-] center nitrogen on azide, [N-]=[N+]=O287atomTypes['N5t' ] = AtomType('N5t', generic=['R','R!H','N','Val5'], specific=[],288 single=[0,1], allDouble=[0], rDouble=[0], oDouble=[0], sDouble=[0], triple=[1], benzene=[0], lonePairs=[0])289 #examples for N5t: C[N+]#[C-] isocyano group, N#[N+][O-], [NH+]#[C-] (note that C- has p1 here), [N+]#[C-] (note that C- has p1 here), [O-][N+]#C, C[N+]#[C-] (note that C- has p1 here)290atomTypes['N5b' ] = AtomType('N5b', generic=['R','R!H','N','Val5'], specific=[],291 single=[0,1], allDouble=[0], rDouble=[0], oDouble=[0], sDouble=[0], triple=[0], benzene=[2], lonePairs=[0])292 #examples for N5b: Pyrrole, Indole, Benzimidazole, Purine (or any of these examples where the H is abstracted from N and leaves a radical?)293atomTypes['O' ] = AtomType('O', generic=['R','R!H','Val6'], specific=['Os','Od','Oa','Ot'])294atomTypes['Os' ] = AtomType('Os', generic=['R','R!H','O','Val6'], specific=[],295 single=[], allDouble=[0], rDouble=[], oDouble=[], sDouble=[], triple=[0], benzene=[0])296atomTypes['Od' ] = AtomType('Od', generic=['R','R!H','O','Val6'], specific=[],297 single=[], allDouble=[1], rDouble=[], oDouble=[], sDouble=[], triple=[], benzene=[])298atomTypes['Oa' ] = AtomType('Oa', generic=['R','R!H','O','Val6'], specific=[],299 single=[0], allDouble=[0], rDouble=[], oDouble=[], sDouble=[], triple=[0], benzene=[0])300atomTypes['Ot' ] = AtomType('Ot', generic=['R','R!H','O','Val6'], specific=[],301 single=[], allDouble=[0], rDouble=[], oDouble=[], sDouble=[], triple=[1], benzene=[0])302atomTypes['Ne' ] = AtomType('Ne', generic=['R','R!H'], specific=[])303atomTypes['Si' ] = AtomType('Si', generic=['R','R!H','Val4'], specific=['Sis','Sid','Sidd','Sit','SiO','Sib','Sibf'])304atomTypes['Sis' ] = AtomType('Sis', generic=['R','R!H','Si','Val4'], specific=[],305 single=[], allDouble=[0], rDouble=[], oDouble=[], sDouble=[], triple=[0], benzene=[0])306atomTypes['SiO' ] = AtomType('SiO', generic=['R','R!H','Si','Val4'], specific=[],307 single=[], allDouble=[1], rDouble=[], oDouble=[1], sDouble=[], triple=[0], benzene=[0])308atomTypes['Sid' ] = AtomType('Sid', generic=['R','R!H','Si','Val4'], specific=[],309 single=[], allDouble=[1], rDouble=[], oDouble=[0], sDouble=[], triple=[0], benzene=[0])310atomTypes['Sidd'] = AtomType('Sidd', generic=['R','R!H','Si','Val4'], specific=[],311 single=[], allDouble=[2], rDouble=[0,1,2], oDouble=[0,1,2], sDouble=[0,1,2], triple=[0], benzene=[0])312atomTypes['Sit' ] = AtomType('Sit', generic=['R','R!H','Si','Val4'], specific=[],313 single=[], allDouble=[0], rDouble=[], oDouble=[], sDouble=[], triple=[1], benzene=[0])314atomTypes['Sib' ] = AtomType('Sib', generic=['R','R!H','Si','Val4'], specific=[],315 single=[], allDouble=[0], rDouble=[], oDouble=[], sDouble=[], triple=[0], benzene=[2])316atomTypes['Sibf'] = AtomType('Sibf', generic=['R','R!H','Si','Val4'], specific=[],317 single=[], allDouble=[0], rDouble=[], oDouble=[], sDouble=[], triple=[0], benzene=[3])318atomTypes['S' ] = AtomType('S', generic=['R','R!H','Val6'], specific=['Ss','Sd','Sa','St'])319atomTypes['Ss' ] = AtomType('Ss', generic=['R','R!H','S','Val6'], specific=[],320 single=[], allDouble=[0], rDouble=[], oDouble=[], sDouble=[], triple=[0], benzene=[0])321atomTypes['Sd' ] = AtomType('Sd', generic=['R','R!H','S','Val6'], specific=[],322 single=[], allDouble=[1], rDouble=[], oDouble=[], sDouble=[], triple=[0], benzene=[0])323atomTypes['Sa' ] = AtomType('Sa', generic=['R','R!H','S','Val6'], specific=[],324 single=[0], allDouble=[0], rDouble=[], oDouble=[], sDouble=[], triple=[0], benzene=[0])325atomTypes['St' ] = AtomType('St', generic=['R','R!H','S','Val6'], specific=[],326 single=[], allDouble=[0], rDouble=[], oDouble=[], sDouble=[], triple=[1], benzene=[0])327atomTypes['Cl' ] = AtomType('Cl', generic=['R','R!H','Val7'], specific=[])328atomTypes['Ar' ] = AtomType('Ar', generic=['R','R!H'], specific=[])329atomTypes['R' ].setActions(incrementBond=['R'], decrementBond=['R'], formBond=['R'], breakBond=['R'], incrementRadical=['R'], decrementRadical=['R'], incrementLonePair=['R'], decrementLonePair=['R'])330atomTypes['R!H' ].setActions(incrementBond=['R!H'], decrementBond=['R!H'], formBond=['R!H'], breakBond=['R!H'], incrementRadical=['R!H'], decrementRadical=['R!H'], incrementLonePair=['R!H'], decrementLonePair=['R!H'])331atomTypes['Val4'].setActions(incrementBond=['Val4'], decrementBond=['Val4'], formBond=['Val4'], breakBond=['Val4'], incrementRadical=['Val4'], decrementRadical=['Val4'], incrementLonePair=['Val4'],decrementLonePair=['Val4'])332atomTypes['Val5'].setActions(incrementBond=['Val5'], decrementBond=['Val5'], formBond=['Val5'], breakBond=['Val5'], incrementRadical=['Val5'], decrementRadical=['Val5'], incrementLonePair=['Val5'],decrementLonePair=['Val5'])333atomTypes['Val6'].setActions(incrementBond=['Val6'], decrementBond=['Val6'], formBond=['Val6'], breakBond=['Val6'], incrementRadical=['Val6'], decrementRadical=['Val6'], incrementLonePair=['Val6'],decrementLonePair=['Val6'])334atomTypes['Val7'].setActions(incrementBond=['Val7'], decrementBond=['Val7'], formBond=['Val7'], breakBond=['Val7'], incrementRadical=['Val7'], decrementRadical=['Val7'], incrementLonePair=['Val7'],decrementLonePair=['Val7'])335atomTypes['H' ].setActions(incrementBond=[], decrementBond=[], formBond=['H'], breakBond=['H'], incrementRadical=['H'], decrementRadical=['H'], incrementLonePair=[], decrementLonePair=[])336atomTypes['He' ].setActions(incrementBond=[], decrementBond=[], formBond=[], breakBond=[], incrementRadical=['He'], decrementRadical=['He'], incrementLonePair=[], decrementLonePair=[])337atomTypes['C' ].setActions(incrementBond=['C'], decrementBond=['C'], formBond=['C'], breakBond=['C'], incrementRadical=['C'], decrementRadical=['C'], incrementLonePair=['C'], decrementLonePair=['C'])338atomTypes['Cs' ].setActions(incrementBond=['Cd','CO','CS'], decrementBond=[], formBond=['Cs'], breakBond=['Cs'], incrementRadical=['Cs'], decrementRadical=['Cs'], incrementLonePair=['Cs'], decrementLonePair=['Cs'])339atomTypes['Cd' ].setActions(incrementBond=['Cdd','Ct'], decrementBond=['Cs'], formBond=['Cd'], breakBond=['Cd'], incrementRadical=['Cd'], decrementRadical=['Cd'], incrementLonePair=['Cd'], decrementLonePair=['Cd'])340atomTypes['Cdd' ].setActions(incrementBond=[], decrementBond=['Cd','CO','CS'], formBond=[], breakBond=[], incrementRadical=[], decrementRadical=[], incrementLonePair=[], decrementLonePair=[])341atomTypes['Ct' ].setActions(incrementBond=[], decrementBond=['Cd','CO','CS'], formBond=['Ct'], breakBond=['Ct'], incrementRadical=['Ct'], decrementRadical=['Ct'], incrementLonePair=['Ct'], decrementLonePair=['Ct'])342atomTypes['CO' ].setActions(incrementBond=['Cdd'], decrementBond=['Cs'], formBond=['CO'], breakBond=['CO'], incrementRadical=['CO'], decrementRadical=['CO'], incrementLonePair=['CO'], decrementLonePair=['CO'])343atomTypes['CS' ].setActions(incrementBond=['Cdd'], decrementBond=['Cs'], formBond=['CS'], breakBond=['CS'], incrementRadical=['CS'], decrementRadical=['CS'], incrementLonePair=['CS'], decrementLonePair=['CS'])344atomTypes['Cb' ].setActions(incrementBond=['Cb'], decrementBond=['Cb'], formBond=['Cb'], breakBond=['Cb'], incrementRadical=['Cb'], decrementRadical=['Cb'], incrementLonePair=[], decrementLonePair=[])345atomTypes['Cbf' ].setActions(incrementBond=['Cbf'], decrementBond=['Cb'], formBond=[], breakBond=['Cb'], incrementRadical=['Cbf'], decrementRadical=['Cbf'], incrementLonePair=[], decrementLonePair=[])346atomTypes['N' ].setActions(incrementBond=['N'], decrementBond=['N'], formBond=['N'], breakBond=['N'], incrementRadical=['N'], decrementRadical=['N'], incrementLonePair=['N'], decrementLonePair=['N'])347atomTypes['N1sc'].setActions(incrementBond=[], decrementBond=[], formBond=[], breakBond=['N1s'], incrementRadical=[], decrementRadical=[], incrementLonePair=[], decrementLonePair=['N1s','N2s'])348atomTypes['N1s' ].setActions(incrementBond=['N1d'], decrementBond=[], formBond=['N1s'], breakBond=['N1s'], incrementRadical=['N1s'], decrementRadical=['N1s'], incrementLonePair=['N1sc'],decrementLonePair=['N3s'])349atomTypes['N1d' ].setActions(incrementBond=[], decrementBond=['N1s'], formBond=[], breakBond=[], incrementRadical=[], decrementRadical=[], incrementLonePair=[], decrementLonePair=['N3d'])350atomTypes['N2s' ].setActions(incrementBond=[], decrementBond=[], formBond=['N2s'], breakBond=['N2s'], incrementRadical=['N2s'], decrementRadical=['N2s'], incrementLonePair=[], decrementLonePair=['N3s'])351atomTypes['N3s' ].setActions(incrementBond=['N3d'], decrementBond=[], formBond=['N3s'], breakBond=['N3s'], incrementRadical=['N3s'], decrementRadical=['N3s'], incrementLonePair=['N1s','N2s'],decrementLonePair=['N5s'])352atomTypes['N3d' ].setActions(incrementBond=['N3t'], decrementBond=['N3s'], formBond=['N3d'], breakBond=['N3d'], incrementRadical=['N3d'], decrementRadical=['N3d'], incrementLonePair=['N1d'], decrementLonePair=['N5d'])353atomTypes['N3t' ].setActions(incrementBond=[], decrementBond=['N3d'], formBond=[], breakBond=[], incrementRadical=[], decrementRadical=[], incrementLonePair=[], decrementLonePair=['N5t'])354atomTypes['N3b' ].setActions(incrementBond=[], decrementBond=[], formBond=[], breakBond=[], incrementRadical=[], decrementRadical=[], incrementLonePair=[], decrementLonePair=[])355atomTypes['N5s' ].setActions(incrementBond=['N5d'], decrementBond=[], formBond=['N5s'], breakBond=['N5s'], incrementRadical=['N5s'], decrementRadical=['N5s'], incrementLonePair=['N3s'], decrementLonePair=[])356atomTypes['N5d' ].setActions(incrementBond=['N5dd','N5t'], decrementBond=['N5s'], formBond=['N5d'], breakBond=['N5d'], incrementRadical=['N5d'], decrementRadical=['N5d'], incrementLonePair=['N3d'], decrementLonePair=[])357atomTypes['N5dd'].setActions(incrementBond=[], decrementBond=['N5d'], formBond=[], breakBond=[], incrementRadical=[], decrementRadical=[], incrementLonePair=[], decrementLonePair=[])358atomTypes['N5t' ].setActions(incrementBond=[], decrementBond=['N5d'], formBond=['N5t'], breakBond=['N5t'], incrementRadical=['N5t'], decrementRadical=['N5t'], incrementLonePair=['N3t'], decrementLonePair=[])359atomTypes['N5b' ].setActions(incrementBond=[], decrementBond=[], formBond=['N5b'], breakBond=['N5b'], incrementRadical=['N5b'], decrementRadical=['N5b'], incrementLonePair=[], decrementLonePair=[])360atomTypes['O' ].setActions(incrementBond=['O'], decrementBond=['O'], formBond=['O'], breakBond=['O'], incrementRadical=['O'], decrementRadical=['O'], incrementLonePair=['O'], decrementLonePair=['O'])361atomTypes['Os' ].setActions(incrementBond=['Od'], decrementBond=[], formBond=['Os'], breakBond=['Os'], incrementRadical=['Os'], decrementRadical=['Os'], incrementLonePair=['Os'], decrementLonePair=['Os'])362atomTypes['Od' ].setActions(incrementBond=[], decrementBond=['Os'], formBond=[], breakBond=[], incrementRadical=[], decrementRadical=[], incrementLonePair=['Od'], decrementLonePair=['Od'])363atomTypes['Oa' ].setActions(incrementBond=[], decrementBond=[], formBond=[], breakBond=[], incrementRadical=[], decrementRadical=[], incrementLonePair=[], decrementLonePair=[])364atomTypes['Ot' ].setActions(incrementBond=[], decrementBond=['Od'], formBond=[], breakBond=[], incrementRadical=[], decrementRadical=[], incrementLonePair=['Ot'], decrementLonePair=['Ot'])365atomTypes['Ne' ].setActions(incrementBond=[], decrementBond=[], formBond=[], breakBond=[], incrementRadical=['Ne'], decrementRadical=['Ne'], incrementLonePair=[], decrementLonePair=[])366atomTypes['Si' ].setActions(incrementBond=['Si'], decrementBond=['Si'], formBond=['Si'], breakBond=['Si'], incrementRadical=['Si'], decrementRadical=['Si'], incrementLonePair=[], decrementLonePair=[])367atomTypes['Sis' ].setActions(incrementBond=['Sid','SiO'], decrementBond=[], formBond=['Sis'], breakBond=['Sis'], incrementRadical=['Sis'], decrementRadical=['Sis'], incrementLonePair=[], decrementLonePair=[])368atomTypes['Sid' ].setActions(incrementBond=['Sidd','Sit'], decrementBond=['Sis'], formBond=['Sid'], breakBond=['Sid'], incrementRadical=['Sid'], decrementRadical=['Sid'], incrementLonePair=[], decrementLonePair=[])369atomTypes['Sidd'].setActions(incrementBond=[], decrementBond=['Sid','SiO'], formBond=[], breakBond=[], incrementRadical=[], decrementRadical=[], incrementLonePair=[], decrementLonePair=[])370atomTypes['Sit' ].setActions(incrementBond=[], decrementBond=['Sid'], formBond=['Sit'], breakBond=['Sit'], incrementRadical=['Sit'], decrementRadical=['Sit'], incrementLonePair=[], decrementLonePair=[])371atomTypes['SiO' ].setActions(incrementBond=['Sidd'], decrementBond=['Sis'], formBond=['SiO'], breakBond=['SiO'], incrementRadical=['SiO'], decrementRadical=['SiO'], incrementLonePair=[], decrementLonePair=[])372atomTypes['Sib' ].setActions(incrementBond=[], decrementBond=[], formBond=['Sib'], breakBond=['Sib'], incrementRadical=['Sib'], decrementRadical=['Sib'], incrementLonePair=[], decrementLonePair=[])373atomTypes['Sibf'].setActions(incrementBond=[], decrementBond=[], formBond=[], breakBond=[], incrementRadical=[], decrementRadical=[], incrementLonePair=[], decrementLonePair=[])374atomTypes['S' ].setActions(incrementBond=['S'], decrementBond=['S'], formBond=['S'], breakBond=['S'], incrementRadical=['S'], decrementRadical=['S'], incrementLonePair=['S'], decrementLonePair=['S'])375atomTypes['Ss' ].setActions(incrementBond=['Sd'], decrementBond=[], formBond=['Ss'], breakBond=['Ss'], incrementRadical=['Ss'], decrementRadical=['Ss'], incrementLonePair=['Ss'], decrementLonePair=['Ss'])376atomTypes['Sd' ].setActions(incrementBond=[], decrementBond=['Ss'], formBond=[], breakBond=[], incrementRadical=[], decrementRadical=[], incrementLonePair=['Sd'], decrementLonePair=['Sd'])377atomTypes['Sa' ].setActions(incrementBond=[], decrementBond=[], formBond=[], breakBond=[], incrementRadical=[], decrementRadical=[], incrementLonePair=[], decrementLonePair=[])378atomTypes['St' ].setActions(incrementBond=[], decrementBond=['Sd'], formBond=[], breakBond=[], incrementRadical=[], decrementRadical=[], incrementLonePair=['St'], decrementLonePair=['St'])379atomTypes['Cl' ].setActions(incrementBond=[], decrementBond=['Cl'], formBond=['Cl'], breakBond=['Cl'], incrementRadical=['Cl'], decrementRadical=['Cl'], incrementLonePair=[], decrementLonePair=[])380atomTypes['Ar' ].setActions(incrementBond=[], decrementBond=[], formBond=[], breakBond=[], incrementRadical=[], decrementRadical=[], incrementLonePair=[], decrementLonePair=[])381#list of elements that do not have more specific atomTypes382#these are ordered on priority of picking if we encounter a more general atomType for make383allElements=['H', 'C', 'O', 'N', 'S', 'Si', 'Cl', 'Ne', 'Ar', 'He',]384nonSpecifics=['H', 'He', 'Ne', 'Cl', 'Ar',]385for atomType in atomTypes.values():386 for items in [atomType.generic, atomType.specific,387 atomType.incrementBond, atomType.decrementBond, atomType.formBond,388 atomType.breakBond, atomType.incrementRadical, atomType.decrementRadical, atomType.incrementLonePair, atomType.decrementLonePair]:389 for index in range(len(items)):390 items[index] = atomTypes[items[index]]391def getFeatures(atom, bonds):392 """393 Returns a list of features needed to determine atomType for :class:'Atom'394 or :class:'GroupAtom' object 'atom and with local bond structure `bonds`,395 a ``dict`` containing atom-bond pairs.396 """397 cython.declare(single=cython.int, allDouble=cython.int, rDouble=cython.int,398 sDouble=cython.int, oDouble=cython.int, triple=cython.int,399 benzene=cython.int)400 cython.declare(features=cython.list)401 # Count numbers of each higher-order bond type402 single = 0; rDouble = 0; oDouble = 0; sDouble = 0; triple = 0; benzene = 0403 for atom2, bond12 in bonds.iteritems():404 if bond12.isSingle():405 single += 1406 elif bond12.isDouble():407 if atom2.isOxygen():408 oDouble += 1409 elif atom2.isSulfur():410 sDouble += 1411 else:412 # rDouble is for double bonds NOT to oxygen or Sulfur413 rDouble += 1414 elif bond12.isTriple(): triple += 1415 elif bond12.isBenzene(): benzene += 1416 # allDouble is for all double bonds, to anything417 allDouble = rDouble + oDouble + sDouble418 features = [single, allDouble, rDouble, oDouble, sDouble, triple, benzene, atom.lonePairs]419 return features420def getAtomType(atom, bonds):421 """422 Determine the appropriate atom type for an :class:`Atom` object `atom`423 with local bond structure `bonds`, a ``dict`` containing atom-bond pairs.424 """425 cython.declare(atomSymbol=str)426 cython.declare(molFeatureList=cython.list, atomTypeFeatureList=cython.list)427 # Use element and counts to determine proper atom type428 atomSymbol = atom.symbol429 #These elements do not do not have a more specific atomType430 if atomSymbol in nonSpecifics:431 return atomTypes[atomSymbol]432 molFeatureList = getFeatures(atom, bonds)433 for specificAtomType in atomTypes[atomSymbol].specific:434 atomtypeFeatureList = specificAtomType.getFeatures()435 for molFeature, atomtypeFeature in zip(molFeatureList, atomtypeFeatureList):436 if atomtypeFeature == []:437 continue438 elif molFeature not in atomtypeFeature:439 break440 else:441 return specificAtomType442 else:443 single = molFeatureList[0]444 rDouble = molFeatureList[2]445 oDouble = molFeatureList[3]446 sDouble = molFeatureList[4]447 triple = molFeatureList[5]448 benzene = molFeatureList[6]449 lonePairs = molFeatureList[7]450 raise AtomTypeError(451 'Unable to determine atom type for atom {0}, which has {1:d} single bonds, {2:d} double bonds to C, {3:d} double bonds to O, {4:d} double bonds to S, {5:d} triple bonds, {6:d} benzene bonds, and {7:d} lone pairs.'.format(...

Full Screen

Full Screen

certificateTemplate.js

Source:certificateTemplate.js Github

copy

Full Screen

1// JavaScript Document2var ie=document.all;3var nn6=document.getElementById&&!document.all;45var isdrag=false;6var x,y;7var dobj;89function movemouse(e)10{11 if (isdrag)12 {13 dobj.style.left = nn6 ? tx + e.clientX - x : tx + event.clientX - x;14 dobj.style.top = nn6 ? ty + e.clientY - y : ty + event.clientY - y;15 16 return false;17 } 18}1920function selectmouse(e) 21{22 var fobj = nn6 ? e.target : event.srcElement;23 var topelement = nn6 ? "HTML" : "BODY";2425 while (fobj.tagName != topelement && fobj.className != "dragme")26 {27 fobj = nn6 ? fobj.parentNode : fobj.parentElement;28 }2930 if (fobj.className=="dragme")31 {32 isdrag = true;33 dobj = fobj;34 tx = parseInt(dobj.style.left+0);35 ty = parseInt(dobj.style.top+0);36 x = nn6 ? e.clientX : event.clientX;37 y = nn6 ? e.clientY : event.clientY; 38 document.onmousemove=movemouse;39 return false;40 }41}4243document.onmousedown=selectmouse;44document.onmouseup=new Function("isdrag=false");4546function loadInitials(){4748 if(document.getElementById('radioOriantation_0').checked == true){49 var oriant = 'L';50 var leftDecrement = 285;51 var topDecrement = 210;52 }53 else if(document.getElementById('radioOriantation_1').checked == true){54 var oriant = 'P';55 var leftDecrement = 260;56 var topDecrement = 150;57 }58 if(document.getElementById('radioLabel_0').checked == true)59 var labels = 'Y';60 else if(document.getElementById('radioLabel_1').checked == true)61 var labels = 'N';6263 if(labels == 'Y'){64 if(jsArray[0] > 0){65 var Yname = document.getElementById('lblname1');66 Yname.style.left = parseInt(parseInt(jsArray[0]) + parseInt(leftDecrement));67 Yname.style.top = parseInt(parseInt(jsArray[1]) + parseInt(topDecrement));68 }69 if(jsArray[2] > 0){70 var Yitem = document.getElementById('lblitem1');71 Yitem.style.left = parseInt(parseInt(jsArray[2]) + parseInt(leftDecrement));72 Yitem.style.top = parseInt(parseInt(jsArray[3]) + parseInt(topDecrement));73 }74 if(jsArray[4] > 0){75 var Ycat = document.getElementById('lblcat1');76 Ycat.style.left = parseInt(parseInt(jsArray[4]) + parseInt(leftDecrement));77 Ycat.style.top = parseInt(parseInt(jsArray[5]) + parseInt(topDecrement));78 }79 if(jsArray[6] > 0){80 var Ygrade = document.getElementById('iblgrade1');81 Ygrade.style.left = parseInt(parseInt(jsArray[6]) + parseInt(leftDecrement));82 Ygrade.style.top = parseInt(parseInt(jsArray[7]) + parseInt(topDecrement));83 }84 if(jsArray[8] > 0){85 var Yclass = document.getElementById('lblclass1');86 Yclass.style.left = parseInt(parseInt(jsArray[8]) + parseInt(leftDecrement));87 Yclass.style.top = parseInt(parseInt(jsArray[9]) + parseInt(topDecrement));88 }89 if(jsArray[10] > 0){90 var Yschool = document.getElementById('lblschool1');91 Yschool.style.left = parseInt(parseInt(jsArray[10]) + parseInt(leftDecrement));92 Yschool.style.top = parseInt(parseInt(jsArray[11]) + parseInt(topDecrement));93 }94 if(jsArray[12] > 0){95 var Ysub = document.getElementById('lblsubdist1');96 Ysub.style.left = parseInt(parseInt(jsArray[12]) + parseInt(leftDecrement));97 Ysub.style.top = parseInt(parseInt(jsArray[13]) + parseInt(topDecrement));98 }99 if(jsArray[14] > 0){100 var Ydate = document.getElementById('ibldate1');101 Ydate.style.left = parseInt(parseInt(jsArray[14]) + parseInt(leftDecrement));102 Ydate.style.top = parseInt(parseInt(jsArray[15]) + parseInt(topDecrement));103 }104 if(jsArray[16] > 0){105 var Yplace = document.getElementById('lablplace1');106 Yplace.style.left = parseInt(parseInt(jsArray[16]) + parseInt(leftDecrement));107 Yplace.style.top = parseInt(parseInt(jsArray[17]) + parseInt(topDecrement));108 }109 if(jsArray[18] > 0){110 var Yehs = document.getElementById('lblefh1');111 Yehs.style.left = parseInt(parseInt(jsArray[18]) + parseInt(leftDecrement));112 Yehs.style.top = parseInt(parseInt(jsArray[19]) + parseInt(topDecrement));113 }114 }else if(labels == 'N'){115 116 if(jsArray[0] > 0){117 var Yname = document.getElementById('lblname');118 Yname.style.left = parseInt(parseInt(jsArray[0]) + parseInt(leftDecrement));119 Yname.style.top = parseInt(parseInt(jsArray[1]) + parseInt(topDecrement));120 121 }122 if(jsArray[2] > 0){123 var Yitem = document.getElementById('lblitem');124 Yitem.style.left = parseInt(parseInt(jsArray[2]) + parseInt(leftDecrement));125 Yitem.style.top = parseInt(parseInt(jsArray[3]) + parseInt(topDecrement));126 }127 if(jsArray[4] > 0){128 var Ycat = document.getElementById('lblcat');129 Ycat.style.left = parseInt(parseInt(jsArray[4]) + parseInt(leftDecrement));130 Ycat.style.top = parseInt(parseInt(jsArray[5]) + parseInt(topDecrement));131 }132 if(jsArray[6] > 0){133 var Ygrade = document.getElementById('iblgrade');134 Ygrade.style.left = parseInt(parseInt(jsArray[6]) + parseInt(leftDecrement));135 Ygrade.style.top = parseInt(parseInt(jsArray[7]) + parseInt(topDecrement));136 }137 if(jsArray[8] > 0){138 var Yclass = document.getElementById('lblclass');139 Yclass.style.left = parseInt(parseInt(jsArray[8]) + parseInt(leftDecrement));140 Yclass.style.top = parseInt(parseInt(jsArray[9]) + parseInt(topDecrement));141 }142 if(jsArray[10] > 0){143 var Yschool = document.getElementById('lblschool');144 Yschool.style.left = parseInt(parseInt(jsArray[10]) + parseInt(leftDecrement));145 Yschool.style.top = parseInt(parseInt(jsArray[11]) + parseInt(topDecrement));146 }147 if(jsArray[12] > 0){148 var Ysub = document.getElementById('lblsubdist');149 Ysub.style.left = parseInt(parseInt(jsArray[12]) + parseInt(leftDecrement));150 Ysub.style.top = parseInt(parseInt(jsArray[13]) + parseInt(topDecrement));151 }152 if(jsArray[14] > 0){153 var Ydate = document.getElementById('ibldate');154 Ydate.style.left = parseInt(parseInt(jsArray[14]) + parseInt(leftDecrement));155 Ydate.style.top = parseInt(parseInt(jsArray[15]) + parseInt(topDecrement));156 }157 if(jsArray[16] > 0){158 var Yplace = document.getElementById('lablplace');159 Yplace.style.left = parseInt(parseInt(jsArray[16]) + parseInt(leftDecrement));160 Yplace.style.top = parseInt(parseInt(jsArray[17]) + parseInt(topDecrement));161 }162 if(jsArray[18] > 0){163 var Yehs = document.getElementById('lblefh');164 Yehs.style.left = parseInt(parseInt(jsArray[18]) + parseInt(leftDecrement));165 Yehs.style.top = parseInt(parseInt(jsArray[19]) + parseInt(topDecrement));166 } 167 }168 return true; 169}170function selectOriantation(obj){171 var theTable = document.getElementById('oriantationtable');172 if(obj == 'L'){173 theTable.style.width = '679px';174 theTable.style.height = '475px';175 }176 if(obj == 'P'){177 theTable.style.width = '475px';178 theTable.style.height = '679px';179 }180}181function selectItems(obj){182 var mydiv = document.getElementById('withoutlabel');183 if(obj == 'N'){184 mydiv.style.display = 'block';185 document.getElementById('withlabel').style.display='none';186 /*document.getElementById('lblname1').style.display='none';187 document.getElementById('lblitem1').style.display='none';188 document.getElementById('lblcat1').style.display='none';189 document.getElementById('iblgrade1').style.display='none';190 document.getElementById('lblclass1').style.display='none';191 document.getElementById('lblschool1').style.display='none';192 document.getElementById('lblsubdist1').style.display='none';193 document.getElementById('ibldate1').style.display='none';194 document.getElementById('lablplace1').style.display='none';195 document.getElementById('lblefh1').style.display='none';*/196 }197 else if(obj == 'Y'){198 mydiv.style.display = 'none'; 199 document.getElementById('withlabel').style.display='block';200 /*document.getElementById('lblname1').style.display='block';201 document.getElementById('lblitem1').style.display='block';202 document.getElementById('lblcat1').style.display='block';203 document.getElementById('iblgrade1').style.display='block';204 document.getElementById('lblclass1').style.display='block';205 document.getElementById('lblschool1').style.display='block';206 document.getElementById('lblsubdist1').style.display='block';207 document.getElementById('ibldate1').style.display='block';208 document.getElementById('lablplace1').style.display='block';209 document.getElementById('lblefh1').style.display='block';*/210 211 }212213}214function findPos() {215 var obj = document.getElementById('oriantationtable');216 var curleft = curtop = 0;217 if (obj.offsetParent) {218 curleft = obj.offsetLeft219 curtop = obj.offsetTop220 while (obj = obj.offsetParent) {221 curleft += obj.offsetLeft222 curtop += obj.offsetTop223 }224 }225 document.getElementById('displaydiv').innerHTML = 'Starting Possition -> '+curleft+' : '+curtop;226 var Yname = document.getElementById('lblname1');227 alert(Yname.offsetLeft);228 alert(Yname.offsetTop);229 /*Yname.style.left = jsArray[0];230 Yname.style.top = jsArray[1];231 alert(Yname.offsetLeft);232 alert(Yname.offsetTop);233 return true;*/234 //return [curleft,curtop];235}236237function saveCertificateTemplate(){238239 if(document.getElementById('radioOriantation_0').checked == true){240 var oriant = 'L';241 var leftDecrement = 285;242 var topDecrement = 210;243 document.getElementById('cboPageStyle').value = 'L';244 245 }246 else if(document.getElementById('radioOriantation_1').checked == true){247 var oriant = 'P';248 var leftDecrement = 260;249 var topDecrement = 150;250 document.getElementById('cboPageStyle').value = 'P';251 }252 if(document.getElementById('radioLabel_0').checked == true){253 var labels = 'Y';254 document.getElementById('cboLabelPrint').value = 'Y';255 }256 else if(document.getElementById('radioLabel_1').checked == true){257 var labels = 'N';258 document.getElementById('cboLabelPrint').value = 'N';259 } 260261 if(labels == 'Y'){262 263 var Yname = document.getElementById('lblname1');264 if(Yname.offsetLeft > 200 && Yname.offsetTop > 50){265 document.getElementById('txtNameX').value = (Yname.offsetLeft) - parseInt(leftDecrement);266 document.getElementById('txtNameY').value = (Yname.offsetTop) - parseInt(topDecrement);267 }268 269 var Yitem = document.getElementById('lblitem1');270 if(Yitem.offsetLeft > 200 && Yitem.offsetTop > 50){271 document.getElementById('txtItemX').value = (Yitem.offsetLeft) - parseInt(leftDecrement);272 document.getElementById('txtItemY').value = (Yitem.offsetTop) - parseInt(topDecrement);273 }274 275 var Ycat = document.getElementById('lblcat1');276 if(Ycat.offsetLeft > 200 && Ycat.offsetTop > 50){277 document.getElementById('txtCategoryX').value = (Ycat.offsetLeft) - parseInt(leftDecrement);278 document.getElementById('txtCategoryY').value = (Ycat.offsetTop) - parseInt(topDecrement);279 }280 281 var Ygrade = document.getElementById('iblgrade1');282 if(Ygrade.offsetLeft > 200 && Ygrade.offsetTop > 50){283 document.getElementById('txtGradeX').value = (Ygrade.offsetLeft) - parseInt(leftDecrement);284 document.getElementById('txtGradeY').value = (Ygrade.offsetTop) - parseInt(topDecrement);285 }286 287 var Yclass = document.getElementById('lblclass1');288 if(Yclass.offsetLeft > 200 && Yclass.offsetTop > 50){289 document.getElementById('txtClassX').value = (Yclass.offsetLeft) - parseInt(leftDecrement);290 document.getElementById('txtClassY').value = (Yclass.offsetTop) - parseInt(topDecrement);291 }292 293 var Yschool = document.getElementById('lblschool1');294 if(Yschool.offsetLeft > 200 && Yschool.offsetTop > 50){295 document.getElementById('txtSchoolX').value = (Yschool.offsetLeft) - parseInt(leftDecrement);296 document.getElementById('txtSchoolY').value = (Yschool.offsetTop) - parseInt(topDecrement);297 }298 299 var Ysub = document.getElementById('lblsubdist1');300 if(Ysub.offsetLeft > 200 && Ysub.offsetTop > 50){301 document.getElementById('txtSubdistrictX').value = (Ysub.offsetLeft) - parseInt(leftDecrement);302 document.getElementById('txtSubdistrictY').value = (Ysub.offsetTop) - parseInt(topDecrement);303 }304 305 var Ydate = document.getElementById('ibldate1');306 if(Ydate.offsetLeft > 200 && Ydate.offsetTop > 50){307 document.getElementById('txtDateX').value = (Ydate.offsetLeft) - parseInt(leftDecrement);308 document.getElementById('txtDateY').value = (Ydate.offsetTop) - parseInt(topDecrement);309 }310 311 var Yplace = document.getElementById('lablplace1');312 if(Yplace.offsetLeft > 200 && Yplace.offsetTop > 50){313 document.getElementById('txtPlaceX').value = (Yplace.offsetLeft) - parseInt(leftDecrement);314 document.getElementById('txtPlaceY').value = (Yplace.offsetTop) - parseInt(topDecrement);315 }316 317 var Yehs = document.getElementById('lblefh1');318 if(Yehs.offsetLeft > 200 && Yehs.offsetTop > 50){319 document.getElementById('txtehsX').value = (Yehs.offsetLeft) - parseInt(leftDecrement);320 document.getElementById('txtehsY').value = (Yehs.offsetTop) - parseInt(topDecrement);321 }322323 }else if(labels == 'N'){324325 var Yname = document.getElementById('lblname'); 326 if(Yname.offsetLeft > 200 && Yname.offsetTop > 50){327 document.getElementById('txtNameX').value = (Yname.offsetLeft) - parseInt(leftDecrement);328 document.getElementById('txtNameY').value = (Yname.offsetTop) - parseInt(topDecrement);329 }330 331 var Yitem = document.getElementById('lblitem');332 if(Yitem.offsetLeft > 200 && Yitem.offsetTop > 50){333 document.getElementById('txtItemX').value = (Yitem.offsetLeft) - parseInt(leftDecrement);334 document.getElementById('txtItemY').value = (Yitem.offsetTop) - parseInt(topDecrement);335 }336 337 var Ycat = document.getElementById('lblcat');338 if(Ycat.offsetLeft > 200 && Ycat.offsetTop > 50){339 document.getElementById('txtCategoryX').value = (Ycat.offsetLeft) - parseInt(leftDecrement);340 document.getElementById('txtCategoryY').value = (Ycat.offsetTop) - parseInt(topDecrement);341 }342 343 var Ygrade = document.getElementById('iblgrade');344 if(Ygrade.offsetLeft > 200 && Ygrade.offsetTop > 50){345 document.getElementById('txtGradeX').value = (Ygrade.offsetLeft) - parseInt(leftDecrement);346 document.getElementById('txtGradeY').value = (Ygrade.offsetTop) - parseInt(topDecrement);347 }348 349 var Yclass = document.getElementById('lblclass');350 if(Yclass.offsetLeft > 200 && Yclass.offsetTop > 50){351 document.getElementById('txtClassX').value = (Yclass.offsetLeft) - parseInt(leftDecrement);352 document.getElementById('txtClassY').value = (Yclass.offsetTop) - parseInt(topDecrement);353 }354 355 var Yschool = document.getElementById('lblschool');356 if(Yschool.offsetLeft > 200 && Yschool.offsetTop > 50){357 document.getElementById('txtSchoolX').value = (Yschool.offsetLeft) - parseInt(leftDecrement);358 document.getElementById('txtSchoolY').value = (Yschool.offsetTop) - parseInt(topDecrement);359 }360 361 var Ysub = document.getElementById('lblsubdist');362 if(Ysub.offsetLeft > 200 && Ysub.offsetTop > 50){363 document.getElementById('txtSubdistrictX').value = (Ysub.offsetLeft) - parseInt(leftDecrement);364 document.getElementById('txtSubdistrictY').value = (Ysub.offsetTop) - parseInt(topDecrement);365 }366 367 var Ydate = document.getElementById('ibldate');368 if(Ydate.offsetLeft > 200 && Ydate.offsetTop > 50){369 document.getElementById('txtDateX').value = (Ydate.offsetLeft) - parseInt(leftDecrement);370 document.getElementById('txtDateY').value = (Ydate.offsetTop) - parseInt(topDecrement);371 }372 373 var Yplace = document.getElementById('lablplace');374 if(Yplace.offsetLeft > 200 && Yplace.offsetTop > 50){375 document.getElementById('txtPlaceX').value = (Yplace.offsetLeft) - parseInt(leftDecrement);376 document.getElementById('txtPlaceY').value = (Yplace.offsetTop) - parseInt(topDecrement);377 }378 379 var Yehs = document.getElementById('lblefh');380 if(Yehs.offsetLeft > 200 && Yehs.offsetTop > 50){381 document.getElementById('txtehsX').value = (Yehs.offsetLeft) - parseInt(leftDecrement);382 document.getElementById('txtehsY').value = (Yehs.offsetTop) - parseInt(topDecrement);383 } 384 385 }else{386 alert('Some error occured while saving plase try again'); 387 return false;388 }389390 document.getElementById('formCertificatedrag').action = path+'index.php/certificate/certificate/save_certificate_template';391 document.getElementById('formCertificatedrag').submit();392} ...

Full Screen

Full Screen

Counter.jsx

Source:Counter.jsx Github

copy

Full Screen

...32 return { counter: prevState.counter + by }33 }34 );35 }36 decrement(by) {37 //console.log(`increment from child - ${by}`)38 this.setState(39 (prevState) => {40 return { counter: prevState.counter - by }41 }42 );43 }44}45class CounterButton extends Component {46 //Define the initial state in a constructor47 //state => counter 048 //constructor() {49 // super(); //Error 150 // this.state = {...

Full Screen

Full Screen

task4.js

Source:task4.js Github

copy

Full Screen

...11 return counter;12 },13 };14})()15decrementNUm.decrement(10);16decrementNUm.decrement();17decrementNUm.decrement();18decrementNUm.decrement();19decrementNUm.decrement();20decrementNUm.decrement();...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful