Message: Materials Definition Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Materials Definition 

Forum: Geometry
Date: 31 Aug, 2009
From: Nick Laver <Nick Laver>

Good Evening all,

I am not sure I am posting this in the correct section of the forum for this I apologise.

I am having a few issues definine my materials in my DetectorConstruct file for lines 87 through 107 I have written

G4double a, z;
  G4double density, temperature, pressure;
  G4int nel;

  G4Element* H = new G4Element("Hydrogen", "H", z=2., a= 1.0079*g/mole);
  G4Element* O = new G4Element("Oxygen"  , "O", z=8., a= 16.00*g/mole);

  G4Material* Water = new G4Material("Water", density= 1*g/cm3);
  Water->AddElement(H, natoms=2);
  Water->AddElement(O, natoms=1);

  G4Element* Fe = new G4Element("Iron", "Fe", z=26., a= 55.845*g/mole);
  G4Element* Cr = new G4Element("Chromium"  , "Cr", z=24., a= 51.9961*g/mole);
  G4Element* Ni = new G4Element("Nickel", "Ni", z=28., a= 58.6934*g/mole);

  G4Material* SSteel = new G4Material("SSteel", density= 8.03*g/cm3);
  SSteel->AddElement(Fe, 74*perCent);
  SSteel->AddElement(Cr, 18*perCent);
  SSteel->AddElement(Ni, 8*perCent);

I am being returned two errors one reading error C2661:'G4Material::G4Material' : no overloaded function takes 2 arguments which relates to lines 95 and 104 of my code and another reading error C2065:'natoms' : undeclared identifier which relates to 96 and 97.

I was wondering if anybody has a quick fix to this problem could advise me to where Ive gone wrong. Im pretty new to C++ (or programming of any nature) so I apologise for my rubbishness

gratitude in advance


Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: Materials Definition   (John Allison - 01 Sep, 2009)
2 None: Re: Materials Definition   (michel maire - 01 Sep, 2009)
 Add Message Add Message
to: "Materials Definition"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]