Solid State Physics - Octave (programming) help (1 Viewer)

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

68
0
I'm currently undertaking a course in Solid State Physics and my professor has asked us to undertake some work in the free software 'Octave'. I have not had any programming experience in my life and I am feeling very much out of my depth.

The lecturer gave us an initial file with the relevant code in it and we had to modify certain parameters and see how that affected the output.

The one that is giving me grief is turning the one basis lattice into a two basis lattice.

The original code to create the lattice was "c=c+atom(x.-n*a,w)", where x essentially represents the x axis and c the y axis. w is a variable to determine the type of atom in each basis, a is the lattice constant and n is related to the number of atoms in the crystal. The question says "Put two identical atoms in each cell, n_at(x; w=16)+n_at(x-1/3;w=16)"

So my attempt was to replace the above code with: "c=c+atom(x.-n*a,w)+atom(x.-n*a-1/3,w)"

But to no avail. I'm not sure what I'm doing wrong, but if anyone could give me a push or perhaps suggest somewhere where I can find help on this (the Octave website wasn't much use) I'd be greatly appreciative.
 

The Physics Forums Way

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving
Top