Skip to content

Instantly share code, notes, and snippets.

@newmen
Last active May 7, 2016 14:38
Show Gist options
  • Save newmen/3164058f59df9706c832 to your computer and use it in GitHub Desktop.
Save newmen/3164058f59df9706c832 to your computer and use it in GitHub Desktop.
Declaration of find algorithm builder
COMMON: ##########################################################################################################
intermediate checking order # =>
> none
> more number of amorph bonds of unit atom in unit specie
> more number of crystal bonds of unit atom in unit specie
> more number of unit specie relations
public:
order of find algorithm
for each entry unit # +<
search from (unit)
create context entity
optimize definition places in combined algorithm # ->
check avail species of (unit)
each filtered inner unit
is checkable? (unit)
define avail species of (unit)
check new atoms from (unit)
check relations between (self unit, neighbour unit)
is neighbours? (self unit, neighbour unit)
if all neighbour atoms are defined and all relations are bonds # +<
check bonds between self atoms and neighbour atoms # +<
else
iterate relations between (self atoms, neighbour atoms)
check private relations of (self unit)
each pair of self and neighbour atoms and relation between them # +<
if iterating relation exists # +<
check roles of (neighbour atom)
check bond between (self atom, neighbour atom)
is need to check relation between neighbour atoms?
check bond between (neighbour atom, neighbour atom)
let "defined neighbour next same atoms" are close atoms avail from undefined species of neighbour unit # +<
check avail species of (neighbour unit)
check that "defined neighbour next same atoms" are equal to self unit atoms # +<
check private relations of (neighbour unit)
private:
each filtered inner unit
select inner units with undefined specie and defined atom or with defined specie and undefined atom # +<
if all inner units was selected and they contains the same atom which has similar role in unit species # +<
take self unit as item of list with one element # +<
else
list of selected inner units # +<
is checkable? (unit)
if unit species are not none # +< # actually just for species find algorithm
and any unit specie is not defined # +<
and any unit atom is anchor (of any undefined unit specie) # +<
is neighbours? (self unit, neighbour unit)
is relayable
or not all neighbour unit species are same as self unit species # +<
check new atoms from (unit)
if any unit specie is defined # +<
check close atoms of (unit)
let defined context atoms which belongs to unit species are reached atoms # +<
if reached atoms are exists # +<
is unit symmetric?
or any of reached atoms is related from other units # +<
check that reached atoms have 'not existed relations' to defined atoms of not unit species are not equal to reached atoms # +<
check that reached atoms have 'existed relations' to defined atoms of not unit species are equal to reached atoms # +<
check roles of (atoms)
check that atoms have specific types # +<
is mono-atom unit?
if unit contains just one unique atom # +<
is mono symmetric unit?
is mono-atom unit?
and number of atom symmetries is more than number of unified unit species # +<
is asymmetric related atoms?
if unit species have undefined symmetric context atoms which belongs to any other unit # +<
is asymmetric other side?
is asymmetric other side?
if symmetric context atoms are related to another atoms which are not symmetric between each other # +<
or relations to related context atoms are different # +<
or units of related context atoms contains different species # +<
is partially symmetric?
if few (not all) unit atoms are symmetric # +<
and these atoms have similar relations and similar neighbour units # +<
is unit symmetric?
is mono symmetric unit?
or is asymmetric related atoms?
or is partially symmetric?
define undefined atoms of (unit)
if there are undefined unit atoms # +<
define undefined unit atoms # +<
iterate symmetries of (unit)
if quantity of unique unit atoms and unified by original unit species is more that 1 # +<
define undefined atoms of (unit)
redefine atoms as array if need
iterate symmetric atoms over for loop # +<
else # there is just one specie of unit
# the specie should be already defined
iterate specie symmetries # +<
check symmetries of (unit)
is unit symmetric?
let "defined next same atoms" are close atoms avail from defined species of unit # +<
iterate symmetries of (unit)
check that "defined next same atoms" are equal to analogies unit atoms # +<
is need to check relation between neighbour atoms?
if number of neighbour atoms with existing relations to self atoms is more than 1 # +<
and there is relation between neighbour atoms # +<
redefine atoms as array if need
if number of self atoms is more that 1 and not all of them are same array # +<
redefine self atoms as array # +<
iterate relations between (self atoms, neighbour atoms)
if all self and neighbour atoms have lattice # +<
redefine atoms as array if need
if all neighbour atoms are defined # +<
redefine neighbour atoms as array # +<
if quantity of neighbour atoms is more than quantity of self atoms # +<
all neighbours in direction of relation from (self atom) # +<
elsif quantity of neighbour atoms is less than quantity of self atoms # +<
get neighbour in direction of relation from (self atoms) # +<
else # if quantity of neighbour atoms is equal to quantity of self atoms
each neighbours in direction of relation from (self atoms) # +<
elsif self unit has just one atom and neighbour unit also has just one atom # +<
if neighbour atom havent lattice # +<
each amorph neighbour from (self atom) # +<
elsif self unit atom havent lattice # +<
each crystal neighbour from (self atom) # +<
check bond between (self atom, neighbour atom)
if relation is bond # +<
and it belongs to crystal lattice # +<
or related atoms not belongs to equal species # +<
check that relation has # +<
check private relations of (unit)
# check that context relations are not same as private relations
if unit atoms have existed relations to atoms of another units in full context graph # +<
and same relations from these atoms are used in unit species # +<
and atoms properties which neighboured via self unit species are like atom properties from another unit # +<
check that atoms from another units are not same as atoms with similar relations from self unit species # +<
SPECIES_AND_REACTIONS: ###########################################################################################
private:
search from (unit)
reset! (dict) # +<
first assign! (unit) # +<
full check of (unit)
full check of (unit)
check existence (unit)
for each key unit of algorithm backbone # +<
check avail species of (unit)
for each neighbour unit # +<
check relations between (self unit, neighbour unit)
SPECIES: #########################################################################################################
public:
check existence (unit)
check avail atoms of (unit)
check that defined atoms do not known about context specie # +<
create context entity
if all species were defined # +<
if number of defined species is more that 1 # +<
redefine defined species as array # +<
if number of additional atoms is more that 1 and not all of them are same array # +<
redefine additional atoms as array # +<
if number of additional atoms is more that 0 # +<
create it by additional atoms and defined species # +<
else
create it by defined species # +<
else
redefine context specie atoms as array # +<
create it by atoms # +<
private:
check avail atoms of (unit)
if there are previous defined unit species # +<
check symmetries of (unit)
check close atoms of (unit)
else
check roles of (atoms) # for atoms which are defined in unit
define avail species of (unit)
if number of species is not more that one or species are not similar # +<
and is unit atoms symmetric or can be used many times?
check many undefined species from (unit)
else is atoms usages like in context specie?
check similar undefined species of (unit)
else
define undefined specie of (unit) # +<
check many undefined species from (unit)
is over used unit atom?
or is atoms usages like in context specie?
iterate undefined species of (unit)
else
define undefined specie of (unit) # +<
check symmetries of (unit)
iterate undefined species of (unit)
iterate species by role from unit atom # +<
check similar defined species by (specie, atom)
check defined context parts by (specie, atom)
check symmetries of (unit)
check similar defined species by (specie, atom)
if there are similar defined species which have a similar anchor atom # +<
check that specie is not same as previously defined similar specie # +<
check defined context parts by (specie, atom)
if there are defined species which are parent or child of specie and uses atom # +<
check that atoms of specie are not same as atoms of parent or child specie # +<
check similar undefined species of (unit)
if unit have just one of similar specie # +<
check many undefined species from (unit)
else
iterate portions of similar species by role from (atom) # +<
is there are undefined context atoms which belongs to any unit specie?
and are undefined atoms seems different?
iterate similar species of unit
over separated units with species # +<
is asymmetric other side?
check symmetries of (separated unit)
iterate similar species of unit
each similar specie of unit over for loop # +<
redefine similar species with using iterating index # +<
are undefined atoms seems different?
if list of undefined atoms is not same as list of unit atoms # +<
and number of undefined atoms is not equal to number of unit species # +<
or undefined atoms have different properties # +<
or undefined atoms not belongs to different unit species # +<
is there are undefined context atoms which belongs to any unit specie?
if there are undefined context atoms of unit species # +<
is unit atoms symmetric or can be used many times?
is over used unit atom?
or is unit symmetric?
is unit atom using many times?
is mono-atom unit?
and unit atom has many using in all available major species # +<
is over used unit atom?
# has many using should also check using in children species
is unit atom using many times?
and number of using species is not equal to number of unit species # +<
is atoms usages like in context specie?
is unit atom using many times?
and careful sum of atom properties like properties in context specie # +<
check close atoms of (unit)
is there are undefined context atoms which belongs to any unit specie?
define all undefined context atoms of unit species # +<
is different roles of atoms?
check roles of (atoms) # of species which were undefined
is different roles of atoms?
if roles of atoms in context specie are different than roles in unit species # +<
is relayable
if self species are context specie # +<
REACTIONS_AND_CHUNKS: ############################################################################################
public:
check existence (unit)
check symmetries of (unit)
private:
is different roles of atoms?
true # ->
define avail species of (unit)
check many undefined species from (unit)
check many undefined species from (unit)
define undefined specie of (unit) # +<
check symmetries of (unit)
check close atoms of (unit)
if there are undefined unit atoms with relations to another undefined atoms # ->
define undefined unit atoms which have relations # ->
is relayable
true # +<
REACTIONS: #######################################################################################################
public:
create context entity
if number of defined reactant species is more that 1 # ->
redefine defined reactant species as array # ->
create it by defined reactant species # ->
CHUNKS: ##########################################################################################################
order of find algorithm
first assign initial unit!
for each entry unit # ->
remember names!
group units by lateral reaction
search from (unit)
checkout names back!
are lateral species defined?
create context entity
private:
search from (unit)
full check of (unit)
full check of (unit)
check existence (unit)
for each key unit of algorithm backbone # ->
check avail species of (unit)
for each neighbour unit # ->
check relations between (self unit, neighbour unit)
check defined lateral species
check names of different species and compare them between each other # ->
LOOK_AROUND: #####################################################################################################
# each specie instance wraps to other side specie instance
public:
create context entity
assign allocated memory by self instance and defined specie to next chunk # ->
CHECK_LATERALS: ##################################################################################################
public:
create context entity
create over chain factory # ->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment