Atomic Model Editor

Page 1 of 7 1, 2, 3, 4, 5, 6, 7  Next

View previous topic View next topic Go down

Atomic Model Editor

Post by Nevyn on Mon Aug 03, 2015 10:53 pm

I have created this topic to contain everything about the Atomic Model Editor. Questions, ideas, complaints. Whatever you need to say about it, this is the place.

What is the Atomic Model Editor?

It is a web based application to view and edit nuclear models as described by Miles. It is written in HTML and Javascript but may extend into some server side code to provide extended functionality if I can't do it in the browser. Server side code will likely be PHP and possibly a MySQL database, just to keep it simple and easy to host since most hosting environments provide these tools. If I had the choice I would use Java Servlets and a Postgres database but that would make it expensive to host anywhere that I don't have complete control over.

The Atomic Model Editor was created as a result of some discussions about Cr6's periodic table data. You can read through it here. I designed a JSON Element format that we could use as an intermediate data storage structure. That is, a way for us all to share our data in a common format so that different tools could be written to use it. I immediately went about adding it to my Atomic Viewer (desktop application for 3D nuclear modelling). That went well but it got me thinking that I should rewrite that application based on this new structure.

I had a look through the code and it was a big job to change it and I thought it better to just start again. Since I had no ties to any existing code, I could rethink my platform and decided on a Javascript 3D API called Three.js. This was a decision made for other people, rather than myself. My other 3D applications are all written in Java and I would prefer to keep doing so as it gives my a lot more power, flexibility and stability. However, getting it running on other systems is a bit of a pain because it needs specific libraries for the host hardware. By using HTML And Javascript, I could let the browser take care of that problem for me. I am happy with the capabilities of the Three.js library but it is a bit unstable sometimes (that's not really Three.js but the underlying WebGL implementation in the browser).

What does it do?

The first version of development focuses on establishing a stable environment for viewing atomic models and provides some basic, text based, data entry and editing tools. You can copy/paste JSON Element descriptions into the app to view them and you can decompose the current models back into JSON Element format to save. I will look into a file saving mechanism soon but this is not an easy thing to do in a browser because of security concerns. If it is not possible to do in the browser then I will need to implement some server side code which just bounces the content to be saved back to the browser which will then prompt the user for a file to store it in. In conjunction with the file saving ability will be an image export mechanism so that you can save an image of the current content. You could do this now by taking a screenshot but I think a more formal mechanism is warranted.

Version 2 will focus on editing the models in the graphical environment. You will be able to select an atom, change its properties, move it, rotate it, show charge strengths, etc. I would like to look into the ability to grow elements. That is, given a starting point, which could just be a proton, determine how we could add more protons to form new configurations. This will be a rule based engine where we define Miles nuclear building rules and the system uses them to find possible elements. This could grow into a project of its own as it is a big job.

The third version will focus on molecules. I want the system to calculate as much information as possible and for it to take care of little tasks like moving protons within a model when it bonds to another element. It should be able to calculate the possible bonding points between 2 atoms and let the user select which ones to use for bonding, then it will combine them into one entity. I have a vague idea of being able to insert a few atoms and/or molecules into the scene and then let the system determine what molecules could be made from them.

What data does it handle?

Currently, it is completely based on the JSON Element format. Here is an example of the current structure:

{
   "name": ""
   ,"symbol": ""
   ,"atomicNumber": N
   ,"levels":
   {
     "core":
     {
       "protons": N
       ,"neutrons": N
       ,"electrons": N
     }
     ,"pillar":
     {
       "north":
       {
         "protons": N
         ,"neutrons": N
         ,"electrons": N
         ,"attach1": {
           "protons": N
           ,"neutrons": N
           ,"electrons": N
         }
         ,"attach2": {
           "protons": N
           ,"neutrons": N
           ,"electrons": N
         }
       }
       ,"south":
       {
         "protons": N
         ,"neutrons": N
         ,"electrons": N
         ,"attach1": {
           "protons": N
           ,"neutrons": N
           ,"electrons": N
         }
         ,"attach2": {
           "protons": N
           ,"neutrons": N
           ,"electrons": N
         }
       }
     }
     ,"cap":
     {
       "north":
       {
         "protons": N
         ,"neutrons": N
         ,"electrons": N
       }
       ,"south":
       {
         "protons": N
         ,"neutrons": N
         ,"electrons": N
       }
     }
      ,"carousel":
     {
       "east":
       {
         "protons": N
         ,"neutrons": N
         ,"electrons": N
       }
       ,"west":
       {
         "protons": N
         ,"neutrons": N
         ,"electrons": N
       }
       ,"front":
       {
         "protons": N
         ,"neutrons": N
         ,"electrons": N
       }
       ,"back":
       {
         "protons": N
         ,"neutrons": N
         ,"electrons": N
       }
     }
      ,"hook":
     {
       "north":
       {
         "protons": N
         ,"neutrons": N
         ,"electrons": N
       }
       ,"south":
       {
         "protons": N
         ,"neutrons": N
         ,"electrons": N
       }
       ,"east":
       {
         "protons": N
         ,"neutrons": N
         ,"electrons": N
       }
       ,"west":
       {
         "protons": N
         ,"neutrons": N
         ,"electrons": N
       }
       ,"front":
       {
         "protons": N
         ,"neutrons": N
         ,"electrons": N
       }
       ,"back":
       {
         "protons": N
         ,"neutrons": N
         ,"electrons": N
       }
     }
  }
 }

I don't foresee much reason to handle other data formats since none of them know anything about Miles nuclear models. However, I am open to ideas if you have any. I will introduce a JSON Molecule format at some point but I don't need it just yet.

It currently supports the JSON Element format in two ways. The interface allows you to enter the JSON Element definition directly, either as a single entity or as an array of entities, and they will be inserted into the current scene. The other way uses a Javascript file that declares a global variable that is an array of JSON Elements. This is presented to the user as a list of buttons where clicking on the button will insert that element into the scene. It makes use of the  'period' property on an element, if it has one, to create a tab per period for easier selection of elements but all elements are available on the first tab. This uses the output of a converter I wrote to extract Cr6's element data (in Excel, exported into CSV and then into JSON) into the JSON Element format so all of the current element definitions are from that Excel file. I have noticed some elements that are wrong and some that are different to how I have modeled them but a lot of it is good data. As I am focused on developing the app, I have not had time to convert my own models into the JSON Element format (and I don't think there is a way to do it through code so I will need to manually build each one but the new JSON Element format is much easier to work with).

Where can I get it?

There are two ways to apply this question. "Where can I use it?" and "Where can I get the source code?" With respect to the first, I have it on the web on my personal web space (through my ISP) but I don't like sharing that URL in a public forum so I am trying to find other options.

I am also thinking about how to share the code for this project. At the moment, GitHub is a good choice or I might use BitBucket. I'm not sure how much need there is for sharing the source so I haven't spent much time thinking about it. If I solve the hosting issue, then I can just put a zipped copy of the source tree on there.

For now, send me a PM if you want a link to either the web viewer or the source code.
avatar
Nevyn
Admin

Posts : 787
Join date : 2014-09-11

View user profile http://www.nevyns-lab.com

Back to top Go down

Re: Atomic Model Editor

Post by Nevyn on Mon Aug 03, 2015 10:56 pm

Here is a screenshot of the current interface. It shows some of the settings that can be altered and a couple of models.

avatar
Nevyn
Admin

Posts : 787
Join date : 2014-09-11

View user profile http://www.nevyns-lab.com

Back to top Go down

Re: Atomic Model Editor

Post by Nevyn on Sat Aug 08, 2015 4:02 am

Version 0.4 has slowly crept out of the womb and given a glorious cry of life. Sporting a sexy new look for every element in the catalog.



It has come, in our hour of need, to answer some of the great questions of life. For instance, is there any oxygen on the moon? Well, let's have a look:



I believe there may be trace amounts there.

We also find some interesting chemistry in the fiery heart of the Earth. Could the noble Neon, wearing a lovely blue gown this evening, survive under such pressure?



Now, the most burning question mankind has dared to ask. Some may not like me talking so openly about it, however, I must take the risk and put it right out there for all to see. I must ask you all to think back to a time when you've asked yourself just what would a atom look like on the Windows XP desktop?



There you have it. We can all sleep just a little bit better now.
avatar
Nevyn
Admin

Posts : 787
Join date : 2014-09-11

View user profile http://www.nevyns-lab.com

Back to top Go down

Re: Atomic Model Editor

Post by Nevyn on Sat Aug 08, 2015 10:07 pm

After the great fanfare release of Version 0.4, I got to work on actually building models. In doing so, I immediately found that there were some bugs in the UI. I fixed them easily enough but I couldn't be bothered to separate them from the changes already made. Therefore, I have rolled those changes back into Version 0.4 and updated the site.

Fixed Bugs:

I fixed a bug in the JSON Element Creator dialog box where you couldn't add or insert the JSON Element definition. This was a result of some changes I made to how elements are stored inside the system.

I also fixed a bug that caused the text at the top of the modal dialog boxes to not show. It was actually there but it was being rendered white on a white background. This was caused by a missing CSS file for Bootstrap.

New Features:

I updated the atomic structure to support neutrons in various places. You can now specify "attach1" and "attach2" structures on any hook level alpha. These can just be neutrons, no protons required. When only placing neutrons, it will group and arrange them based on the number of neutrons in the group. It currently supports up to 3 neutrons in a group. I have not seen any models that need more than 3 but I will add support for up to 6.

I also fixed the way the attachments are oriented to support neutron groups better. This has changed the side that the attachments are on depending on whether they are in a north or south position (or east/west and front/back as hook alphas in the carousel level can have attachments now too). The "attach1" structures are placed on the right if north and on the left if south. This means that if you want 2 attachments then you just use "attach1" for both (assuming 1 north and 1 south, etc) and the system takes care of placing them correctly. I also updated my converter for Cr6's spreadsheet so that it puts them into the correct attachment.

I have added a Periodic Table Manager that allows multiple tables to be used. There are currently 2 tables, 'Nevyn's periodic table' and 'Cr6's periodic table', Nevyn's table is the default (any complaints of preferential treatment can be taken up with project management). Only 1 table is used at any 1 time but you can swap between them and load elements from either model into the same scene. Use the "Select source" action to choose between tables.

I went through Cr6's data and compared them to my models (visually) and changed the ones that were different to mine. I'm not saying either one is the correct version, just different. We can now load both models into the UI and compare them which will hopefully spawn some interesting discussions. If anyone else wants a periodic table of their own then just send me the JSON elements you want in it and I will add it in. These are easy to add and edit so don't worry about bugging me with updates.

New Features in previous Version 0.4:

Some new features I didn't mention previously are backgrounds, geometry and material quality settings, a new hemisphere light source and I have changed the way lights are setup, and some nice textures for particles and charge fields.

Backgrounds are separated into 2 groups: Sky and Landscape. The Sky backgrounds render a texture onto either a box or sphere that is huge and its texture is rendered onto the inside of it so that you can see it. The Landscape backgrounds render a texture onto a huge plane that stretches off into the horizon. You can combine Sky and Landscape backgrounds into Presets which just apply both at the same time. Also notice that if you change the Sky and Landscape individually, and they both match a preset, it will select the preset in the drop-down box.

The geometry already had a quality setting but we also have a material quality for both particles and charge fields. This selects the way lighting affects the material. A setting of 'low' will not use lighting, 'medium' will use per-vertex lighting and 'high' will use per-pixel lighting. Per-pixel lighting takes a lot of processing power and isn't really worth the effort, but it is there if you want it.

You can now use a hemisphere light which is a general light source from a certain direction. It is kind of a mixture of an ambient light and a directional light. I have also altered the way lights are setup when you choose the performance setting. Previously, it would turn on the different lights as you went to higher settings. This was pretty annoying sometimes as the directional and spot lights could be a bit over-powering and you would lose color definition. Now, it doesn't use lights on the lowest setting, then it turns on the ambient light and then it turns off the ambient light and turns on the hemisphere light. Above this, it turns on the directional and spot lights (at higher performance settings) but does not activate the individual lights (there are 2 of each type). This means that the directional and spot lights are there for you to turn on if you want to but will not be used by default.

I'm pretty happy with how the textures turned out. The protons, with their sexy charge fields, look great and so do the neutrons. The electrons are too small so I did not add any textures to these, although, if they have a charge field this will have the same texture as a protons charge field (since they go through the same code path).

There is also now a Define Element modal dialog box which actually doesn't do anything at the moment but is an attempt to specify the particle counts of an element in UI controls. This will need to be updated to support attachments and to get it operational.

There are probably other enhancements and features that I have missed. The system is much more stable than previous versions but it can still crash under certain circumstances.

There is a bug in the UI system that receives key events. This is a problem when using a dialog box to write element definitions because it will open other dialogs if you press either 'e' or 'j'. It is generally easier to copy/paste into/from an external text editor and also saves you from crashes.
avatar
Nevyn
Admin

Posts : 787
Join date : 2014-09-11

View user profile http://www.nevyns-lab.com

Back to top Go down

Re: Atomic Model Editor

Post by LongtimeAirman on Sat Aug 08, 2015 11:27 pm


Congratulations, That’s a fine job indeed!  

Your latest update above knocks my comment count way down. I’m anxious to give you feedback but I’m learning too slow.

The control panel works out very well. And you’ve included so many visual possibilities!

I don’t see the bottoms of the element or period selectors (except period 1 since it is so short), but the window sliders allow access. Low priority.

I see titles as the elements are being generated, but as soon as the display is compete, the title is gone. It would be best to have an on/off able switch to control titles. Low priority.

For clarity, compacting your JSON Element format:
{
  "name": ""
  ,"symbol": ""
  ,"atomicNumber": N
  ,"levels":
  {
"core": { "protons": N,"neutrons": N,"electrons": N },
"pillar":  { "north": { "protons": N,"neutrons": N,"electrons": N },
                 "attach1": { "protons": N,"neutrons": N,"electrons": N },
                 "attach2": { "protons": N,"neutrons": N,"electrons": N }
                }
                "south: { "protons": N,"neutrons": N,"electrons": N },
                "attach1": { "protons": N,"neutrons": N,"electrons": N },
                "attach2": { "protons": N,"neutrons": N,"electrons": N },
               }
"cap":    { "north: { "protons": N,"neutrons": N,"electrons": N },
                 "south": { "protons": N,"neutrons": N,"electrons": N },
               }
"carousel":  { "east": { "protons": N,"neutrons": N,"electrons": N },
                       "west": { "protons": N,"neutrons": N,"electrons": N },
                       "front": { "protons": N,"neutrons": N,"electrons": N },
                       "back": { "protons": N,"neutrons": N,"electrons": N },
                      }
"hook": { "north": { "protons": N,"neutrons": N,"electrons": N},
                "south": { "protons": N,"neutrons": N,"electrons": N},
                "east": { "protons": N,"neutrons": N,"electrons": N},
                "west": { "protons": N,"neutrons": N,"electrons": N },
                "front": { "protons": N,"neutrons": N,"electrons": N},
                "back": { "protons": N,"neutrons": N,"electrons": N }    
              }
 }
}
(I've probably screwed up curly brackets and commas).

And the list of Proton Locations. (We are looking at iron).


The hook level differences aside, will the Elemental format allow the inclusion of additional neutrons as are shown in Mile’s diagram? Corrected, That’s quick customer service!

Nice to see the neutrons spinning. I could quibble that electrons appear to rotate at the same rate.

Does it seem relevant that the atoms themselves will be rotating right or left? Or that atomic interactions will be occurring despite that spin differential?  I believe that we all understand that the primary energy source for our atoms streams up from below (here on earth’s surface), or from the sun or moon, hell’s latrines or the ambient spaces between galaxies. It seems possible to show such differentials within the current structure.

Can you elaborate a bit on using “shaders”? Will it allow quantitative operations, such that we can develop the pre-fields using the current viewer?

I'm using Internet Explorer with a touchscreen. I can easily rotate, or change vantage points, but the zoom doesn't work.

Good stuff, Nevyn

LongtimeAirman
Admin

Posts : 561
Join date : 2014-08-10

View user profile

Back to top Go down

Re: Atomic Model Editor

Post by Nevyn on Sun Aug 09, 2015 5:16 am

Thanks, Airman. I spent so much time under the hood that I thought I would stop and do some work on more visual features and I'm pretty happy with it.

LongtimeAirman wrote:

I don’t see the bottoms of the element or period selectors (except period 1 since it is so short), but the window sliders allow access. Low priority.

I think this is a problem with your browser. Have a look for any compatibility settings you can change and see if it helps. It works on my version of IE (11.0.9600.17914, updates 11.0.21) which I am very impressed by. I didn't think it would but it works quite well.

LongtimeAirman wrote:I see titles as the elements are being generated, but as soon as the display is compete, the title is gone. It would be best to have an on/off able switch to control titles. Low priority.

I did a little bit of work on titles a while ago but when I rewrote the element loading system it was left behind. I've just added it back in with a bit of an upgrade too so you will see that in the next update.

LongtimeAirman wrote:For clarity, compacting your JSON Element format:
...
(I've probably screwed up curly brackets and commas).

You did very well with the JSON, only a few trailing commas which some parsers may even work with.

Here is the updated version of the JSON format:

Code:

{
  "name": ""
  ,"symbol": ""
  ,"atomicNumber": N
  ,"properties":
  {
    "<name>": "<value>"
  }
  ,"levels":
  {
    "core": { "angularVelocity": N, "protons": N, "neutrons": N, "electrons": N }
    ,"pillar":
    {
      "north":
      {
    "angularVelocity": N
        ,"protons": N
        ,"neutrons": N
        ,"electrons": N
        ,"attach1": { "protons": N, "neutrons": N, "electrons": N }
        ,"attach2": { "protons": N, "neutrons": N, "electrons": N }
      }
      ,"south":
      {
    "angularVelocity": N
        ,"protons": N
        ,"neutrons": N
        ,"electrons": N
        ,"attach1": { "protons": N, "neutrons": N, "electrons": N }
        ,"attach2": { "protons": N, "neutrons": N, "electrons": N }
      }
    }
    ,"cap":
    {
      "north": { "protons": N, "neutrons": N, "electrons": N }
      ,"south": { "protons": N, "neutrons": N, "electrons": N }
    }
    ,"carousel"
    {
  "angularVelocity": N
      ,"east": { "protons": N, "neutrons": N, "electrons": N }
      ,"west": { "protons": N, "neutrons": N, "electrons": N }
      ,"front": { "protons": N, "neutrons": N, "electrons": N }
      ,"back": { "protons": N, "neutrons": N, "electrons": N }
    }
    ,"hook"
    {
      "north": {
        "protons": N
        ,"neutrons": N
        ,"electrons": N
        ,"attach1": { "protons": N, "neutrons": N, "electrons": N }
        ,"attach2": { "protons": N, "neutrons": N, "electrons": N }
      }
      ,"south": {
         "protons": N
        ,"neutrons": N
        ,"electrons": N
        ,"attach1": { "protons": N, "neutrons": N, "electrons": N }
        ,"attach2": { "protons": N, "neutrons": N, "electrons": N }
      }
     ,"east": {
        "protons": N
        ,"neutrons": N
        ,"electrons": N
        ,"attach1": { "protons": N, "neutrons": N, "electrons": N }
        ,"attach2": { "protons": N, "neutrons": N, "electrons": N }
      }
      ,"west": {
        "protons": N
        ,"neutrons": N
        ,"electrons": N
        ,"attach1": { "protons": N, "neutrons": N, "electrons": N }
        ,"attach2": { "protons": N, "neutrons": N, "electrons": N }
      }
      ,"front": {
        "protons": N
        ,"neutrons": N
        ,"electrons": N
        ,"attach1": { "protons": N, "neutrons": N, "electrons": N }
        ,"attach2": { "protons": N, "neutrons": N, "electrons": N }
      }
      ,"back": {
        "protons": N
        ,"neutrons": N
        ,"electrons": N
        ,"attach1": { "protons": N, "neutrons": N, "electrons": N }
        ,"attach2": { "protons": N, "neutrons": N, "electrons": N }
      }
    }
  }
}

I've specified "attach1" and "attach2" on the hook.north and hook.south locations but I have not implemented that yet. I'm not sure its needed but it is extremely easy to add (in fact I have to allow it to happen rather than add it in).

LongtimeAirman wrote:And the list of Proton Locations. (We are looking at iron).


The hook level differences aside, will the Elemental format allow the inclusion of additional neutrons as are shown in Mile’s diagram? Corrected, That’s quick customer service!

I spent this morning working through some actual models and added a few nice features like this. It was Iron that forced me into it. I opened up my old model and it had neutrons everywhere! Shit! I thought. I better address that now then.

LongtimeAirman wrote:Nice to see the neutrons spinning. I could quibble that electrons appear to rotate at the same rate.

The neutrons spin at their own rate which is a little bit slower than electrons. You can adjust the rate for both of them in the settings.

LongtimeAirman wrote:Does it seem relevant that the atoms themselves will be rotating right or left? Or that atomic interactions will be occurring despite that spin differential?  I believe that we all understand that the primary energy source for our atoms streams up from below (here on earth’s surface), or from the sun or moon, hell’s latrines or the ambient spaces between galaxies. It seems possible to show such differentials within the current structure.

I had implemented some code a while ago that was meant to rotate the carousel level but I never got around to actually hooking it up. Your comment pushed me into it and I have that working now. While I was at it, I thought I would add angular velocity to the axis level too. This would give the atom 2 spins: the axis level spinning about the Y axis and the carousel level spinning about the Y axis independently. I got it working and sat looking at the results and it just didn't look right. Not right at all.

It needed another spin. The axis has no reason to spin as a single entity. It contains a north and a south arm which can both spin independently of each other. With charge coming in from the north and anti-charge coming in from the south (or vice-verse) each arm would gain spin from that charge. So they would spin opposite ways.

So I dived in and implemented that and it looks so much better. As I sat back and watched my north axis spin one way, the south axis spin the other way and the carousel level spinning one of those ways, I realised that the carousel level would spin as a result of the axis spin. That is, the carousel would be feeling forces from both arms so if one of them is spinning faster than the other, that is the direction that the carousel level will spin with an angular velocity that is the difference between the north and south axis velocities. On earth, we have a 1:2 ratio of charge:anti-charge which sets the south axis rotating faster than the north.

This means that in more neutral environments, atoms may not spin about their carousel levels. Also, in superconductivity, we may have a case where the south axis spins the same direction as the north axis, providing more conduction in a single direction. This would take a pretty powerful charge current but under extreme cold it would be easier to accomplish.

Notice that in the JSON Element specification, the core, carousel, pillar.north and pillar.south elements may have an angularVelocity property. If this is specified on any of them, then it will spin at the specified rate which is radians per second. If you DO NOT specify an angularVelocity on the carousel level, then it will go into reactive mode. In this state, it will watch the pillar.north and pillar.south locations and react to them. I will probably do the same for the core which I think should operate on the same principle. I will also implement new controls to disable the rotations because sometimes they just get in the way.

LongtimeAirman wrote:Can you elaborate a bit on using “shaders”? Will it allow quantitative operations, such that we can develop the pre-fields using the current viewer?

A long time ago, in a galaxy far, far away, some engineers wanted more power. Don't they always want more power? Anyway, we wanted to do more graphics work and machines of the day were just not up to the task. So the graphics card manufacturers (NVidia, ATI) answered our prayers with 2 things: vertex shaders and pixel shaders. These were hardware implementations of common routines that could be used in a programmable way. The beauty of them though, was that there were lots of them (more and more with every generation since) and they could all work at the same time! This is the key feature because graphics work often revolves around looping over image data or geometry, etc. We often have to do the same thing, with slight variations, to every pixel in the image, for example. Well, you develop a shader that operates on 1 pixel and then you apply it to every pixel in the image at the same time. So now the internal code of your loops are all happening in parallel and you get the results much, much faster.

In the beginning, the 2 worlds were separate. You had vertex shaders, which operated on vertices of geometry, and you had pixel shaders, which operated on pixels of images. In essence, pixel shaders are a 2D world while vertex shaders are 3D. You often write your vertex shaders to setup data that the pixel shader will use later. Vertex shaders always run before pixel shaders since you have the work the geometry to form the 2D image.

*** Edit ***

I was slightly wrong in my description about shaders here. The pixel shaders are not 2D and do not work in an image based manor. They are still 3D and you can use them in a number of ways, but the usual way is to specify the color of a vertex (3D point in the geometry) and also how the system should interpolate the colors between vertices. So if I set 1 vertex to red and the next 1 to green, then I can tell the system to smoothly interpolate between them and it will adjust the color from red to green as it goes from the first vertex to the second. This gives you are nice smooth change from 1 color to the next along that line. Since all polygons are broken down into triangles, the 3 vertices are used to interpolate the color across the triangle.

*** /Edit ***

Now, there isn't really much difference and you can write it all in one if you want. Some API's still separate the 2 since it is convenient at times. It really depends on what you are doing. You see, they aren't really 'shaders' anymore. That was their purpose in the early days and the name has stuck but they are better called a 'compute unit'. You can use these compute units for anything you want to. I've used them to calculate charge field interactions that had nothing to do with graphics, just 3D entities (and it was attached to a graphics engine later, but not for calculations, just visualizing results).

For this project, I will first look into using them as 'shaders' in order to render a charge field effect. I had that intention, anyway. Since seeing the new textures in place, I'm not sure it's worth the effort at this stage. I'll see what the future holds. I might just decide that I am interested in seeing how that might work one day and get into it.

Other uses I might find for them are calculating charge density fields. I have an idea of creating a 3D grid of a certain volume. Each cell calculates the density and resultant velocity of charge in that volume of space given all of the particles around it. This will create the charge profile of an atom. I can run the calculations of each cell as a shader so that they all run in parallel.

LongtimeAirman wrote:I'm using Internet Explorer with a touchscreen. I can easily rotate, or change vantage points, but the zoom doesn't work.

Good stuff, Nevyn

I've only tried it on an old iPad which didn't work. My phone works, sort of, it is difficult to navigate around because everything is so squashed up. I really haven't thought about small devices but some of the API's I am using support them so there may be limited operation.


Last edited by Nevyn on Fri Nov 20, 2015 3:31 pm; edited 1 time in total
avatar
Nevyn
Admin

Posts : 787
Join date : 2014-09-11

View user profile http://www.nevyns-lab.com

Back to top Go down

Re: Atomic Model Editor

Post by Cr6 on Sun Aug 09, 2015 7:19 pm

Wow, this is too cool Nevyn!  Smile

And after reading a Mathis' paper on an element-molecule, it is now fun to fire up your "Atomic Viewer" to see it. The Angular Velocity is really a nice feature...looks great. Nice adds with the protons. It looks like it is giving a true Mathis periodic table.

Like LTAM said, "Good stuff".

Cr6
Admin

Posts : 639
Join date : 2014-08-09

View user profile http://milesmathis.the-talk.net

Back to top Go down

Re: Atomic Model Editor

Post by LongtimeAirman on Mon Aug 10, 2015 5:14 pm

Hey Guys, I can't be happy for long. I'm doomed to wander forever.

http://milesmathis.com/gas.pdf

IMHO This alpha neutron alignment idea is, as Miles kinda said, elegant.

First. I originally believed that the basic unit for describing atoms was the proton. Alphas were simply orderly pairs of protons (along with the necessary neutrons and electrons). But now, alphas act as charge field detectors. Whenever possible, they align themselves (maybe through gyroscopic/angular momentum maxima) to receive available charge flows through a proton pole. The alpha literally changes its “configuration” as the charge flow varies by adjusting antiparallel to parallel neutron positions. Can the alpha be a base unit reflecting charge flow directions and magnitudes. Of course, alphas within the atom align pretty much with the atom, but "end" alphas can redirect the atom or match charge flows.

Second. Atoms want to point their south poles toward the charge flow source too. Lone or loosely associated atoms can act like gimbals. When the charge source direction changes, the noble gases easily realign, while the rest of the elements have wobbles and such that prevents perfect alignments.

I realize we weren’t anticipating large logic structure changes. I hope I'm not making too much of this. Whaddaya think?

LongtimeAirman
Admin

Posts : 561
Join date : 2014-08-10

View user profile

Back to top Go down

Re: Atomic Model Editor

Post by Nevyn on Mon Aug 10, 2015 11:03 pm

Hi Airman,

At the moment, I don't think this new paper impacts the Atomic Viewer. This new stuff is about calculating data from the atomic structure we have defined (and I am really happy to see some new ways to think about that in the new paper). The current structure is enough to describe the positions of particles and the rest is (will be) calculated from that.

Neutron alignment is not necessary (at the moment) because you could not tell the difference anyway (a sphere is a sphere no matter which orientation you look at it from) and we are not calculating that kind of data yet. I want to get to that point but it is a fair way off. I have started calculating data now. I have added some controls that allow you to set the ambient charge field strengths for north and south. This is then used to make the north and south axis arms spin, which, in turn, causes the carousel level (and core) to spin given the difference between north and south spin. This is very basic at the moment and does not take the size of the arms into consideration in determining how fast they rotate (it is mass so it must reduce the applied force). However, as the arms are usually well balanced, this is not too much of a problem.

Viewing all of this spinning is a bit jarring at the moment. I am not used to seeing it. I thought it looked great until I opened up a model that had some attachments in the pillar positions and it looked very strange as those attachments spun with the axis level. The balance of the atom seemed to be broken but the more I watched, the more I got used to it. You could see how those pillar attachments would take the charge from the carousel level which would cause a pulsing of charge through the nucleus as the attachments (and/or carousel) rotates and the attachment and carousel alphas move in and out of alignment. Miles has mentioned these charge pulses before but not in this way.

So, eventually, we may need to handle neutron alignment. This could be as simple as having a positive neutron count mean it uses charge and a negative neutron count means anti-charge. Or we add a new property called 'antiNeutrons' so that you could specify both neutrons and anti-neutrons in the same location (so neutron groups could have differing neutrons, can't really see where that would be needed but it might). This is probably my preferred option since it would leave the existing code working while ignoring the antiNeutron values. We will need to find some way to visually differentiate them based on this data too. I have some ideas but nothing I really like.

What I would really like to work on, as far as calculating data goes, is determining the charge strengths of the atom itself. Miles did some of this math in one of the nuclear papers (I think it might have been the paper about period 4). He talked about having a core strength (number of protons in the core) and would use that to gauge the strength of hook alphas (protons in hook / protons in core) and then related it to the number of full alphas in the noble levels (all major locations except hooks). I can't remember the specifics but when I first read about it I changed my models (in the old desktop app) so that they were specified much more like how I have built them in this new app (using the idea of arms rather than levels) in the hope of calculating data from it. I didn't get too far down the calculation route or rewriting the models to use it but I think the structure supports it.

From that data, we could determine what elements would bond together and show the general charge profile of the element. I think that would be a great start to using this data in a meaningful way. I just need to find the relevant references and make some sense of them.

Good to see you thinking about this though. Don't worry about taking something too far as it is often good to take it to an extreme and then dial it back to reality (which I think Miles mentioned in his latest paper, but I often work this way). I will just say that in programming, physics and math in general, you need to separate your 'givens' from your 'calculables'. That is, never specify what you can calculate (unless you have a very good reason such as performance, ease of use, etc, there are always exceptions to any rule).

The current JSON Element format specifies the structure of an element but in doing so it also specifies, or implies, the relationships between parts of the element and we can use this to calculate other data rather than specify it directly in the JSON. By doing it this way, all current models get the new feature for free but if we change the JSON definition, we have to change every single existing model to incorporate it. Remember, work smarter, not harder.

As an example, I added the 'angularVelocity' properties to various places in the JSON structure to handle rotations but once I had put in the ambient charge controls, I realised that I didn't need those values in the JSON anymore. The system took care of it all for me and I didn't need to change any models (which at this point is over 200 models if you include both mine and Cr6's data).

As a slight contradiction to that, I will point out that when first trying to implement something, it is good to just get in and build it in a direct fashion. Once you have it working, then you can try to make it more flexible or abstract or whatever you need it to be. It is a bit too much to think about, sometimes, to create the complete solution first go. This does become easier as you get more comfortable with programming (or whatever you apply this info to) because you don't need to think so much about the low-level code and you just think in higher-level concepts.
avatar
Nevyn
Admin

Posts : 787
Join date : 2014-09-11

View user profile http://www.nevyns-lab.com

Back to top Go down

Version 0.5

Post by Nevyn on Sat Aug 15, 2015 7:06 pm

Atomic Viewer 0.5 is here for all to enjoy.

We have quite a few changes this time around so we will start with the control panel. We have some new folders in the top level control panel with the list now containing: 'Atomic Models', 'Effects Settings', 'View Settings' and 'Graphics Settings'.
avatar
Nevyn
Admin

Posts : 787
Join date : 2014-09-11

View user profile http://www.nevyns-lab.com

Back to top Go down

Re: Atomic Model Editor

Post by Nevyn on Sat Aug 15, 2015 7:07 pm

Atomic Models


Contains actions to work with the models.

 'Select source' - select the current periodic table used to load elements.
 'Select element' - select elements to load from the current periodic table.
 'Define element' - improved and functional element UI system to specify particle counts.
 'Define JSON' - JSON based controls to copy/paste element definitions.
 'Remove' - delete the currently selected entities.
 'Remove all' - delete all current entities.
 'Rebuild' - rebuild all entities.
avatar
Nevyn
Admin

Posts : 787
Join date : 2014-09-11

View user profile http://www.nevyns-lab.com

Back to top Go down

Re: Atomic Model Editor

Post by Nevyn on Sat Aug 15, 2015 7:08 pm

Effects Settings


Contains controls that change settings for runtime effects. These are actions that are calculated every frame (or close enough).

 'Behaviors' - sub folder containing Behavior related controls.
   'Enabled' - enable/disable all Behaviors. No Behavior will be executed.
   'Scheduling' - enable/disable Behavior scheduling. This sets all Behaviors as scheduled to be executed.
   'Schedule radius' - set the radius of the scheduling bounds.
   'Element radius' - set the scheduling radius of each element.
   
 'Particles' - sub folder containing particle related controls.
   'Neutrons' - sub folder containing neutron related controls.
     'Enabled' - enable/disable neutrons being shown.
     'Rotate' - enable/disable rotation of neutrons.
     'Rotation rate' - set the rate of rotation of neutrons in radians/s.
   'Electrons' - sub folder containing electron related controls.
     'Enabled' - enable/disable electrons being shown.
     'Rotate' - enable/disable rotation of electrons.
     'Rotation rate' - set the rate of rotation of electrons in radians/s.
     'Charge field' - enable/disable the charge field on electrons, causes crashes on large or many elements.
     
 'Charge field' - sub folder containing charge field related controls.
   'Enabled' - enable/disable ambient charge field calculations.
   'Rotation rate' - set the base rotation rate in radians/s.
   'Charge density' - set the charge density which comes down from the top of the screen.
   'Anti-charge' - set the anti-charge density which comes up from the bottom of the screen.


Last edited by Nevyn on Sun Aug 16, 2015 9:25 am; edited 2 times in total
avatar
Nevyn
Admin

Posts : 787
Join date : 2014-09-11

View user profile http://www.nevyns-lab.com

Back to top Go down

Re: Atomic Model Editor

Post by Nevyn on Sat Aug 15, 2015 7:09 pm

View Settings


Contains view related controls which are often more static than the Effects Settings.

 'Placement' - set the method used for placing elements.
 'Explode' - set the distance between proton stacks.
 
 'Background' - sub folder for background related controls.
   'Sky' - set the background sky model.
   'Landscape' - set the background landscape model.
   'Presets' - set both at once to a preset setting.
 
 'Meta Data' - sub folder containing information controls.
   'Show metadata' - enable/disable all metadata shown.
   'Show symbol' - enable/disable showing the atomic symbol.
   'Show title' - enable/disable showing the elements name.
   'Show number' - enable/disable showing the atomic number.
 
 'Proton Stack' - sub folder containing controls for changing proton stack settings.
   'Field size' - set the size of the charge field.
   'Neutron location' - set the percentage of Field size to locate neutrons.
   'Color scheme' - set the color scheme used to color proton stacks.
   
   'Color' - sub folder containing color related controls.
     '1 Proton' - set the color of a 1 proton stack.
     '2 Proton' - set the color of a 2 proton stack.
     '3 Proton' - set the color of a 3 proton stack.
     '4 Proton' - set the color of a 4 proton stack.
     '5 Proton' - set the color of a 5 proton stack.
     '6 Proton' - set the color of a 6 proton stack.
avatar
Nevyn
Admin

Posts : 787
Join date : 2014-09-11

View user profile http://www.nevyns-lab.com

Back to top Go down

Re: Atomic Model Editor

Post by Nevyn on Sat Aug 15, 2015 7:10 pm

Graphics Settings


Contains graphics settings. These will often require rebuilding elements to implement changes.

 'Performance' - set the general performance level your system can handle.
 
 'Particles' - sub folder containing particle related graphics settings.
   'Geometry quality' - set the maximum quality of geometry used to build particles.
   'Material quality' - set the maximum quality of materials used to build particles.
 
 'Charge Emission' - sub folder containing charge emission related controls.
   'Quality' - set the maximum quality of charge fields.
   'Transparent' - enable/disable transparent charge fields. performance hit.
   'Opacity' - set the amount of transparency (by opacity) of charge fields.
   'Wireframe' - enable/disable wireframe charge fields.
 
 'Lighting' - sub folder containing light controls.
   'Enabled' - enable/disable all lighting.
   
   'Ambient' - sub folder containing ambient light settings.
     'Enabled' - enable/disable the ambient light.
     'Color' - set the color of the ambient light.
   
   'Hemisphere' - sub folder containing hemisphere light settings.
     'Enabled' - enable/disable the hemisphere light.
     'Sky color' - set the sky color of the hemisphere light.
     'Ground color' - set the ground color of the hemisphere light.
     'Intensity' - set the intensity of the light.
   
   'Directional' - sub folder containing directional light settings.
     'Enabled' - enable/disable the directional lights.
     
     'Light 1' - sub folder containing controls for directional light 1.
       'Enabled' - enable/disable directional light 1.
       'Color' - set the color of directional light 1.
       'Intensity' - set the intensity of directional light 1.
       
       'Position' - sub folder containing position related controls.
         'X' - set the X direction of directional light 1.
         'Y' - set the Y direction of directional light 1.
         'Z' - set the Z direction of directional light 1.
     
     'Light 2' - sub folder containing controls for directional light 2.
       'Enabled' - enable/disable directional light 2.
       'Color' - set the color of directional light 2.
       'Intensity' - set the intensity of directional light 2.
       
       'Position' - sub folder containing position related controls.
         'X' - set the X direction of directional light 2.
         'Y' - set the Y direction of directional light 2.
         'Z' - set the Z direction of directional light 2.
   
   'Spot' - sub folder containing spot light settings.
     'Enabled' - enable/disable the spot lights.
     
     'Light 1' - sub folder containing controls for spot light 1.
       'Enabled' - enable/disable spot light 1.
       'Color' - set the color of spot light 1.
       'Intensity' - set the intensity of spot light 1.
       'Distance' - set the distance of spot light 1.
       'Angle' - set the angle of spot light 1.
       'Dissipation' - set the dissipation rate of spot light 1.
       
       'Position' - sub folder containing position related controls.
         'X' - set the X direction of spot light 1.
         'Y' - set the Y direction of spot light 1.
         'Z' - set the Z direction of spot light 1.
     
     'Light 2' - sub folder containing controls for spot light 2.
       'Enabled' - enable/disable spot light 2.
       'Color' - set the color of spot light 2.
       'Intensity' - set the intensity of spot light 2.
       'Distance' - set the distance of spot light 2.
       'Angle' - set the angle of spot light 2.
       'Dissipation' - set the dissipation rate of spot light 2.
       
       'Position' - sub folder containing position related controls.
         'X' - set the X direction of spot light 2.
         'Y' - set the Y direction of spot light 2.
         'Z' - set the Z direction of spot light 2.[/b]


Last edited by Nevyn on Sun Aug 16, 2015 9:27 am; edited 1 time in total
avatar
Nevyn
Admin

Posts : 787
Join date : 2014-09-11

View user profile http://www.nevyns-lab.com

Back to top Go down

Re: Atomic Model Editor

Post by Nevyn on Sat Aug 15, 2015 7:10 pm

Behaviors


A Behavior is a schedulable action that will cause change in the scene. It has a schedulingBounds which is a sphere that defines the volume of space of the Behavior. The Behavior Engine also has a schedulingBounds, centered on the camera, and if the two schedulingBounds intersect, then the Behavior is scheduled for execution.

Before a Behavior is executed, it is checked to determine if the Behavior is actually executable. If so, then its execute method will be invoked and it can perform its changes on the system. This pre-check allows a Behavior to check for custom conditions such as 'is the control key down'.

The idea behind this Behavior Engine is to reduce unnecessary computations. If an element is so far away from you that you can't see its electrons, then why rotate them? There is a performance penalty for this, even though I am trying to enhance performance. Checking sphere intersections can be expensive if you have too many of them, however, it is pretty hard to tell the difference on my machine.
avatar
Nevyn
Admin

Posts : 787
Join date : 2014-09-11

View user profile http://www.nevyns-lab.com

Back to top Go down

Re: Atomic Model Editor

Post by Nevyn on Sat Aug 15, 2015 7:10 pm

Ambient Charge Field


The app now contains a rudimentary ambient charge field system. It is not visible in any way other than how it affects the atoms which will rotate in various ways depending on the charge and anti-charge values. The north axis will spin based on the charge value and the south axis will spin based on the anti-charge value (I think I have those the wrong way around, as far as Miles defines them, but it doesn't really matter). The net spin from the axes is then applied to the core and carousel level.
avatar
Nevyn
Admin

Posts : 787
Join date : 2014-09-11

View user profile http://www.nevyns-lab.com

Back to top Go down

Re: Atomic Model Editor

Post by Nevyn on Sat Aug 15, 2015 7:11 pm

Defining Elements


There is now a working set of UI controls that allow you to edit an elements proton, neutron and electron counts. I spent some time trying to get all of these controls on the screen but it was a nightmare. So I came up with an idea to show a button per proton stack which would then popup the controls to edit that stack. I think this works a lot better than my previous attempts but is still a little bit clumsy. I did have an idea of arranging the proton stack buttons to mimic the structure of the atom but it is difficult to represent a 3D structure in a 2D hierarchy and I eventually want to do these edits from within the 3D world (ie, double click on a proton stack to edit it) so it is not really worth spending too much time on.
avatar
Nevyn
Admin

Posts : 787
Join date : 2014-09-11

View user profile http://www.nevyns-lab.com

Back to top Go down

Re: Atomic Model Editor

Post by Nevyn on Sat Aug 15, 2015 7:11 pm

Placing Elements


I have implemented some functions that place the elements in various ways. From lines to grids to rings to spirals. I'm not sure how useful these will be for you guys but they are good for me to test things like level-of-detail and behavior scheduling.
avatar
Nevyn
Admin

Posts : 787
Join date : 2014-09-11

View user profile http://www.nevyns-lab.com

Back to top Go down

Re: Atomic Model Editor

Post by Nevyn on Sat Aug 15, 2015 7:11 pm

Level of Detail


The 3D structure of the elements can now use level of detail (LOD) nodes. Each LOD node contains a number of child objects but it will only show one of them based on how far away the LOD node is from the camera. Therefore, I use less and less detail, and hence less and less power required to render them, the further away it is. While this works, I am not very happy with how it has been implemented. I fitted it into the structure at the most convenient spot in the code to test it, but this is too low. Therefore, there are too many LOD nodes. Unfortunately, moving the LOD nodes higher up the hierarchy is proving difficult because of other factors.
avatar
Nevyn
Admin

Posts : 787
Join date : 2014-09-11

View user profile http://www.nevyns-lab.com

Back to top Go down

Re: Atomic Model Editor

Post by Nevyn on Sat Aug 15, 2015 7:11 pm

Element Selection


You can click on an element to select it. Clicking anywhere else or on another element will deselect the current selection (and select the new one). Control+click will add to/remove from the selection. When an element is selected, it will be used in some of the dialog boxes used to define elements such as the 'Define element' and 'Define JSON' dialogs. The 'Define element' dialog can only use 1 element at a time so it will edit the first selected element or create a new one (just the definition, not the viewable atom) if none are selected.
avatar
Nevyn
Admin

Posts : 787
Join date : 2014-09-11

View user profile http://www.nevyns-lab.com

Back to top Go down

Re: Atomic Model Editor

Post by Nevyn on Sat Aug 15, 2015 7:11 pm

Progress Monitor


I have fixed some bugs in the progress monitor. This allows it to handle many consecutive operations without the progress bar disappearing. When on the 'Select element' dialog, you can quickly press an element button, say 10 times, and it will load them all in with no glitches.

I also fixed some bugs in the loading system that caused some crashes. I created a loading system that only allows 1 action at a time and the tasks of that action are performed in small steps from within the rendering loop. This allows the progress monitor to be updated and show the progress to the user. I previously had 2 streams within the loading system. One for building individual elements and another for rebuilding all elements. The idea was that if 2 requests came it to rebuild the elements, and neither of them had started executing yet, then we can ignore the second request because the first will satisfy it. Unfortunately, the 2 loading streams could collide so I reduced it to 1 stream so the system is much more stable.


Last edited by Nevyn on Sat Aug 15, 2015 7:16 pm; edited 1 time in total
avatar
Nevyn
Admin

Posts : 787
Join date : 2014-09-11

View user profile http://www.nevyns-lab.com

Back to top Go down

Re: Atomic Model Editor

Post by Nevyn on Sat Aug 15, 2015 7:12 pm

Motion Controls


Previous versions of the Atomic Viewer used one of the control schemes in the three.js examples (OrbitControls.js). I didn't like the way this was working. It was fine if you only had 1 or 2 models in the scene but once I added the placement functions, its limitations started to show up. The main problem with the previous control scheme was that it only allowed you to zoom in so far and the closer you got to the 'center' the slower it zoomed. So I have changed that control scheme so that it moves around in the scene rather than being locked to a certain orbit location.

This works much better now but there are some limitations on touch devices. On a PC, the left mouse button will rotate the view while the right mouse button will pan in the X and Y planes. On touch devices, you can mimic the right mouse button with a three fingure gesture. I haven't tried this but the code is there to support it. You can still rotate the view and move in the Z plane (2 finger gesture, bring fingers together to move forward, apart to move backward).

On a PC, you can hold down the shift key to amplify the distance moved in any direction. You can hold down the control key to attenuate the distance so that you have more precise control over motion. If you hold down both at the same time, then it will just move like normal since the amplification and attenuation will offset each other.


Last edited by Nevyn on Sun Aug 16, 2015 8:58 am; edited 2 times in total
avatar
Nevyn
Admin

Posts : 787
Join date : 2014-09-11

View user profile http://www.nevyns-lab.com

Back to top Go down

Re: Atomic Model Editor

Post by Nevyn on Sat Aug 15, 2015 7:12 pm

Periodic Tables


The system now supports multiple periodic tables. Use the 'Select source' action to choose between the available models. There are currently 3 models: 'Nevyn's periodic table', 'Cr6's periodic table' and 'Test Models'. This last one is some models I made up to test various things. Have a look at the neutron models to see how far you can go with neutron and attachment placement. Then set the neutrons to rotate and watch all of that glorious motion. Its mesmerizing. The attachments model is an illegal structure as far as atoms go, but is there to test the system, not demonstrate good element structure.
avatar
Nevyn
Admin

Posts : 787
Join date : 2014-09-11

View user profile http://www.nevyns-lab.com

Back to top Go down

Re: Atomic Model Editor

Post by Nevyn on Sat Aug 15, 2015 7:30 pm

Key Bindings


There are some keyboard bindings that can be used for various tasks.

space - will pause/unpause the 3D scene rendering.
h - will hide/show the control panel.
t - will show the 'Select source' dialog.
e - will show the 'Select element' dialog.
d - will show the 'Define element' dialog.
j - will show the 'Define JSON' dialog.
s - will enable/disable the motion controls.
r - will reset the viewing position, orientation and scale to the default settings.
delete - will delete the selected entities.
backspace - will delete all entities.
avatar
Nevyn
Admin

Posts : 787
Join date : 2014-09-11

View user profile http://www.nevyns-lab.com

Back to top Go down

Re: Atomic Model Editor

Post by Nevyn on Sat Aug 15, 2015 8:20 pm

I just noticed that there is a slight bug in Firefox, but only when using it from the web. If I load it up from my local system, then it displays correctly. However, if I load it through the web site, which should be the exact same source code, the view seems to move up a bit so the top of the page is not quite rendered correctly and the bottom shows a gap. Doesn't do this in Chrome or IE.

Speaking of loading from your local system, this is not really feasible anymore. Unfortunately, when loading textures, it checks for cross-site security issues (on the web, you can't really retrieve resources from different places unless the server says that it is ok to do so) and if you don't have a back-end server, such as loading direct from a file, it will not load the textures. I solve this by using a back-end server so that I can run locally while developing and when I deploy to the web, it already has a back-end server. It isn't really that hard to run a server but it is probably more than most are willing to do.
avatar
Nevyn
Admin

Posts : 787
Join date : 2014-09-11

View user profile http://www.nevyns-lab.com

Back to top Go down

Page 1 of 7 1, 2, 3, 4, 5, 6, 7  Next

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum