Cr6 and I have been discussing super-conductors and it made me think about defining a language that could describe molecules. From that, I could then parse the textual definition and create a 3D model of the molecule. I fleshed out the idea a little bit in that thread and came up with the basics of the language.

I have now implemented a parser for it and am in the process of creating a 3D model. I am not currently working with the actual nuclear models. I wanted to get something visual first so that I could confirm the language parser without having to use a debugger and look at the objects in memory. I am creating a 3D network of atoms but only showing the symbol for each atom rather than the nuclear model. It still needs work but everything is created as defined and put into the correct place. Although it is rotating the carousel levels at the moment and I don't want that to happen with this type of view. That will be needed for the actual nuclear models but when using the symbols it just makes it hard to read.

MBL - The Language

The language is meant to be as simple as possible while still allowing some complex molecules to be defined. It is based on element chains where a chain is a series of atoms bonded along the north/south axis. A chain is defined by specifying each atoms symbol, H, He, O, etc, separated by the bonding operator '-'. You can also use whitespace (spaces, tabs, etc) to separate the tokens in an MBL expression. All whitespace is effectively ignored, but it still separates atoms so you can use it if you want to.

An element chain: O-C-Ti-K-O

You do not need to have a bond in an element chain but you must at least have 1 element.

Carousel Bonds

That would allow a lot of molecules to be defined as most bonds are along the north/south axis. However, it is also possible to bond to the carousel positions of an atom. To define that, we use a carousel list which is an array of up to 4 element chains. Each chain in the list corresponds to a carousel position and are in the following order: east, west, front, back. The carousel list is surrounded by square brackets '[' and ']' and each item in the list is comma separated. Note that the carousel list sits right next to the atom that it is bonded to. There is no bonding operator required to separate them.

An atom with carousel bonds in the east and west positions: Fe[O,O]

If we want to have carousel bonds in the front and back but not in the east or west, then we can use the null operator '_' in place of an element chain in the carousel list. Any position can have a null item.

An atom with carousel bonds in the front and back positions: Fe[_,_,O,O]

You can create very complex molecules with this syntax because each item in the carousel list can be an element chain, not just an atom.

Complex carousel bonds: Fe[O-C,Fe[_,O-C]]

Notice that we can nest carousel lists within each other to create branching structures.

Flipping Atoms

In order for this to work, we need a clear definition of the starting orientation of each atoms model. This is irrelevant for a balanced structure but when we have a different number of hook protons in the north compared to the south, we have to know which way the atom is oriented. To accomplish this, all atoms will have their larger hook stack in the south position by default. However, sometimes you need to flip an atom over so that it bonds to the surrounding atoms correctly. In order to accomplish that you use the flip operator '!' before the atom that you want to flip over.

Flipping an atom: O-!Cu-C

Rotating Atoms

You can use the spin operator '*' to rotate an atom about its north/south axis by a specified number of degrees. This will cause all bonds to the carousel positions to also be rotated. You can use decimal values if needed.

Spin an atom: O-Fe*45-C, O-Fe*12.5[H,H]-C

Multiplication

Some molecules have repeating patterns within them and it would be tedious and error prone to define these explicitly all of the time. You can use a multiplication group to repeat an element chain a specified number of times. Multiplication groups are surrounded by '(' and ')' and must be immediately followed by a positive integer number. Note that a multiplication group that is inside of a chain must be preceded by a bonding operator '-' and if it has more elements after the group, then it must also have a following bond operator.

Cross Bonds

All of the above has been implemented and is working as expected. I have just realised that it can't handle the types of bonds that I have used in my Hydrocarbon Series which have bonds attached orthogonal to other bonds. I will introduce a new grouping structure for these special bonds which will use curly braces '{' and '}' and contain a comma separated list of items. The first item in the list will be a Base Chain. This chain will become a part of the chain that this group is declared in (or it may be the complete chain itself). For each bond in the Base Chain, you can specify 2 more items in the list which represent the Top Chain and Bottom Chain for that bond respectively. You can use the null operator if you don't want anything bonded to a specific location.

It is also possible to use the bond operator before and after the curly braces if you want to.

e.g. C-{H,H}-C

It can make it look a bit nicer. Readability is very important for any language and even more so here because it is a symbolic language. With familiarity, you should be able to read a simple MBL expression and picture the molecule in your mind.

Out of Scope

With the above language, we can create very complex molecules with little text. Larger molecules will be cumbersome to work with but it is hard to avoid that. Allowing whitespace will help a lot since it allows you to group things without that being a part of the language itself. There are certain structures that will not be handled by this language.

The language is designed to create straight structures with north/south bonds and branches through the carousel bonds. It will not handle ring structures like we find in Hydrocarbons. At least, I can't see a nice way of doing so at the moment, but you never know what the future holds, I guess. If I can find a way then I will attempt it but I feel that a different language might be better suited to that kind of structure.

MBL will also not handle charge field effects like Miles has used for Methane where the H atoms spread apart based on the charge flow through the structure. I might be able to do that eventually, but it requires a level of charge processing that I am nowhere near at the moment.

Ideas and Usage

Feel free to express any ideas that you have about the language or structures that it might support. You can also think about how such a language, or the models that it can generate, could be used. You might even come up with a new way of expressing the language. I am implementing an Atomic Symbol Network at the moment and obviously plan to implement an Atomic Nucleus Network soon. How else might we be able to visualize these structures? What other uses could we put this language to? Think big! Think small! It doesn't matter. All ideas are welcome.

Last edited by Nevyn on Sun May 06, 2018 5:37 am; edited 3 times in total (Reason for editing : Added section of Rotating Atoms)

Technical Details

Some of you might appreciate some more technical information about what I am creating and how I am going about it. It might also help you to come up with new ideas if you can see the intermediate products that are generated.

Generally, processing a language is broken down into a few tasks and the products of those tasks. The first stage is to tokenize the text which means to break it down into a list of pieces, called tokens, where each token represents something in the language. For MBL, tokens are element symbols, bond, flip, and null operators, group markers and numbers.

If we had the following MBL text:O-C-Fe[H,H]Then we would get the following array of tokens:'O', '-', 'C', 'Fe', '[', 'H', ',', 'H', ']'Actually, I don't need the bonding operators once it has been tokenized so I really end up with this:'O', 'C', 'Fe', '[', 'H', ',', 'H', ']'

Now that we have the individual tokens, it is easier to parse the text. All that needs to be done is to iterate through the array and process each token.

Before I do that though, I do a pre-pass that looks for multiplication groups and expands them out into their full form.

I won't bore you with the parsing code explanation as I think the product of the parser is of more interest.

Abstract Syntax Tree

The output of a parser is generally called an Abstract Syntax Tree (AST) and it is an intermediate representation of the expression. We now have in-memory data structures, often called objects, that store information from the expression as well as relationships between elements of it. The idea is that the AST will be easier to process in order to generate the final output. Parts of the AST may be raw data as defined in the expression while others may completely remove tokens and replace them with objects to represent them. For MBL, the AST consists of objects called Atoms (strangely enough). The actual result of parsing any MBL expression is a single Atom.

"But, Nevyn, I wrote a full molecule, with lots of atoms, how come you only gave me back 1 of them?"

To answer that, it might help to see exactly what an Atom is, in this context. Here is the Javascript notated structure of an Atom object:

The symbol will be used to find the element that this Atom represents. The flip variable is used to flip it over, if needed. The rest are used for bonding to other Atoms.

The returned Atom, called the Root Atom of the molecule, will have the next Atom of the chain stored in its north field. That Atom will have the Root Atom stored in its south field and may have another Atom stored in its north field if the chain keeps going. The east, west, front and back fields are used to store carousel bonded Atoms. So you can see that the complete molecule is represented by the root if you follow the bonds.

Notice that the bonds are bi-directional, they go both ways. This is a convenience but it can lead you into dangerous territory if you are not careful. Essentially, you need to follow the bonds one way only. Since you start with the bottom element, it is best to always move from south to north. If you follow a carousel bond you still move from south to north because those Atoms in the carousel positions are turned sideways such that their south pole will be connected to the carousel hook stacks.

That brings up another important point with respect to flipping an atom. The flip field is only used to turn over the 3D model. It does not affect the bond positions in the Atom object. This means that the north of any atom will be connected to the south of the next atom, regardless of the flipping of that atom. For the carousel levels, the east, west, front or back position would be connected to the south of the atom bonded to it. This keeps things simple and should remove some confusion about how to traverse these Atoms.

Let's look at an example to see how this all fits together. If we defined a simple molecule like this 'O-C-O' then we would end up with 3 Atoms bonded like this:

I have omitted the bond fields that are not used in this example for clarity. I have also not included the return bonds as that will be confusing at first because you have to understand the cyclic nature of this data structure. Here is the full structure:

The Atoms in the south positions are not new Atoms. We only have 3 Atoms here and they are referencing each other. Since it is a cyclic structure, I can't actually write it out completely. The '...' represent info that has already been shown and would just lead to a never ending loop. That is why you have to follow the bonds in one direction only.

I am going to have to change that structure a bit since I am about to introduce a new bond type. I'm not sure how to accomplish that at the moment. I might need to introduce a formal Bond object that can store the Atom to be bonded to, the Top Chain and the Bottom Chain of the Bond. It does complicate matters but I am keen to reach a point where I can define most of the molecules that I have modeled in the past through MBL.

Here is how the new Bond object might look:

Code:

{ to { ... } ,from: { ... } ,top: { ... } ,bottom: { ... }}

Where the to, from, top and bottom fields are references to Atom objects.

So in the Atom object, the north, south, east, west, front and back fields will contain Bond objects rather than Atoms directly. Using the Bond class in this way will allow me to introduce other bond types in the future just by adding a type field or something similar.

The idea is that the AST can be used for many different purposes. At first I will use it to visualize the molecule but it could be used to perform data processing such as determining the charge flow through the molecule. I'm sure there are other ways to use it too.

Whitespace

I have implemented whitespace which allows you to replace the bond operator '-' with any whitespace characters. The bond operator was really only there to separate the elements and now that you can use whitespace, it accomplishes the same thing. However, I don't think it looks as nice. The '-' character looks like a bond.

e.g. C-O-C vs C O C

Cross Bonds

Cross bonds are now handled by the parser. I used the Bond object as described above. It complicates traversal of the structure but it allows many more possibilities.

Note the new format. I went with a more in-line structure which can be used like this:

C{H,H}C or C-{H,H}-C or C {H,H} C

or even a mixture of them all.

The 2 items in the list are the top and bottom element chains respectively. These will be bonded to the bond between the last and next atom.

It supports parsing all of the language as described above, but does not show the special cross bonds yet.

I played with showing the atoms as spheres and added a few textures. You can choose them all in the UI of the test page.

The test page also supports parameters on the URL. You can specify the MBL expression, the alignment of the base chain and the type of atom to show. The 'Load' button can be used to take the current settings, put them into a URL and reload the page using that URL. This allows you to easily get a copy of the URL but it also allows you to add molecules to the history of your browser. Play around with a structure using the 'Generate' button and when you are happy, hit the 'Load' button to save it in your history.

There is an image capture button available in the UI now (camera icon) but it is not working as I want it to at the moment. It does save the image but it actually renders the complete page area (but without content) with the 3D scene in the same place that it appears on screen. I tried cropping it down to the correct area but something is getting in the way and it is not working nicely.

Language Update

Element Chain Type System

I know I said that ring structures would be out of scope, but it turns out that was just a challenge for myself. I've found a way to express it in the language. I can see how to visualize it with the current text and spheres. I dread having to handle it with nuclear models.

I have introduced a type operator ':' which separates the type information from the chain that it applies to. The first token is the type and any following tokens before the ':' character will be put into an array as parameters. This can be used for various things and I envisage this chain type allowing some special functions to be created.

The first type will be 'ring' and it will probably need a parameter that is the dimension to curl around. You would specify it like this: ring x:(C-O)3.

Any element chain can have a type so they can be used deep inside of the expression and nested. For example: ring x:C-C-C[ring y:(C)5]-C-C.

Another usage for the element chain type that I have thought about is a 'lattice' type. This would allow you to specify 3 parameters which are the number of molecules in each dimension. It would then use the MBL expression to build a molecule which it would clone along each dimension.

You could have a type for 'sheet' that would do the same thing but in 2 dimensions instead of 3. Maybe 'tube' for nanotubes, etc.

The parser can already handle types and their parameters but the visualizer just ignores the information. Using the simpler nodes like spheres and text allows me to do these types of things fairly easily. It may become a nightmare when I get to using the nuclear models.

Technical Update

I have made some changes over the last few days and thought it best that I update this technical information to reflect the current status of the project.

Abstract Syntax Tree

As I have added more ways to bond and other information to the MBL language, the AST has to be kept in sync or there is no point in changing the language. This often means that the AST gets more complicated and it certainly has in this case. However, I think the general structure is now faily close to its final form as the current set of classes should be able to handle any future revisions. Although, you never know what the future holds, so they may not.

Atom

The Atom class is used to store all information about an atom that has been specified in the MBL expression. I have only added 1 new property but I have redefined some of the others.

Here is the new structure:

Code:

{ symbol: <atomic symbol of atom> ,flip: <true or false> ,spin: <degrees to rotate atom about N/S axis> ,north: <null or reference to a Bond object> ,south: <null or reference to a Bond object> ,east: <null or reference to a Chain object> ,west: <null or reference to a Chain object> ,front: <null or reference to a Chain object> ,back: <null or reference to a Chain object>}

Bond

The Bond class has been introduced to support any special requirements related to the bond between atoms. Specifically, it was created to support cross bonds since they do not really bond to an atom, but to the bond between atoms.

Here is the structure of the Bond class:

Code:

{ from: <reference to an Atom object> ,to: <reference to an Atom object> ,top: <null or reference to a Chain object> ,bottom: <null or reference to a Chain object>}

Chain

I have introduced the Chain class to support the new Chain Type mechanism. While it does make traversing the structure a bit more difficult, it actually also makes it much easier because it allowed me to create some functions on the Chain class that would take care of the traversal for you. Given an Atom in the Chain, it will give you the next Atom, for example.

Here is the structure of a Chain:

Code:

{ type: <null or type of this chain> ,params: <array of strings specific to the type> ,atoms: <array of Atom objects>}

A Chain contains an array of Atom objects that are a part of that Chain. Generally, you only need the root atom, which is the first in the array. The Chain class has a method, called 'root', that will return you that atom.

The type property, and the params that go with it, are used for special processing. The type field will contain a string that is a single word. The only restriction on the values that the params field can hold is that they can not contain any special characters of the language such as '-', '*', '_', '(', '[', '{', etc. Parameters will generally be simple constructs like numbers, name of a dimension, etc. I may need to introduce an escape mechanism if any special characters are needed in the type or its parameters. The most obvious one is the '-' character which would be needed for negative numbers.

Parser

The result of compiling an MBL expression will now be a Chain object. Previously, it just returned the root Atom of the chain, but now we have chain specific information so it has to return a Chain object.

Visualizer Update

Rings

The visualizer can now handle ring structures. They can be a little difficult to work with but a little trial and error should let you get what you want out of them. The main problem is figuring out which way they are going to curl and to help with that you can specify 1 or 2 parameters which dictate the curl axis, the curl direction and the overall orientation of the ring.

That will give you a default ring containing 3 Carbon atoms, 3 Oxygen atoms and 3 Nitrogen atoms. The chain is oriented in the Y dimension which means that it extends into that dimension. The curl of the ring can be about the X or Z dimension but we can't specify it like that because chains are relative to something else. The user can choose the base chain direction in the UI, but if the ring is inside of another structure then that structure sets its curl axis.

To combat that, I have allowed you to specify the curl axis in a more relative form. You can add a parameter after the 'ring' declaration that sets the curl axis and also the curl direction. The direction is the way that the atoms are placed around the ring. You can think of it as being clockwise or counter-clockwise from a given perspective. However, I have used the same parameter to set both of these things. You can add a parameter with a value of 'east', 'west', 'north' or 'south', although you don't actually need the full word, just the first letter will do.

To figure out which way those are going to curl, you have to put yourself at the base of the chain and imagine that you are looking along it. So you would only really see the first atom in the chain because it extends away from your eye. From that perspective, the ring can move in the north or south direction by curling around the X axis (you are looking down the Z axis) and it can move east or west by curling around the Y axis.

Chain Rotation

I found the ability to rotate the chain to be quite useful, so I have implemented a way to do the same for a straight chain. You do this by using another chain type called 'rotate' with a parameter that is the number of degrees to rotate around the chain axis. This is only really useful if you have bonds along the chain and will become necessary for very complex molecules.

I am amazed at how useful it is even without the nuclear models. Just having the spheres being arranged and connected in simple ways is enough to get a reasonable picture of the structure. The nuclear models will bring so much more, but even this simplistic view is pretty good. Especially for the ring structures. Straight chains are easy enough to see in your head (if they are small enough) but rings get complicated, quickly. I am very pleased with it, so far. New ideas have been easy enough to implement in the language, parser and visualizer. If I had tried using the nuclear models first, it would not have gone so nicely. I would not have added rings, that's for sure. I'm still not sure how I am going to handle that .

Super-conductors are pretty boring as far as molecular structure goes. Straight chains as far as I can tell. You're looking for that straight path through all of the atoms. The red bond lines actually represent the through-charge of the molecule. That is the transmission line that we force charge through.

Although it may be better to have a copper on the bottom/start of the molecule as it has 2 protons in its south pole. This gives an imbalance N/S that gives the through-charge a direction to flow. I don't think that is essential but it may help.

I had a little play with some code last night that will be the start of a visualizer that uses the nuclear models instead of spheres or text. The main difference between what I currently have implemented and using the models is that the models can be different sizes to each other. With spheres or text, I can set some size that all elements will fit into and place them accordingly. With the models, I have to track the size of each element and place the models in the appropriate locations.

This is easy enough for a straight chain, which is what I was playing with last night. Rings, on the other hand, are a real problem. For the sphere or text, I know the length of each atom (or the length that I want it to have) and I can find the radius of the ring easily with a bit of trigonometry. Now I have to create a ring with different sized pieces and I don't know how to do it.

My only thought at the moment is to average the lengths of all atoms in the ring and use that in the same way that I have built the sphere based rings. This may work for some cases, but I fear that it will fail spectacularly at some stage. I will give this a try and see how it looks but I am on the look out for another way.

This seems like it will require some esoteric math, but I was hoping some of you might have some idea on how to do this or where to look for more information.

Hey Nevyn, great work! I really don't know if this is the info you're requesting but I wanted to give you a quick answer before l quit for the day. I believe you are trying to solve cyclic irregular convex polygons. Each unequal length atom is a different polygon side, all the atomic connections lie on a circle. Notice all the radii are the same, if I'm not mistaken, the problem becomes finding the internal angles. Try searching on that term, when I did I ended up with the image above and paper below.

On Circumradius Equations of Cyclic Polygonshttps://bib.irb.hr/datoteka/402976.main1.pdfby Dragutin SvrtanJune 5, 20091 IntroductionCyclic polygons are the polygons inscribed in a circle. In terms of their side lengths a1,a2,...,an, their area S and circumradius r are given in case of triangles and quadrilaterals explicitly by the following well known formulas: the Heron’s formula ( 60 B.C.) for the area and the circumradius r of triangles (by letting A = (4S)2,ρ = 1/r2 ): A−(a+b+c)(a+b−c)(a−b+c)(−a+b+c) = 0 a2b2c2ρ−(a+b+c)(a+b−c)(a−b+c)(−a+b+c) = 0

Wanted to add too if it would be possible to put a label of the molecule on the rendering?

Also, as we know the proton generally "rules" in the Mathis' papers. What could be readily applied as "rules" to form/not form certain structures according to the CF flows? I see how Cu3MgO4 could be rendered in a multitude of ways...but which ones could be ranked by probable formation -- like the straight line bonds which does look better than others. I guess I'm looking for a "look up" rule for bonds to prohibit forms that could simply not be created. The tool already can do this pretty well by just rendering "gaps" in the links -- and I ended up rewriting a few MBL "forms" with this approach. It didn't look right...like immediately -- and this is good. If a certain molecule syntax is thrown to the MBL rendering engine... which might be the best forms to show via Mathis? I know this extremely speculative... but even a few rules might be better than none. A lot to code through though....like with a call to a database or a lengthy parsing function. I figure that you guys (Neyvn, LTAM, Jared, Ciaolo) have already thought about it as well...rules to allow more automation with molecule formations?

Here's Miles in the Solid Light paper:

Miles Mathis wrote:Well, in a sense, we don't. Superconduction turns out to be a bit of a misnomer. Without nuclear spin,the nucleus is no longer conducting at all, rigorously. It is only continuing to provide a path, given bythe nuclear structure, but the nuclear vortices are gone. The nucleus is no longer driving chargethrough, it is now only allowing charge through. The driving force of the conduction must be suppliedby the incoming current itself. Remember, a superconductor is providing no resistance to a givencharge stream or ion stream. But we have to supply the current from outside. A superconductor can'tcreate its own current from an unstructured external field, as a normal conductor can. Asuperconductor can only provide a zero-resistant path for a pre-existing structured field.

In this line, we also have to remember that although supercold can nullify the overall nuclear spin, itwon't nullify the spins on all the protons in the nucleus. If we apply the external current to oursuperconducting material, properly aligned, that current alone will spin the protons it contacts on thenuclear poles. Think of the fan again. A moving fan will pull in wind from behind, but the reverse isalso true. If you apply wind from behind a non-moving fan, the wind will start the fan turning. Soalthough the carousel levels aren't spinning in a superconductor, the protons on the poles are. We couldthen call this conduction, if we like, since the spinning protons then conduct the charge through.Strictly, we would have to say the incoming charge (current) is the cause of the spin, rather than thespin being the cause of the charge channeling, but you see what I mean.

As usual, there are no real pulls in my physics, but the field densities here create potentials that give us theappearance of pulls. Again, it helps to think of the protons as fans that blow photons in certain directions. Justas fans seem to pull wind as well as push it, so do the spinning protons and alphas.

Would you want the MBL as the label or to be able to write some text to put on the image?

Regarding the rules of building molecules, it is difficult to say. There are many rules, or guidelines, but they are applicable in different scenarios. Super-conductors like straight paths, aromatic hydro-carbons like rings. To get a feel for it, you can look at some known molecules that do not contain many atoms. Two or three. Have a look at their models and see how they might fit together. Then take your best candidates and look for charge flow characteristics. Look at the known properties of the molecules and find reasons for those properties.

There are some laws that can not be broken. You can't force more charge into an atom than its interior can handle. This limits the size of proton stacks in bond locations although it is not always a consideration. The outer most stacks determine the charge flow so internal bonds might use larger stacks but they will not conduct at full power.

Are you thinking of a molecule generator? An app that, given the rules you want to apply, will give you potential molecules that satisfy those rules? You might need to give it a list of atoms that can be used. That would be a pretty good app.

Another way I can interpret your question is to create code that validates the MBL given a set of known rules. That is feasible, to some extent. Now that I am working with the nuclear models, I have the data for each atom at my disposal. This allows me to look into the atom and determine if a bond is feasible.

Abstract. We provide a new proof of the elementary geometric theorem on the existence and uniqueness of cyclic polygons with prescribed side lengths. The proof is based on a variational principle involving the central angles of the polygon as variables. The uniqueness follows from the concavity of the target function. The existence proof relies on a fundamental inequality of information theory. We also provide proofs for the corresponding theorems of spherical and hyperbolic geometry (and, as a byproduct, in 1+11+1 spacetime). The spherical theorem is reduced to the Euclidean one. ... .